From patchwork Fri Feb 5 15:10:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Opaniuk X-Patchwork-Id: 1436714 X-Patchwork-Delegate: hs@denx.de 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; dkim=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.a=rsa-sha256 header.s=google header.b=W50WsibH; 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 4DXJm90Gwyz9sWW for ; Sat, 6 Feb 2021 02:11:24 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B305782483; Fri, 5 Feb 2021 16:11:16 +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="W50WsibH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1636E825EC; Fri, 5 Feb 2021 16:11: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-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) (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 6F939801D8 for ; Fri, 5 Feb 2021 16:11:07 +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-lf1-x135.google.com with SMTP id q12so10277338lfo.12 for ; Fri, 05 Feb 2021 07:11:07 -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=tCBLFf/qeZ8/zwpvcRHKondSxkEQFdxNYU5GUrKnzfI=; b=W50WsibHC6mjF2fzC1UMYYRLzvEuQeBUxZTLepaUIQlCfKF+6pw9gKkHuUx6oA681X oNeGvFkGAWLymuI4ZlprVQfOB/M3Ad13uCDbXezbvpWTvYzwKIiL0I2N0XdD1OpE5BdC LjNG+t5gwBy3JiyLzD+1HruHjh/ge/mOvU+PsZ9x2X+PllUGwlrkmFsqlRgWYu3lITf6 feDsmEoOPbZFONtEgxINhZ4tFE81z//+mWBtKmGuUz1Oc7XfUolY/jtRQs9muUbdjY7F +uiQClV3gWCt2068tVg7Mi4L8l55jp4swOREn3f2ysJ7izTxS54iczyfQgASLYl1q/Vb yuSg== 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=tCBLFf/qeZ8/zwpvcRHKondSxkEQFdxNYU5GUrKnzfI=; b=dVtZj4qJMNShNpiiL6qpu8UAvDIC2xCUibNT+DcOofy2E9L+vocm7sYTC6ecEIeA6E ixBGYrAddy6GSIo15ql81QbX20vusIXyDr+hNZdcYwDKSJoCKduMLmOo7UecYyAO0fc/ XO+MRio/IZjQcbk9cTLWim/Kwqckfiwd5X26S/PukIfTg+2C1GqlHmUsYkat1wEdQ8xK uFalgjKsLYUH5U41CteGUJegy4shVjX41AEn2t6x7Zps70Mt0gRtb0ODWmARUocLWZnX G73u9AZ8xLcHYyvb+wcw0Wit/gKaqeuxKENtEmFpwejTAz8i+930+qAcobzs3MrKDX+p R3Mg== X-Gm-Message-State: AOAM532AKAl8qHK90rgUlsRMaVhwaQGGNPQf1wNlvJbf9AcUfQQ8SNnF 2XZ7iIYRwAUwthIsSGq9m7rjr/Z1Q//XodUz X-Google-Smtp-Source: ABdhPJwhI1DB1GdGy314/pE0WQIu38VwpsstHzgSr8+AqBoRCCEb2evPx7GYGmCK534aqm1f1eRrmA== X-Received: by 2002:ac2:5227:: with SMTP id i7mr2706989lfl.365.1612537866134; Fri, 05 Feb 2021 07:11:06 -0800 (PST) Received: from localhost ([109.108.76.111]) by smtp.gmail.com with ESMTPSA id f6sm1055289lje.127.2021.02.05.07.11.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 07:11:05 -0800 (PST) From: Igor Opaniuk X-Google-Original-From: Igor Opaniuk To: u-boot@lists.denx.de Cc: trini@konsulko.com, jorge@foundries.io, mike@foundries.io, ricardo@foundries.io, sjg@chromium.org, Igor Opaniuk , Bin Meng , Heiko Schocher , Jagan Teki , Pragnesh Patel , Tero Kristo Subject: [RFC PATCH v1 1/2] dm: i2c: allow disabling driver model in SPL Date: Fri, 5 Feb 2021 17:10:57 +0200 Message-Id: <20210205151058.1037793-2-igor.opaniuk@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210205151058.1037793-1-igor.opaniuk@gmail.com> References: <20210205151058.1037793-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 Signed-off-by: Igor Opaniuk Reviewed-by: Simon Glass Reviewed-by: Heiko Schocher --- 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