From patchwork Fri Oct 16 10:46:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pratyush Yadav X-Patchwork-Id: 1383227 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=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=YdcxWnuz; 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) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CCNBd4jLXz9sTq for ; Fri, 16 Oct 2020 21:46:55 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5983E822FD; Fri, 16 Oct 2020 12:46:48 +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="YdcxWnuz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 250F082351; Fri, 16 Oct 2020 12:46: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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (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 E307E81B79 for ; Fri, 16 Oct 2020 12:46:42 +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 lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 09GAkeZj067515; Fri, 16 Oct 2020 05:46:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1602845200; bh=f1OsGdlupNFrV5Oz2QNEW9jCdvp+120TXmWm02BgIjA=; h=From:To:CC:Subject:Date; b=YdcxWnuzxx9QmgcwCjhog2FM3pjQp0JzaYWykyjsI+y44fTQCrfpgMFNv911zQhjJ Z8eHT+7AhzOdxwBoev92mkpM/j/M2eDWq6YFvF/1jUGdENysMscwOMO3BrfHvxtEro gbD+aHCJtBaFfB6HaA2g/CpDGmx4Y0TfpPHomSeI= Received: from DLEE103.ent.ti.com (dlee103.ent.ti.com [157.170.170.33]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 09GAkea1121607 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 16 Oct 2020 05:46:40 -0500 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE103.ent.ti.com (157.170.170.33) 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:39 -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:39 -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 09GAkbSc016923; Fri, 16 Oct 2020 05:46:38 -0500 From: Pratyush Yadav To: Tom Rini CC: Pratyush Yadav , , Simon Glass , Vignesh Raghavendra Subject: [PATCH v4 0/7] drivers: Add a framework for MUX drivers Date: Fri, 16 Oct 2020 16:16:29 +0530 Message-ID: <20201016104636.14138-1-p.yadav@ti.com> X-Mailer: git-send-email 2.28.0 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 Hi, This series is a re-roll of Jean-Jacques' earlier effort. It adds a new minimalistic subsystem that handles multiplexer controllers. It provides the same API as Linux and mux drivers should be portable with a minimum effort. This series also includes a port of the Linux's mmio-mux driver and an emulated mux driver for sandbox testing. Travis CI run: https://travis-ci.org/github/prati0100/uboot/builds/736133605 Changes in v4: - Drop the call to sandbox_set_enable_memio(). Use an emulated mux driver to test the default state instead. Other changes are mentioned in individual patches. Changes in v3: - Add a new command called 'mux' that allows listing, selecting, and deselecting muxes on the fly. - Move call to dm_mux_init() to initr_dm_devices(). - Enable mmio operations in sandbox on board_init() to dm_mux_init() can initialize muxes to their idle state and allow the tests to pass. - Add help for CONFIG_MULTIPLEXER. - Change dev_err() in mmio_mux_probe() to log_msg_ret() or log_err(). - Add comments on static functions in mux-class.c - Make mux_uclass_post_probe() static. - Make dm_mux_init() return an integer to signal failure. - Change ifdef of mux-internal.h to _HUX_INTERNAL_H. - Remove unused include from mux-internal.h - Remove comments for non-existent members in struct mux_chip. - Add missing comments for some members in struct mux_control. - Add missing comments for some functions in mux.h - Split up the mux_mmio test into two parts. More would lead to a lot of boilerplate. - Change ut_assertok(IS_ERR(ptr)) to ut_assertok_ptr(ptr). - Fix mis-spellings and capitalize comments. - Rebase on latest master. Changes in v2: - Fixed warning in mux_of_xlate_default() - Improved documentation - Fixed SPL build - insert the mux initialization in init_sequence_r[], just before the console is initialized as its serial port may be muxed - moved the definition of dm_mux_init() in this commit - Call sandbox_set_enable_memio(true) before running the test Jean-Jacques Hiblot (4): drivers: Add a new framework for multiplexer devices dm: board: complete the initialization of the muxes in initr_dm() drivers: mux: mmio-based syscon mux controller test: Add tests for the multiplexer framework Pratyush Yadav (3): Kconfig: Increase the pre-relocation memory cmd: Add a mux command test: mux-cmd: Add tests for the 'mux' command Kconfig | 2 +- arch/sandbox/dts/test.dts | 33 ++++ cmd/Kconfig | 6 + cmd/Makefile | 1 + cmd/mux.c | 183 +++++++++++++++++++ common/board_r.c | 12 ++ configs/sandbox_defconfig | 3 + drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/mux/Kconfig | 25 +++ drivers/mux/Makefile | 7 + drivers/mux/mmio.c | 141 ++++++++++++++ drivers/mux/mux-uclass.c | 334 ++++++++++++++++++++++++++++++++++ include/dm/uclass-id.h | 1 + include/dt-bindings/mux/mux.h | 17 ++ include/mux-internal.h | 109 +++++++++++ include/mux.h | 159 ++++++++++++++++ test/dm/Makefile | 3 + test/dm/mux-cmd.c | 177 ++++++++++++++++++ test/dm/mux-emul.c | 105 +++++++++++ test/dm/mux-mmio.c | 138 ++++++++++++++ 21 files changed, 1458 insertions(+), 1 deletion(-) create mode 100644 cmd/mux.c create mode 100644 drivers/mux/Kconfig create mode 100644 drivers/mux/Makefile create mode 100644 drivers/mux/mmio.c create mode 100644 drivers/mux/mux-uclass.c create mode 100644 include/dt-bindings/mux/mux.h create mode 100644 include/mux-internal.h create mode 100644 include/mux.h create mode 100644 test/dm/mux-cmd.c create mode 100644 test/dm/mux-emul.c create mode 100644 test/dm/mux-mmio.c --- 2.28.0