From patchwork Mon Oct 13 05:39:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 399044 X-Patchwork-Delegate: hs@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 33C1C140095 for ; Mon, 13 Oct 2014 16:41:27 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5F169A787C; Mon, 13 Oct 2014 07:41:01 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PWGyXJhp69Mx; Mon, 13 Oct 2014 07:41:01 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B0E8AA789D; Mon, 13 Oct 2014 07:40:38 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2AC4FA7858 for ; Mon, 13 Oct 2014 07:40:13 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GtYOFo-t1poL for ; Mon, 13 Oct 2014 07:40:13 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-vc0-f202.google.com (mail-vc0-f202.google.com [209.85.220.202]) by theia.denx.de (Postfix) with ESMTPS id 58FFDA7863 for ; Mon, 13 Oct 2014 07:40:06 +0200 (CEST) Received: by mail-vc0-f202.google.com with SMTP id hy10so608263vcb.1 for ; Sun, 12 Oct 2014 22:40:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0nvlji72+H3khUZZQJ4rk0l21MpoQAW0uTt1O68ECtA=; b=SDS7lmb7TEILVu0+UzZOH8x8c5h/B+WSds2WOV7KTfo//FnK0rVli6NJzhP6omdanu JRuoLLGe6u4rfPYE8gI72tIxoWEBuDCe6piQeWoMj8YMdwiPopgVQGXZH97llpAsEJaD iRIcfP24iMxqpOGlXHuJkWzJ2zj8rh15kpgjSqj+rpsigaxZKIfXhdKP7FTwJqahxlBl oNg6D/lfYBcYMQYytvN29N5lx+Xog+OmmXYDhSg8zcU44OvK+21BYjyEWXqnuPUmeFNh QkE5dbX3lLjBlVWqc9nST+CFYPGhdqFk/M/3dlz3AmZ7k/Wq+syUUPvkisibFrt93A8y +EOg== X-Gm-Message-State: ALoCoQlt7YAQGIY2tMY7vldkWEuT2efsrPUCySGKgIA+Pj5vPr8pJa8qcPpIKHroNCCstf7MK1rn X-Received: by 10.236.216.102 with SMTP id f96mr9561246yhp.10.1413178805397; Sun, 12 Oct 2014 22:40:05 -0700 (PDT) Received: from corpmail-nozzle1-2.hot.corp.google.com ([100.108.1.103]) by gmr-mx.google.com with ESMTPS id e24si677375yhe.3.2014.10.12.22.40.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Oct 2014 22:40:05 -0700 (PDT) Received: from kaki.bld.corp.google.com ([172.29.216.32]) by corpmail-nozzle1-2.hot.corp.google.com with ESMTP id eBTTBwH8.1; Sun, 12 Oct 2014 22:40:05 -0700 Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 9B36F22165D; Sun, 12 Oct 2014 23:40:04 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Sun, 12 Oct 2014 23:39:31 -0600 Message-Id: <1413178778-30846-6-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.1.0.rc2.206.gedb03e5 In-Reply-To: <1413178778-30846-1-git-send-email-sjg@chromium.org> References: <1413178778-30846-1-git-send-email-sjg@chromium.org> Cc: u-boot-review@google.com Subject: [U-Boot] [RFC PATCH 05/12] dm: i2c: Add I2C emulation driver for sandbox X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.13 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de In order to test I2C we need some sort of emulation interface. Add hooks to allow a driver to emulate an I2C device for sandbox. Signed-off-by: Simon Glass --- drivers/i2c/Makefile | 1 + drivers/i2c/i2c-emul-uclass.c | 14 ++++++++++++++ include/dm/uclass-id.h | 1 + 3 files changed, 16 insertions(+) create mode 100644 drivers/i2c/i2c-emul-uclass.c diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile index 2ee468d..10edea6 100644 --- a/drivers/i2c/Makefile +++ b/drivers/i2c/Makefile @@ -27,6 +27,7 @@ obj-$(CONFIG_SYS_I2C_OMAP34XX) += omap24xx_i2c.o obj-$(CONFIG_SYS_I2C_PPC4XX) += ppc4xx_i2c.o obj-$(CONFIG_SYS_I2C_RCAR) += rcar_i2c.o obj-$(CONFIG_SYS_I2C_S3C24X0) += s3c24x0_i2c.o +obj-$(CONFIG_SYS_I2C_SANDBOX) += i2c-emul-uclass.o obj-$(CONFIG_SYS_I2C_SH) += sh_i2c.o obj-$(CONFIG_SYS_I2C_SOFT) += soft_i2c.o obj-$(CONFIG_SYS_I2C_TEGRA) += tegra_i2c.o diff --git a/drivers/i2c/i2c-emul-uclass.c b/drivers/i2c/i2c-emul-uclass.c new file mode 100644 index 0000000..aa89f95 --- /dev/null +++ b/drivers/i2c/i2c-emul-uclass.c @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2014 Google, Inc + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include +#include + +UCLASS_DRIVER(i2c_emul) = { + .id = UCLASS_I2C_EMUL, + .name = "i2c_emul", +}; diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h index 9611a13..9e20d31 100644 --- a/include/dm/uclass-id.h +++ b/include/dm/uclass-id.h @@ -19,6 +19,7 @@ enum uclass_id { UCLASS_TEST_FDT, UCLASS_TEST_BUS, UCLASS_SPI_EMUL, /* sandbox SPI device emulator */ + UCLASS_I2C_EMUL, /* sandbox I2C device emulator */ UCLASS_SIMPLE_BUS, /* U-Boot uclasses start here */