mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@xenotime.net>
To: Chris Metcalf <cmetcalf@tilera.com>
Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org,
	"Jean Delvare (PC drivers, core)" <khali@linux-fr.org>,
	"Ben Dooks (embedded platforms)" <ben-linux@fluff.org>
Subject: Re: [PATCH] drivers/i2c: add support for tile architecture "bus" for I2C devices
Date: Tue, 2 Nov 2010 10:19:12 -0700	[thread overview]
Message-ID: <20101102101912.3df5012c.rdunlap@xenotime.net> (raw)
In-Reply-To: <201011021712.oA2HCsMe028141@farm-0010.internal.tilera.com>

On Tue, 2 Nov 2010 13:05:34 -0400 Chris Metcalf wrote:

> This change enables the Linux driver to access i2c devices via
> the Tilera hypervisor's virtualized API.
> 
> Note that the arch/tile/include/hv/ headers are "upstream" headers
> that likely benefit less from LKML review.
> 
> Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
> ---
>  arch/tile/include/hv/drv_i2cm_intf.h |   68 +++++++
>  drivers/i2c/busses/Kconfig           |   10 +
>  drivers/i2c/busses/Makefile          |    1 +
>  drivers/i2c/busses/i2c-tile.c        |  324 ++++++++++++++++++++++++++++++++++
>  4 files changed, 403 insertions(+), 0 deletions(-)
>  create mode 100644 arch/tile/include/hv/drv_i2cm_intf.h
>  create mode 100644 drivers/i2c/busses/i2c-tile.c
> 
> diff --git a/arch/tile/include/hv/drv_i2cm_intf.h b/arch/tile/include/hv/drv_i2cm_intf.h
> new file mode 100644
> index 0000000..6584a72
> --- /dev/null
> +++ b/arch/tile/include/hv/drv_i2cm_intf.h
> @@ -0,0 +1,68 @@
> +/*
> + * Copyright 2010 Tilera Corporation. All Rights Reserved.
> + *
> + *   This program is free software; you can redistribute it and/or
> + *   modify it under the terms of the GNU General Public License
> + *   as published by the Free Software Foundation, version 2.
> + *
> + *   This program is distributed in the hope that it will be useful, but
> + *   WITHOUT ANY WARRANTY; without even the implied warranty of
> + *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
> + *   NON INFRINGEMENT.  See the GNU General Public License for
> + *   more details.
> + */
> +
> +/**

In kernel source code, "/**" is used to begin kernel-doc notation blocks.
Please don't use it for non-kernel-doc comments.

(multiple times...)

> + * @file drv_i2cm_intf.h
> + * Interface definitions for the I2CM driver.
> + *
> + * The I2C Master interface driver provides a manner for supervisors to
> + * access the I2C devices on the I2C bus.
> + *
> + * When the supervisor issues an I2C data transaction, it stores the i2c
> + * device slave address and the data offset within the device in the offset
> + * of the HV I2C device handle. The low half-word contains the slave address
> + * while the data offset is stored in byte 2 and 3. For the write access,
> + * the first 1 or 2 bytes of the write data contain the device data address
> + * if the data offset field of the HV device handle offset is 0; otherwise,
> + * the write data are puse data payload. For the read access, it is always
> + * preceded by a dummy write access which should contain an either 1-byte or
> + * 2-byte device data address while the read message holds no addressing
> + * information.
> + */
> +
> +#ifndef _SYS_HV_INCLUDE_DRV_I2CM_INTF_H
> +#define _SYS_HV_INCLUDE_DRV_I2CM_INTF_H
> +
> +/** Maximum size of an HV I2C transfer. */
> +#define HV_I2CM_CHUNK_SIZE 128
> +
> +/** Length of the i2c device name. */
> +#define I2C_DEV_NAME_SIZE   20
> +
> +/** I2C device descriptor, to be exported to the client OS. */
> +typedef struct
> +{
> +  char name[I2C_DEV_NAME_SIZE];   /**< Device name, e.g. "24c512". */
> +  uint32_t addr;                  /**< I2C device slave address */
> +}
> +tile_i2c_desc_t;

+ } tile_i2c_desc_t;
(i.e., join those 2 lines)

> +
> +/** Get the number of i2c devices. Read-only, takes a 4-byte value. */
> +#define I2C_GET_NUM_DEVS_OFF   0xF0000000
> +
> +/** Get i2c device info. Read-only, takes an array of tile_i2c_desc_t's. */
> +#define I2C_GET_DEV_INFO_OFF   0xF0000004
> +
> +/** This structure is used to encode the I2C device slave address
> + *  and the chip data offset and is passed to the HV in the offset
> + *  of the i2cm HV device file.
> + */
> +typedef struct
> +{
> +  uint32_t addr:8;               /**< I2C device slave address */
> +  uint32_t data_offset:24;       /**< I2C device data offset */
> +}
> +tile_i2c_addr_desc_t;

ditto.  (assuming that typedefs are even accepted)

> +
> +#endif /* _SYS_HV_INCLUDE_DRV_I2CM_INTF_H */



---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

  reply	other threads:[~2010-11-02 17:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-02 17:05 Chris Metcalf
2010-11-02 17:19 ` Randy Dunlap [this message]
2010-11-02 17:50   ` Chris Metcalf
2010-11-02 17:36 ` Ben Dooks
2010-11-02 21:04   ` Chris Metcalf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101102101912.3df5012c.rdunlap@xenotime.net \
    --to=rdunlap@xenotime.net \
    --cc=ben-linux@fluff.org \
    --cc=cmetcalf@tilera.com \
    --cc=khali@linux-fr.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®