From patchwork Fri Oct 16 10:46:31 2020
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pratyush Yadav
X-Patchwork-Id: 1383228
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=quarantine dis=none) header.from=ti.com
Authentication-Results: ozlabs.org;
dkim=pass (1024-bit key;
unprotected) header.d=ti.com header.i=@ti.com header.a=rsa-sha256
header.s=ti-com-17Q1 header.b=YhM50Zwn;
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) server-digest
SHA256)
(No client certificate requested)
by ozlabs.org (Postfix) with ESMTPS id 4CCNC00tNCz9sTL
for ; Fri, 16 Oct 2020 21:47:24 +1100 (AEDT)
Received: from h2850616.stratoserver.net (localhost [IPv6:::1])
by phobos.denx.de (Postfix) with ESMTP id E795A823F3;
Fri, 16 Oct 2020 12:46:51 +0200 (CEST)
Authentication-Results: phobos.denx.de;
dmarc=pass (p=quarantine dis=none) header.from=ti.com
Authentication-Results: phobos.denx.de;
spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de
Authentication-Results: phobos.denx.de;
dkim=pass (1024-bit key;
unprotected) header.d=ti.com header.i=@ti.com header.b="YhM50Zwn";
dkim-atps=neutral
Received: by phobos.denx.de (Postfix, from userid 109)
id C49F9823B7; Fri, 16 Oct 2020 12:46:49 +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,DKIMWL_WL_HIGH,
DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_MSPIKE_H3,
RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham
autolearn_force=no version=3.4.2
Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142])
(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 DD254822D2
for ; Fri, 16 Oct 2020 12:46:45 +0200 (CEST)
Authentication-Results: phobos.denx.de;
dmarc=pass (p=quarantine dis=none) header.from=ti.com
Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=p.yadav@ti.com
Received: from lelv0266.itg.ti.com ([10.180.67.225])
by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 09GAkiHE078279;
Fri, 16 Oct 2020 05:46:44 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com;
s=ti-com-17Q1; t=1602845204;
bh=T6yatsXBBXm1RtzX+ibWMQfFYAXC0Nps/3iMZ/kfVqY=;
h=From:To:CC:Subject:Date:In-Reply-To:References;
b=YhM50Zwnqfn1ThNi33k5sJlU3Tol+MmhIOxZ41gdd5LtS9h2yDsVxFNqLWNiIx3Ta
6TaurjCVWjphLceuW6d4pApWOwpC6SYz/5boA4lVueEAxCwfi5C0N3suJmIWUrImep
9k+gvCSWhIpzEevCXZ9CKL3KcqI6EsZrAWxzC9rM=
Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41])
by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 09GAki6c115229
(version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL);
Fri, 16 Oct 2020 05:46:44 -0500
Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE109.ent.ti.com
(157.170.170.41) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Fri, 16
Oct 2020 05:46:43 -0500
Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE115.ent.ti.com
(157.170.170.26) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via
Frontend Transport; Fri, 16 Oct 2020 05:46:43 -0500
Received: from pratyush-OptiPlex-790.dhcp.ti.com (ileax41-snat.itg.ti.com
[10.172.224.153])
by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 09GAkbSe016923;
Fri, 16 Oct 2020 05:46:42 -0500
From: Pratyush Yadav
To: Tom Rini
CC: Pratyush Yadav , , Simon Glass
, Vignesh Raghavendra
Subject: [PATCH v4 2/7] dm: board: complete the initialization of the muxes in
initr_dm()
Date: Fri, 16 Oct 2020 16:16:31 +0530
Message-ID: <20201016104636.14138-3-p.yadav@ti.com>
X-Mailer: git-send-email 2.28.0
In-Reply-To: <20201016104636.14138-1-p.yadav@ti.com>
References: <20201016104636.14138-1-p.yadav@ti.com>
MIME-Version: 1.0
X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180
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.3 at phobos.denx.de
X-Virus-Status: Clean
From: Jean-Jacques Hiblot
This will probe the multiplexer devices that have a "u-boot,mux-autoprobe"
property. As a consequence they will be put in their idle state.
Signed-off-by: Jean-Jacques Hiblot
Reviewed-by: Simon Glass
Signed-off-by: Pratyush Yadav
---
Notes:
No changes in v4.
common/board_r.c | 12 ++++++++++++
drivers/mux/mux-uclass.c | 23 +++++++++++++++++++++++
include/mux.h | 12 ++++++++++++
3 files changed, 47 insertions(+)
diff --git a/common/board_r.c b/common/board_r.c
index 9b2fec701a..b9217b2e27 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -46,6 +46,7 @@
#include
#endif
#include
+#include
#include
#include
#include
@@ -341,6 +342,17 @@ static int initr_dm_devices(void)
return ret;
}
+ if (IS_ENABLED(CONFIG_MULTIPLEXER)) {
+ /*
+ * Initialize the multiplexer controls to their default state.
+ * This must be done early as other drivers may unknowingly
+ * rely on it.
+ */
+ ret = dm_mux_init();
+ if (ret)
+ return ret;
+ }
+
return 0;
}
diff --git a/drivers/mux/mux-uclass.c b/drivers/mux/mux-uclass.c
index 3c89e0a389..3dad466101 100644
--- a/drivers/mux/mux-uclass.c
+++ b/drivers/mux/mux-uclass.c
@@ -303,6 +303,29 @@ static int mux_uclass_post_probe(struct udevice *dev)
return 0;
}
+int dm_mux_init(void)
+{
+ struct uclass *uc;
+ struct udevice *dev;
+ int ret;
+
+ ret = uclass_get(UCLASS_MUX, &uc);
+ if (ret < 0) {
+ log_debug("unable to get MUX uclass\n");
+ return ret;
+ }
+ uclass_foreach_dev(dev, uc) {
+ if (dev_read_bool(dev, "u-boot,mux-autoprobe")) {
+ ret = device_probe(dev);
+ if (ret)
+ log_debug("unable to probe device %s\n",
+ dev->name);
+ }
+ }
+
+ return 0;
+}
+
UCLASS_DRIVER(mux) = {
.id = UCLASS_MUX,
.name = "mux",
diff --git a/include/mux.h b/include/mux.h
index 85eb7d42fc..23844f480a 100644
--- a/include/mux.h
+++ b/include/mux.h
@@ -109,6 +109,13 @@ void mux_control_put(struct mux_control *mux);
*/
struct mux_control *devm_mux_control_get(struct udevice *dev,
const char *mux_name);
+/**
+ * dm_mux_init() - Initialize the multiplexer controls to their default state.
+ *
+ * Return: 0 if OK, -errno otherwise.
+ */
+int dm_mux_init(void);
+
#else
unsigned int mux_control_states(struct mux_control *mux)
{
@@ -142,6 +149,11 @@ struct mux_control *devm_mux_control_get(struct udevice *dev,
{
return NULL;
}
+
+int dm_mux_init(void)
+{
+ return -ENOSYS;
+}
#endif
#endif