From patchwork Mon Feb 8 23:37:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Opaniuk X-Patchwork-Id: 1438022 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; dkim=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.a=rsa-sha256 header.s=google header.b=kcn0Zwah; 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 4DZMsj2dZJz9s1l for ; Tue, 9 Feb 2021 10:38:33 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 50B828299B; Tue, 9 Feb 2021 00:38:25 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io 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=foundries.io header.i=@foundries.io header.b="kcn0Zwah"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4A3C882940; Tue, 9 Feb 2021 00:38:15 +0100 (CET) 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,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 35E8A82940 for ; Tue, 9 Feb 2021 00:38:08 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=igor.opaniuk@foundries.io Received: by mail-lj1-x22d.google.com with SMTP id u4so19916961ljh.6 for ; Mon, 08 Feb 2021 15:38:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundries.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=G/F7c+vYyPYPMaZUXkkso0j8iT+6iswVVyD0VtUIOZs=; b=kcn0ZwahGISut9pORbzTtds425afAJZkSUHLJz8+JOZB+yvE/md4vapx3Oqshhk9RT jlewOwGce/fUu+IU4dmMQupENCW9PJ1XUs4osyQUonfJ7qhjLHJ0AEuTYQrvtLjCoMTU fM/WTp3PZVkQwgKl6Qf8ZHbXbmqr/ZOxJM51cxrQhx8F7+XaFFKV11aAZbYuxIYtn5s+ T8tjcVoLymib75AqHTjqwHEsdj4Mhem/mY+YydR6zvNCJ4typs3E6jI1FbRhPEP9y7mR 7au/rIDss8vPxfSmNj67/qoS6TY94ofulL9lyQ68XryVe1Rs1k/0tcIFcJVvDEx1cLfV MkjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=G/F7c+vYyPYPMaZUXkkso0j8iT+6iswVVyD0VtUIOZs=; b=LtxGTAGo2gm8m06zmEruWS5AeVo1npHhZ4iq9yCBZkx3Om6yp7b4SIYtSdkoZajnW/ 0VPI62cCZRUeVMxXGzskUNGb9LMRxfpJwCWXstvM8TeUWWqLNjm3wAJlJTbP7NQ0E6GI 0EfVnFketoWKxnlLWmKrhK+zWLXR/w2spH2nEcHSVAw3VZDjGYztrPy2Tbgcm/lLdqMj OL/1nb9JCkcCke+eOPHG61DLG1ETA5Zh8I1k1SHnDnb7UwYYAWSEIZF0x6ACqOuX5Kw1 rVnXBrouIybUzqZT0ER/7SRAx6lmaa5WacP1KMPHQdkKTM3lJKpWsiXZYNVaMNz2XMxh x5WA== X-Gm-Message-State: AOAM530ZJ5Ccl9AJJ8nW7nrvhaRPzBUehce30ehCHewaHt/ajYz8nLHo /mxviFTqd62kCvM06EpqW8MEjzCqULiD4Cm5 X-Google-Smtp-Source: ABdhPJxYVgqfQGvrJsSjt6doO9VJHd49tmRarCYAuYYvXvhTJIHGaSIKeYBgCWfPToOGOBmMd7ajQA== X-Received: by 2002:a05:651c:555:: with SMTP id q21mr12794148ljp.471.1612827487269; Mon, 08 Feb 2021 15:38:07 -0800 (PST) Received: from localhost ([109.108.76.111]) by smtp.gmail.com with ESMTPSA id k20sm2212895ljb.73.2021.02.08.15.38.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Feb 2021 15:38:06 -0800 (PST) From: Igor Opaniuk X-Google-Original-From: Igor Opaniuk To: u-boot@lists.denx.de Cc: sjg@chromium.org, ricardo@foundries.io, mike@foundries.io, trini@konsulko.com, jorge@foundries.io, Igor Opaniuk , Heiko Schocher , Jagan Teki , Pragnesh Patel , Tero Kristo Subject: [PATCH v2 1/3] dm: i2c: allow disabling driver model in SPL Date: Tue, 9 Feb 2021 01:37:53 +0200 Message-Id: <20210208233755.89219-2-igor.opaniuk@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210208233755.89219-1-igor.opaniuk@gmail.com> References: <20210208233755.89219-1-igor.opaniuk@gmail.com> MIME-Version: 1.0 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: Igor Opaniuk At present if U-Boot proper uses driver model for I2C, then SPL has to also. While this is desirable, it places a significant barrier to moving to driver model in some cases. For example, with a space-constrained SPL it may be necessary to enable CONFIG_SPL_OF_PLATDATA which involves adjusting some drivers. This patch introduces a separate Kconfig symbols for enabling DM_I2C and DM_I2C_GPIO support in SPL. This will also help to get away from dirty workarounds to achieve non-DM I2C support for SPL, which is currently used in some board header files like: ifdef CONFIG_SPL_BUILD undef CONFIG_DM_I2C endif Reviewed-by: Simon Glass Reviewed-by: Heiko Schocher Signed-off-by: Igor Opaniuk --- Changes v2: - R-b tags applied drivers/i2c/Kconfig | 21 +++++++++++++++++++++ drivers/i2c/Makefile | 4 ++-- drivers/misc/Makefile | 2 +- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig index 403602fddf..5fce14122d 100644 --- a/drivers/i2c/Kconfig +++ b/drivers/i2c/Kconfig @@ -14,6 +14,17 @@ config DM_I2C device (bus child) info is kept as parent plat. The interface is defined in include/i2c.h. +config SPL_DM_I2C + bool "Enable Driver Model for I2C drivers in SPL" + depends on SPL_DM && DM_I2C + default y + help + Enable driver model for I2C. The I2C uclass interface: probe, read, + write and speed, is implemented with the bus drivers operations, + which provide methods for bus setting and data transfer. Each chip + device (bus child) info is kept as parent platdata. The interface + is defined in include/i2c.h. + config I2C_CROS_EC_TUNNEL tristate "Chrome OS EC tunnel I2C bus" depends on CROS_EC @@ -61,6 +72,16 @@ config DM_I2C_GPIO bindings are supported. Binding info: doc/device-tree-bindings/i2c/i2c-gpio.txt +config SPL_DM_I2C_GPIO + bool "Enable Driver Model for software emulated I2C bus driver in SPL" + depends on SPL_DM && DM_I2C_GPIO && SPL_DM_GPIO && SPL_GPIO_SUPPORT + default y + help + Enable the i2c bus driver emulation by using the GPIOs. The bus GPIO + configuration is given by the device tree. Kernel-style device tree + bindings are supported. + Binding info: doc/device-tree-bindings/i2c/i2c-gpio.txt + config SYS_I2C_AT91 bool "Atmel I2C driver" depends on DM_I2C && ARCH_AT91 diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile index 29aab0f9e3..acd27ac29d 100644 --- a/drivers/i2c/Makefile +++ b/drivers/i2c/Makefile @@ -2,9 +2,9 @@ # # (C) Copyright 2000-2007 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. -obj-$(CONFIG_DM_I2C) += i2c-uclass.o +obj-$(CONFIG_$(SPL_)DM_I2C) += i2c-uclass.o ifdef CONFIG_ACPIGEN -obj-$(CONFIG_DM_I2C) += acpi_i2c.o +obj-$(CONFIG_$(SPL_)DM_I2C) += acpi_i2c.o endif obj-$(CONFIG_$(SPL_)DM_I2C_GPIO) += i2c-gpio.o obj-$(CONFIG_$(SPL_)I2C_CROS_EC_TUNNEL) += cros_ec_tunnel.o diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index d737203704..1a49396007 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -17,7 +17,7 @@ obj-$(CONFIG_SANDBOX) += p2sb_sandbox.o p2sb_emul.o obj-$(CONFIG_SANDBOX) += swap_case.o endif -ifdef CONFIG_DM_I2C +ifdef CONFIG_$(SPL_)DM_I2C ifndef CONFIG_SPL_BUILD obj-$(CONFIG_SANDBOX) += i2c_eeprom_emul.o endif