From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MIME_BASE64_TEXT,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6665C433E1 for ; Sat, 30 May 2020 08:14:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 837D82070E for ; Sat, 30 May 2020 08:14:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="uvAnnSAE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729071AbgE3IOk (ORCPT ); Sat, 30 May 2020 04:14:40 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:32551 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728762AbgE3IOk (ORCPT ); Sat, 30 May 2020 04:14:40 -0400 X-UUID: af53a1923917446cbd3040c63b67634c-20200530 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=A7Ij86f1Labbs4iNJzkgqVTmCUzg7B1wyI2Cz/ZNwIM=; b=uvAnnSAE5cdgiz8mYQgX/1yHJvg4Mun3w4M8CqidFpKH8i0dDWGx+hjLHZum0Um9BgIGwHH60ECt8yQKBvmS4GoSuUiJKKWyFzbl5ucqmyzotWHnpcUEFbVz1fkX0fUA9I7FxI3ImT5bc8+QJp7HMzlLI1AExH7Nc/AwwkRtlT4=; X-UUID: af53a1923917446cbd3040c63b67634c-20200530 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1038220398; Sat, 30 May 2020 16:14:36 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 30 May 2020 16:14:32 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sat, 30 May 2020 16:14:33 +0800 From: Yong Wu To: Matthias Brugger , Joerg Roedel , Rob Herring CC: Evan Green , Robin Murphy , Tomasz Figa , Will Deacon , , , , , , , , , Nicolas Boichat , Matthias Kaehlcke , , , , , , Subject: [PATCH v4 14/17] memory: mtk-smi: Use device_is_bound to check if smi-common is ready Date: Sat, 30 May 2020 16:10:15 +0800 Message-ID: <1590826218-23653-15-git-send-email-yong.wu@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1590826218-23653-1-git-send-email-yong.wu@mediatek.com> References: <1590826218-23653-1-git-send-email-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Content-Transfer-Encoding: base64 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org c21pLWxhcmIgZHJpdmVyIHNob3VsZCBydW4gYWZ0ZXIgc21pLWNvbW1vbiwgVXNlIGRldmljZV9p c19ib3VuZCB0byBjb25maXJtDQp3aGV0aGVyIHNtaWNvbW1vbiBkcml2ZXIgaXMgcmVhZHkuDQoN CkNDOiBNYXR0aGlhcyBCcnVnZ2VyIDxtYXR0aGlhcy5iZ2dAZ21haWwuY29tPg0KU2lnbmVkLW9m Zi1ieTogWW9uZyBXdSA8eW9uZy53dUBtZWRpYXRlay5jb20+DQotLS0NCiBkcml2ZXJzL21lbW9y eS9tdGstc21pLmMgfCA4ICsrKysrKystDQogMSBmaWxlIGNoYW5nZWQsIDcgaW5zZXJ0aW9ucygr KSwgMSBkZWxldGlvbigtKQ0KDQpkaWZmIC0tZ2l0IGEvZHJpdmVycy9tZW1vcnkvbXRrLXNtaS5j IGIvZHJpdmVycy9tZW1vcnkvbXRrLXNtaS5jDQppbmRleCAxOWMzOTQ5Li4wZjhjZDUwIDEwMDY0 NA0KLS0tIGEvZHJpdmVycy9tZW1vcnkvbXRrLXNtaS5jDQorKysgYi9kcml2ZXJzL21lbW9yeS9t dGstc21pLmMNCkBAIC0yOTYsOCArMjk2LDE0IEBAIHN0YXRpYyBpbnQgbXRrX3NtaV9sYXJiX3By b2JlKHN0cnVjdCBwbGF0Zm9ybV9kZXZpY2UgKnBkZXYpDQogCXNtaV9wZGV2ID0gb2ZfZmluZF9k ZXZpY2VfYnlfbm9kZShzbWlfbm9kZSk7DQogCW9mX25vZGVfcHV0KHNtaV9ub2RlKTsNCiAJaWYg KHNtaV9wZGV2KSB7DQotCQlpZiAoIXBsYXRmb3JtX2dldF9kcnZkYXRhKHNtaV9wZGV2KSkNCisJ CWJvb2wgc21pY29tbW9uX2lzX2JvdW5kOw0KKw0KKwkJZGV2aWNlX2xvY2soJnNtaV9wZGV2LT5k ZXYpOw0KKwkJc21pY29tbW9uX2lzX2JvdW5kID0gZGV2aWNlX2lzX2JvdW5kKCZzbWlfcGRldi0+ ZGV2KTsNCisJCWRldmljZV91bmxvY2soJnNtaV9wZGV2LT5kZXYpOw0KKwkJaWYgKCFzbWljb21t b25faXNfYm91bmQpDQogCQkJcmV0dXJuIC1FUFJPQkVfREVGRVI7DQorDQogCQlsYXJiLT5zbWlf Y29tbW9uX2RldiA9ICZzbWlfcGRldi0+ZGV2Ow0KIAkJbGluayA9IGRldmljZV9saW5rX2FkZChk ZXYsIGxhcmItPnNtaV9jb21tb25fZGV2LA0KIAkJCQkgICAgICAgRExfRkxBR19QTV9SVU5USU1F IHwgRExfRkxBR19TVEFURUxFU1MpOw0KLS0gDQoxLjkuMQ0K From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C29EBC433DF for ; Sat, 30 May 2020 08:19:43 +0000 (UTC) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8BA3C2070E for ; Sat, 30 May 2020 08:19:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="uvAnnSAE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8BA3C2070E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 6C53E87551; Sat, 30 May 2020 08:19:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QlsNyvy9n-qQ; Sat, 30 May 2020 08:19:43 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 0A59787539; Sat, 30 May 2020 08:19:43 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id EA1A4C0863; Sat, 30 May 2020 08:19:42 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id B35C8C016F for ; Sat, 30 May 2020 08:19:41 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id A1B2087821 for ; Sat, 30 May 2020 08:19:41 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DAgFyCQhWi+A for ; Sat, 30 May 2020 08:19:41 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by whitealder.osuosl.org (Postfix) with ESMTP id 11F9E87E1F for ; Sat, 30 May 2020 08:19:40 +0000 (UTC) X-UUID: af53a1923917446cbd3040c63b67634c-20200530 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=A7Ij86f1Labbs4iNJzkgqVTmCUzg7B1wyI2Cz/ZNwIM=; b=uvAnnSAE5cdgiz8mYQgX/1yHJvg4Mun3w4M8CqidFpKH8i0dDWGx+hjLHZum0Um9BgIGwHH60ECt8yQKBvmS4GoSuUiJKKWyFzbl5ucqmyzotWHnpcUEFbVz1fkX0fUA9I7FxI3ImT5bc8+QJp7HMzlLI1AExH7Nc/AwwkRtlT4=; X-UUID: af53a1923917446cbd3040c63b67634c-20200530 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1038220398; Sat, 30 May 2020 16:14:36 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 30 May 2020 16:14:32 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sat, 30 May 2020 16:14:33 +0800 From: Yong Wu To: Matthias Brugger , Joerg Roedel , Rob Herring Subject: [PATCH v4 14/17] memory: mtk-smi: Use device_is_bound to check if smi-common is ready Date: Sat, 30 May 2020 16:10:15 +0800 Message-ID: <1590826218-23653-15-git-send-email-yong.wu@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1590826218-23653-1-git-send-email-yong.wu@mediatek.com> References: <1590826218-23653-1-git-send-email-yong.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N Cc: youlin.pei@mediatek.com, devicetree@vger.kernel.org, Nicolas Boichat , cui.zhang@mediatek.com, eizan@chromium.org, srv_heupstream@mediatek.com, chao.hao@mediatek.com, Will Deacon , linux-kernel@vger.kernel.org, Evan Green , Tomasz Figa , iommu@lists.linux-foundation.org, Matthias Kaehlcke , linux-mediatek@lists.infradead.org, ming-fan.chen@mediatek.com, anan.sun@mediatek.com, Robin Murphy , acourbot@chromium.org, linux-arm-kernel@lists.infradead.org X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" smi-larb driver should run after smi-common, Use device_is_bound to confirm whether smicommon driver is ready. CC: Matthias Brugger Signed-off-by: Yong Wu --- drivers/memory/mtk-smi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index 19c3949..0f8cd50 100644 --- a/drivers/memory/mtk-smi.c +++ b/drivers/memory/mtk-smi.c @@ -296,8 +296,14 @@ static int mtk_smi_larb_probe(struct platform_device *pdev) smi_pdev = of_find_device_by_node(smi_node); of_node_put(smi_node); if (smi_pdev) { - if (!platform_get_drvdata(smi_pdev)) + bool smicommon_is_bound; + + device_lock(&smi_pdev->dev); + smicommon_is_bound = device_is_bound(&smi_pdev->dev); + device_unlock(&smi_pdev->dev); + if (!smicommon_is_bound) return -EPROBE_DEFER; + larb->smi_common_dev = &smi_pdev->dev; link = device_link_add(dev, larb->smi_common_dev, DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS); -- 1.9.1 _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 296D0C433DF for ; Sat, 30 May 2020 08:23:03 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id C00282070E for ; Sat, 30 May 2020 08:23:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Ng0KPaTs"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="uvAnnSAE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C00282070E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: 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: List-Owner; bh=2tU/g3+H1O4j9ZsOcUGmyRVgRoOyFOiXn+MYUtSzFtQ=; b=Ng0KPaTsBs3ZvW qOL4uzV1EphKP0Z5O0paRXvAZdUndvLwSiYugJJ6aRLQ68nekhjUIk/MZZcJu3+QOlFDqFtfC+s/L /Gc+jmMFxA8fowc03IM0FAPY5CTpHOqz3TTUWzxsrnRlqJwY7J51k4BHGso6JoWFWz2prYtQY7gq4 txmDjXwdw2RgAEdGTDmdMYfLZUqyDZnX6CTXNdaPWmP2ruQICaMuyWGFlDGq8DJ7mdcfdHoxtMRgD 1YM5MBhFZANJs0wtF8601kN5x9ommSZ2tdAWap6tW1zhUTcPH8s0aBD8roSXvPtEPwc30lJ3pDSAr fb1HIVCfkQaOmI+MzWRA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jewlV-0004jD-8O; Sat, 30 May 2020 08:22:49 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jewlH-0004Y0-Ig; Sat, 30 May 2020 08:22:37 +0000 X-UUID: a7f037f372d94dc494e8d823f8b5abc4-20200530 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=A7Ij86f1Labbs4iNJzkgqVTmCUzg7B1wyI2Cz/ZNwIM=; b=uvAnnSAE5cdgiz8mYQgX/1yHJvg4Mun3w4M8CqidFpKH8i0dDWGx+hjLHZum0Um9BgIGwHH60ECt8yQKBvmS4GoSuUiJKKWyFzbl5ucqmyzotWHnpcUEFbVz1fkX0fUA9I7FxI3ImT5bc8+QJp7HMzlLI1AExH7Nc/AwwkRtlT4=; X-UUID: a7f037f372d94dc494e8d823f8b5abc4-20200530 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1655635172; Sat, 30 May 2020 00:22:27 -0800 Received: from mtkmbs07n1.mediatek.inc (172.21.101.16) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 30 May 2020 01:14:34 -0700 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 30 May 2020 16:14:32 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sat, 30 May 2020 16:14:33 +0800 From: Yong Wu To: Matthias Brugger , Joerg Roedel , Rob Herring Subject: [PATCH v4 14/17] memory: mtk-smi: Use device_is_bound to check if smi-common is ready Date: Sat, 30 May 2020 16:10:15 +0800 Message-ID: <1590826218-23653-15-git-send-email-yong.wu@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1590826218-23653-1-git-send-email-yong.wu@mediatek.com> References: <1590826218-23653-1-git-send-email-yong.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200530_012235_621225_C57BFFC8 X-CRM114-Status: GOOD ( 11.01 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: youlin.pei@mediatek.com, devicetree@vger.kernel.org, Nicolas Boichat , cui.zhang@mediatek.com, eizan@chromium.org, srv_heupstream@mediatek.com, chao.hao@mediatek.com, Will Deacon , linux-kernel@vger.kernel.org, Evan Green , Tomasz Figa , iommu@lists.linux-foundation.org, Matthias Kaehlcke , linux-mediatek@lists.infradead.org, yong.wu@mediatek.com, ming-fan.chen@mediatek.com, anan.sun@mediatek.com, Robin Murphy , acourbot@chromium.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org smi-larb driver should run after smi-common, Use device_is_bound to confirm whether smicommon driver is ready. CC: Matthias Brugger Signed-off-by: Yong Wu --- drivers/memory/mtk-smi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index 19c3949..0f8cd50 100644 --- a/drivers/memory/mtk-smi.c +++ b/drivers/memory/mtk-smi.c @@ -296,8 +296,14 @@ static int mtk_smi_larb_probe(struct platform_device *pdev) smi_pdev = of_find_device_by_node(smi_node); of_node_put(smi_node); if (smi_pdev) { - if (!platform_get_drvdata(smi_pdev)) + bool smicommon_is_bound; + + device_lock(&smi_pdev->dev); + smicommon_is_bound = device_is_bound(&smi_pdev->dev); + device_unlock(&smi_pdev->dev); + if (!smicommon_is_bound) return -EPROBE_DEFER; + larb->smi_common_dev = &smi_pdev->dev; link = device_link_add(dev, larb->smi_common_dev, DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS); -- 1.9.1 _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FA2CC433E0 for ; Sat, 30 May 2020 08:22:40 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 2B2442070E for ; Sat, 30 May 2020 08:22:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="JUQgbS23"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="uvAnnSAE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2B2442070E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: 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: List-Owner; bh=InnIQtq47ucG9mcScTqGOkID3cPsUbknbEZe8xwDrgU=; b=JUQgbS23w4hj// snhSuI7vY3qwFAEhoKInNJBiXLGMEzbL/yG0xRGESQMM8JtxgMcIfwa6Rm3UTIdrlerK+NVX9Tc6y e/hYZ2sF5S6aPYP5Hiil6lsQRgmNBVOJm9mvNRM4kfnTB8EYFO35qsj6//RFnXmchHLKgpTK56inQ dTOwmx4Sc5SAVGC3qSeOQHRWeXNX6HwUVN/9CP3FqsWV5pqAKJLBVpdyn+0Kg0xMpFptB2dWyJ2va ryJWHbSO9Vj0XpFwEtUpIi3eqj7O3l3Z2CI3+Z8fMNzyDp32uNcPhnpinv5Dm/EilzXHCESRpH1p1 ZqNwRkVQr5jxWv52JSJg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jewlL-0004Zr-Ap; Sat, 30 May 2020 08:22:39 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jewlH-0004Y0-Ig; Sat, 30 May 2020 08:22:37 +0000 X-UUID: a7f037f372d94dc494e8d823f8b5abc4-20200530 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=A7Ij86f1Labbs4iNJzkgqVTmCUzg7B1wyI2Cz/ZNwIM=; b=uvAnnSAE5cdgiz8mYQgX/1yHJvg4Mun3w4M8CqidFpKH8i0dDWGx+hjLHZum0Um9BgIGwHH60ECt8yQKBvmS4GoSuUiJKKWyFzbl5ucqmyzotWHnpcUEFbVz1fkX0fUA9I7FxI3ImT5bc8+QJp7HMzlLI1AExH7Nc/AwwkRtlT4=; X-UUID: a7f037f372d94dc494e8d823f8b5abc4-20200530 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1655635172; Sat, 30 May 2020 00:22:27 -0800 Received: from mtkmbs07n1.mediatek.inc (172.21.101.16) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 30 May 2020 01:14:34 -0700 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 30 May 2020 16:14:32 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sat, 30 May 2020 16:14:33 +0800 From: Yong Wu To: Matthias Brugger , Joerg Roedel , Rob Herring Subject: [PATCH v4 14/17] memory: mtk-smi: Use device_is_bound to check if smi-common is ready Date: Sat, 30 May 2020 16:10:15 +0800 Message-ID: <1590826218-23653-15-git-send-email-yong.wu@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1590826218-23653-1-git-send-email-yong.wu@mediatek.com> References: <1590826218-23653-1-git-send-email-yong.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200530_012235_621225_C57BFFC8 X-CRM114-Status: GOOD ( 11.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: youlin.pei@mediatek.com, devicetree@vger.kernel.org, Nicolas Boichat , cui.zhang@mediatek.com, eizan@chromium.org, srv_heupstream@mediatek.com, chao.hao@mediatek.com, Will Deacon , linux-kernel@vger.kernel.org, Evan Green , Tomasz Figa , iommu@lists.linux-foundation.org, Matthias Kaehlcke , linux-mediatek@lists.infradead.org, yong.wu@mediatek.com, ming-fan.chen@mediatek.com, anan.sun@mediatek.com, Robin Murphy , acourbot@chromium.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org smi-larb driver should run after smi-common, Use device_is_bound to confirm whether smicommon driver is ready. CC: Matthias Brugger Signed-off-by: Yong Wu --- drivers/memory/mtk-smi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index 19c3949..0f8cd50 100644 --- a/drivers/memory/mtk-smi.c +++ b/drivers/memory/mtk-smi.c @@ -296,8 +296,14 @@ static int mtk_smi_larb_probe(struct platform_device *pdev) smi_pdev = of_find_device_by_node(smi_node); of_node_put(smi_node); if (smi_pdev) { - if (!platform_get_drvdata(smi_pdev)) + bool smicommon_is_bound; + + device_lock(&smi_pdev->dev); + smicommon_is_bound = device_is_bound(&smi_pdev->dev); + device_unlock(&smi_pdev->dev); + if (!smicommon_is_bound) return -EPROBE_DEFER; + larb->smi_common_dev = &smi_pdev->dev; link = device_link_add(dev, larb->smi_common_dev, DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS); -- 1.9.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel