From patchwork Fri Dec 6 14:24:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Poddar, Sourav" X-Patchwork-Id: 3298481 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B8F2A9F373 for ; Fri, 6 Dec 2013 14:25:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1C34C20520 for ; Fri, 6 Dec 2013 14:25:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CD43320522 for ; Fri, 6 Dec 2013 14:25:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759183Ab3LFOZl (ORCPT ); Fri, 6 Dec 2013 09:25:41 -0500 Received: from devils.ext.ti.com ([198.47.26.153]:60022 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751740Ab3LFOZf (ORCPT ); Fri, 6 Dec 2013 09:25:35 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id rB6EP4kU023399; Fri, 6 Dec 2013 08:25:04 -0600 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id rB6EP4EF029334; Fri, 6 Dec 2013 08:25:04 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.2.342.3; Fri, 6 Dec 2013 08:25:04 -0600 Received: from a0131647.apr.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id rB6EOqh7000982; Fri, 6 Dec 2013 08:25:01 -0600 From: Sourav Poddar To: , , , CC: , , , , , , Sourav Poddar Subject: [PATCHv2 01/10] spi/spi.h: Add get_buf/put_buf support in spi master. Date: Fri, 6 Dec 2013 19:54:42 +0530 Message-ID: <1386339891-32717-2-git-send-email-sourav.poddar@ti.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1386339891-32717-1-git-send-email-sourav.poddar@ti.com> References: <1386339891-32717-1-git-send-email-sourav.poddar@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add get_buf, put_buf api support in spi master. This can be used in a scenario where spi controller supports memory mapped operations(typically with flash devices). So, the memcpy needs top be done in slave devices which need the required memory mapped address. These api can be used to get that master address. These can also be used to turm the master controller clock, as usually the clocks get turned in spi core. But, in memory mapped case, we will bypass the spi core and hence needa way out to turn on the controller clock. Add configure from slave api, which can be used to configure the master controller with slave specific information. Add slave info struct, that can be filled with slave properties required by master controller for its register configuration. Signed-off-by: Sourav Poddar --- v1->v2: - Added a slave info structure. - Merge all other header related patches into this. include/linux/spi/spi.h | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 8c62ba7..c91d883 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -31,6 +31,14 @@ */ extern struct bus_type spi_bus_type; +/* For SPI flash */ +struct slave_info { + u8 read_opcode; + u8 program_opcode; + u8 addr_width; + u8 dummy_cycles; +}; + /** * struct spi_device - Master side proxy for an SPI slave device * @dev: Driver model representation of the device. @@ -73,6 +81,7 @@ extern struct bus_type spi_bus_type; struct spi_device { struct device dev; struct spi_master *master; + struct slave_info info; /* flash devices */ u32 max_speed_hz; u8 chip_select; u16 mode; @@ -291,6 +300,14 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) * number. Any individual value may be -ENOENT for CS lines that * are not GPIOs (driven by the SPI controller itself). * + * @get_buf: used for memory mapped cases, when the slave device wants to + * know the address to be used for memcopy. + * @put_buf: Used for memory mapped cases after get_buf, after the memcpy + * has finished. + * @configure_from_slave: Used when SPI controller has registers which need + * to be configured from slave specifics information(typical use case for + * SPI flash device). + * @mmap: Used to show that controller supports memory mapped operation. * Each SPI master controller can communicate with one or more @spi_device * children. These make a small bus, sharing MOSI, MISO and SCK signals * but not chip select signals. Each device may be configured to use a @@ -421,8 +438,13 @@ struct spi_master { int (*transfer_one)(struct spi_master *master, struct spi_device *spi, struct spi_transfer *transfer); + int __iomem *(*get_buf)(struct spi_master *master); + void (*put_buf)(struct spi_master *master); + void (*configure_from_slave)(struct spi_device *spi); + /* gpio chip select */ int *cs_gpios; + bool mmap; }; static inline void *spi_master_get_devdata(struct spi_master *master)