From patchwork Thu Apr 30 10:06:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrice CHOTARD X-Patchwork-Id: 1280131 X-Patchwork-Delegate: trini@ti.com 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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.a=rsa-sha256 header.s=STMicroelectronics header.b=GIFudSRz; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 49CWKS1Zf6z9sSd for ; Thu, 30 Apr 2020 20:07:56 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0AD51821F1; Thu, 30 Apr 2020 12:06:58 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.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=st.com header.i=@st.com header.b="GIFudSRz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C29A1821EC; Thu, 30 Apr 2020 12:06:47 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9A67E821DF for ; Thu, 30 Apr 2020 12:06:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=patrice.chotard@st.com Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03UA2jdO025883; Thu, 30 Apr 2020 12:06:23 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=8+vgnkUvr01MpxDSdgbfO4NsTUAmBzr5zjyZRulm1S4=; b=GIFudSRzCQf3rq1Jz5yKTBIytHnLEne8HT6+Yczc9GZtH+FR6LA6sjkTFBx+2k60t/3D m49Cv4rDsjBfCfVDhFR8isNqTxyJthbarVaNUvs3BTZaboBLgHavbfjDJK+PaqOkIz9W Y3PYWgRK7MEPc/i2jw+TgEjo6ZWGwQkA+lGEngaH0h81MgJzQoB7kdtPv5LLMHB9mgXs eV3rFhLnIrIta7J0A47KYQ/0D/d9iZ6X6ckHB+KT32TXANHiBsqdFFvEuEHdMYS8/tJA bLsSxjCxoVy/eJHJSf9v5L4tNWoyHN52N4d+C0pYofOkT7deap3uGrknjWqBAARDckjv 7g== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 30mhq6bhst-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 Apr 2020 12:06:23 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id E9DCB100038; Thu, 30 Apr 2020 12:06:22 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id DE43E2AE6AD; Thu, 30 Apr 2020 12:06:22 +0200 (CEST) Received: from localhost (10.75.127.45) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 30 Apr 2020 12:06:22 +0200 From: Patrice Chotard To: CC: Patrice CHOTARD , Patrick DELAUNAY , U-Boot STM32 , Jean-Jacques Hiblot , Simon Glass Subject: [PATCH v4 1/5] cmd: bind: allow to bind driver with driver data Date: Thu, 30 Apr 2020 12:06:15 +0200 Message-ID: <20200430100619.28557-2-patrice.chotard@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200430100619.28557-1-patrice.chotard@st.com> References: <20200430100619.28557-1-patrice.chotard@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.45] X-ClientProxiedBy: SFHDAG5NODE3.st.com (10.75.127.15) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-30_05:2020-04-30, 2020-04-30 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Initial implementation invokes device_bind_with_driver_data() with driver_data parameter equal to 0. For driver with driver data, the bind command can't bind correctly this driver or even worse causes data abort as shown below: As example, for debug purpose on STM32MP1 platform, ethernet (dwc_eth_qos.c) driver needed to be unbinded/binded. This driver is using driver data: static const struct udevice_id eqos_ids[] = { { .compatible = "nvidia,tegra186-eqos", .data = (ulong)&eqos_tegra186_config }, { .compatible = "snps,dwmac-4.20a", .data = (ulong)&eqos_stm32_config }, { } }; After unbinding/binding this driver and probing it (with the dhcp command), we got a prefetch abort as below: STM32MP> unbind eth ethernet@5800a000 STM32MP> bind /soc/ethernet@5800a000 eth_eqos STM32MP> dhcp prefetch abort pc : [<4310801c>] lr : [] reloc pc : [<035ba01c>] lr : [] sp : fdaf19b0 ip : ffcea83c fp : 00000001 r10: ffcfd4a0 r9 : fdaffed0 r8 : 00000000 r7 : ffcff304 r6 : fdc63220 r5 : 00000000 r4 : fdc5b108 r3 : 43108020 r2 : 00003d39 r1 : ffcea544 r0 : fdc63220 Flags: nZCv IRQs off FIQs off Mode SVC_32 Code: data abort pc : [] lr : [] reloc pc : [] lr : [] sp : fdaf18b8 ip : 00000000 fp : 00000001 r10: ffcd69b2 r9 : fdaffed0 r8 : ffcd69aa r7 : 00000000 r6 : 00000008 r5 : 4310801c r4 : fffffffc r3 : 00000001 r2 : 00000028 r1 : 00000000 r0 : 00000006 Flags: NzCv IRQs on FIQs on Mode SVC_32 (T) Code: 2f00 d1e9 2c00 dce9 (f855) 2024 Resetting CPU ... Signed-off-by: Patrice Chotard Cc: Jean-Jacques Hiblot Reviewed-by: Simon Glass --- Changes in v4: None Changes in v3: None Changes in v2: - add a bind command test - add bind command documentation in doc/driver/model/bind.rst - simplify patch 1 by using lists_bind_fdt() cmd/bind.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/bind.c b/cmd/bind.c index 44a5f17f0d..0aefc531d8 100644 --- a/cmd/bind.c +++ b/cmd/bind.c @@ -7,6 +7,7 @@ #include #include #include +#include #include static int bind_by_class_index(const char *uclass, int index, @@ -150,8 +151,8 @@ static int bind_by_node_path(const char *path, const char *drv_name) } ofnode = ofnode_path(path); - ret = device_bind_with_driver_data(parent, drv, ofnode_get_name(ofnode), - 0, ofnode, &dev); + ret = lists_bind_fdt(parent, ofnode, &dev, false); + if (!dev || ret) { printf("Unable to bind. err:%d\n", ret); return ret; From patchwork Thu Apr 30 10:06:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrice CHOTARD X-Patchwork-Id: 1280127 X-Patchwork-Delegate: trini@ti.com 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; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.a=rsa-sha256 header.s=STMicroelectronics header.b=otNf4nmF; 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 49CWJH72Kgz9sSh for ; Thu, 30 Apr 2020 20:06:55 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 33A3D81EEC; Thu, 30 Apr 2020 12:06:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.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=st.com header.i=@st.com header.b="otNf4nmF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 71B92821E7; Thu, 30 Apr 2020 12:06:38 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [62.209.51.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BFDCB821E1 for ; Thu, 30 Apr 2020 12:06:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=patrice.chotard@st.com Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03UA4ZgH006367; Thu, 30 Apr 2020 12:06:24 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=NrxMvoqU2SVUYFxDsjjzgQvd1eAVQoxgIRCh8kV5zWc=; b=otNf4nmFEn5ZtPPwvlOGA+wunznY8cXR1AaOyI80xwh0cVH2MI+1PoT2N+8PIfmzbSE0 omZBgcu1cD4eHwNKvP/fqgs2YDN7Ze+y6yeGfKXtIwe6X5GSyNzkU+SiLwyPpNqLa+NP 76zbvgJCEJqYVXk4hIc2/QAd5kcujpFWlZU7Vml0m9Vo+YjcmuCvFhHDr7zNu72P9SGw LWvnBnGLXclVY8T08rR/GaBXB87vXr5QJbtzCFGTUyGUcrhUtUfpH1TVjIwE5RxQhMna 1bRKbZI6FJL47AlaAaLv1Tw3wEzr1FomP6VK5ZqcN7wc6MdK43Oy3OsMkPkILVq7OGQy fQ== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 30qst09412-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 Apr 2020 12:06:24 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id D4468100039; Thu, 30 Apr 2020 12:06:23 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id CB8C22B3BD4; Thu, 30 Apr 2020 12:06:23 +0200 (CEST) Received: from localhost (10.75.127.45) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 30 Apr 2020 12:06:23 +0200 From: Patrice Chotard To: CC: Patrice CHOTARD , Patrick DELAUNAY , U-Boot STM32 , Joe Hershberger , Simon Glass Subject: [PATCH v4 2/5] sandbox: phy: add driver_data for bind test cmd Date: Thu, 30 Apr 2020 12:06:16 +0200 Message-ID: <20200430100619.28557-3-patrice.chotard@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200430100619.28557-1-patrice.chotard@st.com> References: <20200430100619.28557-1-patrice.chotard@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.45] X-ClientProxiedBy: SFHDAG3NODE1.st.com (10.75.127.7) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-30_06:2020-04-30, 2020-04-30 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Add driver data to existing compatible string "sandbox,phy". Add an additional compatible string without driver_data This will verify that bind command parses, finds and passes the correct driver data to device_bind_with_driver_data() by using driver_data in the second sandbox_phy_ids table entry. In sandbox_phy_bind() a check is added to validate driver_data content. Signed-off-by: Patrice Chotard Reviewed-by: Simon Glass --- Changes in v4: None Changes in v3: None Changes in v2: None drivers/phy/sandbox-phy.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/phy/sandbox-phy.c b/drivers/phy/sandbox-phy.c index 84ff5c6275..5f36da7692 100644 --- a/drivers/phy/sandbox-phy.c +++ b/drivers/phy/sandbox-phy.c @@ -8,6 +8,8 @@ #include #include +#define DRIVER_DATA 0x12345678 + struct sandbox_phy_priv { bool initialized; bool on; @@ -71,6 +73,14 @@ static int sandbox_phy_exit(struct phy *phy) return 0; } +static int sandbox_phy_bind(struct udevice *dev) +{ + if (dev_get_driver_data(dev) != DRIVER_DATA) + return -ENODATA; + + return 0; +} + static int sandbox_phy_probe(struct udevice *dev) { struct sandbox_phy_priv *priv = dev_get_priv(dev); @@ -90,13 +100,19 @@ static struct phy_ops sandbox_phy_ops = { }; static const struct udevice_id sandbox_phy_ids[] = { - { .compatible = "sandbox,phy" }, + { .compatible = "sandbox,phy_no_driver_data", + }, + + { .compatible = "sandbox,phy", + .data = DRIVER_DATA + }, { } }; U_BOOT_DRIVER(phy_sandbox) = { .name = "phy_sandbox", .id = UCLASS_PHY, + .bind = sandbox_phy_bind, .of_match = sandbox_phy_ids, .ops = &sandbox_phy_ops, .probe = sandbox_phy_probe, From patchwork Thu Apr 30 10:06:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrice CHOTARD X-Patchwork-Id: 1280128 X-Patchwork-Delegate: trini@ti.com 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; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.a=rsa-sha256 header.s=STMicroelectronics header.b=Ue35X/Vo; 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 49CWJb5Gmmz9sSd for ; Thu, 30 Apr 2020 20:07:11 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E02BB821DF; Thu, 30 Apr 2020 12:06:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.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=st.com header.i=@st.com header.b="Ue35X/Vo"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7340C821E6; Thu, 30 Apr 2020 12:06:38 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [62.209.51.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 233D1821E3 for ; Thu, 30 Apr 2020 12:06:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=patrice.chotard@st.com Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03UA4N5J011614; Thu, 30 Apr 2020 12:06:25 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=UCA3tLt1HlHGubDOQH9gh/ZD9AhF4aCIdkrE3adZZaY=; b=Ue35X/VozLbXcV05LBAWdMjbxYqqXFZqGRc1GbTWrJvXC5vaCEb3WmxkFZHN4HbsGxPI blppFqAa+1N/jcVLQKyECavH97SD6tY6kGnCdoYskSRdmSZ2UtjRX39JmZfDk31XM615 WiKF4hBsNQ6rxNUy/wZUXNyBUcGFUc9p2JFJROH3YbvHu6Ivyt/7vmAhBT9E91Z1GStH 3K8SbJqt02gL5Z4HMX5nj8odb7O80TdD9KqXuhlSKHXUZ9XJ8KeL58IcT3CTxWqwhdws jK3BP5/D1WZf8pQ7EWrBcrCOByjFBMOxBkET13+OQfxoQvj91ZGJnUV7KwUeo2bZXxXy bg== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 30n4j67r4w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 Apr 2020 12:06:25 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id C297010002A; Thu, 30 Apr 2020 12:06:24 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id B4C392B3BD4; Thu, 30 Apr 2020 12:06:24 +0200 (CEST) Received: from localhost (10.75.127.46) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 30 Apr 2020 12:06:24 +0200 From: Patrice Chotard To: CC: Patrice CHOTARD , Patrick DELAUNAY , U-Boot STM32 , AKASHI Takahiro , Alex Marginean , Bin Meng , Jean-Jacques Hiblot , Lukasz Majewski , Simon Glass Subject: [PATCH v4 3/5] sandbox: dts: Add compatible string for bind-test node Date: Thu, 30 Apr 2020 12:06:17 +0200 Message-ID: <20200430100619.28557-4-patrice.chotard@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200430100619.28557-1-patrice.chotard@st.com> References: <20200430100619.28557-1-patrice.chotard@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG2NODE2.st.com (10.75.127.5) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-30_06:2020-04-30, 2020-04-30 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Usage of lists_bind_fdt() in bind command imposes to add a compatible string for bind-test node. The other impact, is that bind-test node is binded at sandbox start, so no need to bind it in test_bind_unbind_with_node() test Signed-off-by: Patrice Chotard Reviewed-by: Simon Glass --- Changes in v4: None Changes in v3: None Changes in v2: None arch/sandbox/dts/test.dts | 1 + test/py/tests/test_bind.py | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index df9f1835c9..7c6b14887f 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -131,6 +131,7 @@ }; bind-test { + compatible = "simple-bus"; bind-test-child1 { compatible = "sandbox,phy"; #phy-cells = <1>; diff --git a/test/py/tests/test_bind.py b/test/py/tests/test_bind.py index 20c6050342..0b7cd9a808 100644 --- a/test/py/tests/test_bind.py +++ b/test/py/tests/test_bind.py @@ -25,9 +25,6 @@ def in_tree(response, name, uclass, drv, depth, last_child): @pytest.mark.buildconfigspec('cmd_bind') def test_bind_unbind_with_node(u_boot_console): - #bind /bind-test. Device should come up as well as its children - response = u_boot_console.run_command('bind /bind-test generic_simple_bus') - assert response == '' tree = u_boot_console.run_command('dm tree') assert in_tree(tree, 'bind-test', 'simple_bus', 'generic_simple_bus', 0, True) assert in_tree(tree, 'bind-test-child1', 'phy', 'phy_sandbox', 1, False) From patchwork Thu Apr 30 10:06:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrice CHOTARD X-Patchwork-Id: 1280132 X-Patchwork-Delegate: trini@ti.com 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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.a=rsa-sha256 header.s=STMicroelectronics header.b=VdaKVok+; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 49CWKj27Lpz9sSg for ; Thu, 30 Apr 2020 20:08:09 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 50024821F2; Thu, 30 Apr 2020 12:07:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.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=st.com header.i=@st.com header.b="VdaKVok+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CFC45821ED; Thu, 30 Apr 2020 12:06:48 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1DF9B821E2 for ; Thu, 30 Apr 2020 12:06:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=patrice.chotard@st.com Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03UA2qid009703; Thu, 30 Apr 2020 12:06:26 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=oZqASVOvPefU9dA4pN5FdvSRvGg+GHM5IGh0wyI0yBk=; b=VdaKVok+oSRRTyKnmiDqAg9dqT385uSl99jEKQ8Bvfwnc3c4Yde9A8rTXAugqFXQqyWm mlH7xY/LO4hOZpS/JDwoYXJCK9uRav4m7Qvs0yfCafibBkyzFJA5TziVxCVDk+odJxKG QgkFgygNF0qNCBZeor4bjfVT9eHfepJk/UhHwGsyH44abZacp9HmCOSzRHp8ymS4R2wQ wE6/fXiCHUKeQ2eOmGx288sOYMAOCsUnqreXWVTmEYsCk/5Uu8tVEzoGgSpFSUQzdKRq +ftT2zG+UdPrCz+JH5SRzwbbNqQJh/+7m758GIQQoXlMrCym8RXsAOPsg32oPM+mCuyO RQ== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 30mhjx3jg1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 Apr 2020 12:06:26 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id B0D5510002A; Thu, 30 Apr 2020 12:06:25 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id A81FB2B3BD4; Thu, 30 Apr 2020 12:06:25 +0200 (CEST) Received: from localhost (10.75.127.45) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 30 Apr 2020 12:06:25 +0200 From: Patrice Chotard To: CC: Patrice CHOTARD , Patrick DELAUNAY , U-Boot STM32 , Simon Glass Subject: [PATCH v4 4/5] test/py: Update test_bind Date: Thu, 30 Apr 2020 12:06:18 +0200 Message-ID: <20200430100619.28557-5-patrice.chotard@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200430100619.28557-1-patrice.chotard@st.com> References: <20200430100619.28557-1-patrice.chotard@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.45] X-ClientProxiedBy: SFHDAG5NODE1.st.com (10.75.127.13) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-30_06:2020-04-30, 2020-04-30 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean As bind-test is now binded at sandbox startup and no more by test_bind.py, bind-test nodes are not located at the end of "dm tree" output, but can be located everywhere in the tree, so bind-test output could either be: simple_bus 0 [ ] generic_simple_bus |-- bind-test phy 0 [ ] phy_sandbox | |-- bind-test-child1 simple_bus 1 [ ] generic_simple_bus | `-- bind-test-child2 or: simple_bus 5 [ ] generic_simple_bus `-- bind-test phy 2 [ ] phy_sandbox |-- bind-test-child1 simple_bus 6 [ ] generic_simple_bus `-- bind-test-child2 in_tree() function need to be updated to take care of that change. Signed-off-by: Patrice Chotard Reviewed-by: Simon Glass --- Changes in v4: None Changes in v3: - fix typo Changes in v2: None test/py/tests/test_bind.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/py/tests/test_bind.py b/test/py/tests/test_bind.py index 0b7cd9a808..4753c7ea7b 100644 --- a/test/py/tests/test_bind.py +++ b/test/py/tests/test_bind.py @@ -7,13 +7,16 @@ import re def in_tree(response, name, uclass, drv, depth, last_child): lines = [x.strip() for x in response.splitlines()] - leaf = ' ' * 4 * depth; - if not last_child: - leaf = leaf + r'\|' - else: - leaf = leaf + '`' + leaf = '' + if depth != 0: + leaf = ' ' + ' ' * (depth - 1) ; + if not last_child: + leaf = leaf + r'\|' + else: + leaf = leaf + '`' + leaf = leaf + '-- ' + name - line = (r' *{:10.10} [0-9]* \[ [ +] \] {:20.20} {}$' + line = (r' *{:10.10} [0-9]* \[ [ +] \] {:20.20} [` |]{}$' .format(uclass, drv, leaf)) prog = re.compile(line) for l in lines: From patchwork Thu Apr 30 10:06:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrice CHOTARD X-Patchwork-Id: 1280130 X-Patchwork-Delegate: trini@ti.com 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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.a=rsa-sha256 header.s=STMicroelectronics header.b=g+aq0JMa; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 49CWK93614z9sSd for ; Thu, 30 Apr 2020 20:07:40 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 860DA821F7; Thu, 30 Apr 2020 12:06:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.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=st.com header.i=@st.com header.b="g+aq0JMa"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 16121821EA; Thu, 30 Apr 2020 12:06:44 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3A0D8821E5 for ; Thu, 30 Apr 2020 12:06:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=patrice.chotard@st.com Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03UA2qif009703; Thu, 30 Apr 2020 12:06:27 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=UOCA/D3LocyjbZVs+sSElFmzus3T6W0F1a6fVRGydEg=; b=g+aq0JMaBli4H9djzAyH6ZU1Dkof+r7ruLaSeecz2FNQ5aJ29wlDURxh6ACTl6O3jJ75 Vj4WxBt4dD+j0KwWGwsDBZQYa/5LtqLrRI2Djf5+1Dzx5lCtyI/9/KzbV0PlMrcAg79W j4upC/F56j5z9a7Qa6V49n+7EIAH+1f36BaPmMufZMcJt1/s2CIqIHbRMA2yrvQH+wrn kaaWgDfmJoJTSTJ6kIYkarhTG4DYzmQGV0WbqBlQ/o+avo9kX7UNtvRVy837KKGrvc3s +GR1T4/iU0+S/1+1ODkAiCRbRDs3Dq/k7gEhMeYkD5C8TAp72YeY8UsYrQ4QxM/63mG5 rg== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 30mhjx3jg6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 Apr 2020 12:06:27 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id B27AC10002A; Thu, 30 Apr 2020 12:06:26 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id A7C602B3BD4; Thu, 30 Apr 2020 12:06:26 +0200 (CEST) Received: from localhost (10.75.127.47) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 30 Apr 2020 12:06:26 +0200 From: Patrice Chotard To: CC: Patrice CHOTARD , Patrick DELAUNAY , U-Boot STM32 , Andre Przywara , Bin Meng , Heinrich Schuchardt , Joe Hershberger , Simon Glass Subject: [PATCH v4 5/5] doc: add bind/unbind command documentation Date: Thu, 30 Apr 2020 12:06:19 +0200 Message-ID: <20200430100619.28557-6-patrice.chotard@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200430100619.28557-1-patrice.chotard@st.com> References: <20200430100619.28557-1-patrice.chotard@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.47] X-ClientProxiedBy: SFHDAG7NODE3.st.com (10.75.127.21) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-30_06:2020-04-30, 2020-04-30 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Add documentation in doc/drivel-model for the bind/unbind command. Part of this documentation is extracted from original patch commit message: commit 49c752c93a78 ("cmd: Add bind/unbind commands to bind a device to a driver from the command line") Signed-off-by: Patrice Chotard Reviewed-by: Simon Glass --- Changes in v4: - fix make htmldocs error "Title underline too short" Changes in v3: - fix typo - add bind/unbind parameters description and how to find them Changes in v2: None doc/driver-model/bind.rst | 49 ++++++++++++++++++++++++++++++++++++++ doc/driver-model/index.rst | 1 + 2 files changed, 50 insertions(+) create mode 100644 doc/driver-model/bind.rst diff --git a/doc/driver-model/bind.rst b/doc/driver-model/bind.rst new file mode 100644 index 0000000000..e3e9cb4d3c --- /dev/null +++ b/doc/driver-model/bind.rst @@ -0,0 +1,49 @@ +.. SPDX-License-Identifier: GPL-2.0+ +.. sectionauthor:: Patrice Chotard + +Binding/unbinding a driver +========================== + +This document aims to describe the bind and unbind commands. + +For debugging purpose, it should be useful to bind or unbind a driver from +the U-boot command line. + +The unbind command calls the remove device driver callback and unbind the +device from its driver. + +The bind command binds a device to its driver. + +In some cases it can be useful to be able to bind a device to a driver from +the command line. +The obvious example is for versatile devices such as USB gadget. +Another use case is when the devices are not yet ready at startup and +require some setup before the drivers are bound (ex: FPGA which bitsream is +fetched from a mass storage or ethernet) + +usage: + +bind +bind + +unbind +unbind +unbind + +Where: + - is the node's device tree path + - is one of the class available in the list given by the "dm uclass" + command or first column of "dm tree" command. + - is the index of the parent's node (second column of "dm tree" output). + - is the driver name to bind given by the "dm drivers" command or the by + the fourth column of "dm tree" output. + +example: + +bind usb_dev_generic 0 usb_ether +unbind usb_dev_generic 0 usb_ether +or +unbind eth 1 + +bind /ocp/omap_dwc3@48380000/usb@48390000 usb_ether +unbind /ocp/omap_dwc3@48380000/usb@48390000 diff --git a/doc/driver-model/index.rst b/doc/driver-model/index.rst index b9df221627..37ef3721df 100644 --- a/doc/driver-model/index.rst +++ b/doc/driver-model/index.rst @@ -6,6 +6,7 @@ Driver Model .. toctree:: :maxdepth: 2 + bind debugging design ethernet