From patchwork Tue Nov 26 07:35:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Poddar, Sourav" X-Patchwork-Id: 3237161 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 9DD539F3AE for ; Tue, 26 Nov 2013 07:36:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A5B9F20386 for ; Tue, 26 Nov 2013 07:36:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 74AFC20383 for ; Tue, 26 Nov 2013 07:36:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754683Ab3KZHgV (ORCPT ); Tue, 26 Nov 2013 02:36:21 -0500 Received: from comal.ext.ti.com ([198.47.26.152]:46178 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752863Ab3KZHgU (ORCPT ); Tue, 26 Nov 2013 02:36:20 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id rAQ7ZtVV001031; Tue, 26 Nov 2013 01:35:55 -0600 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id rAQ7Ztgp016564; Tue, 26 Nov 2013 01:35:55 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.2.342.3; Tue, 26 Nov 2013 01:35:55 -0600 Received: from a0131647.apr.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id rAQ7ZLXv030173; Tue, 26 Nov 2013 01:35:52 -0600 From: Sourav Poddar To: , , , CC: , , , , Sourav Poddar Subject: [PATCH 08/17] spi/qspi: Add api for get_buf/put_buf. Date: Tue, 26 Nov 2013 13:05:04 +0530 Message-ID: <1385451313-1875-9-git-send-email-sourav.poddar@ti.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1385451313-1875-1-git-send-email-sourav.poddar@ti.com> References: <1385451313-1875-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=-6.9 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 Adapt qspi driver to use (get_buf/put_buf) pointers added earlier. These can be called just before the memcpy operations to get hold of the memory mapped address and to turn on the controller clocks. Signed-off-by: Sourav Poddar --- drivers/spi/spi-ti-qspi.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c index 2323572..10bcb37 100644 --- a/drivers/spi/spi-ti-qspi.c +++ b/drivers/spi/spi-ti-qspi.c @@ -247,6 +247,21 @@ static void ti_qspi_configure_from_slave(struct spi_device *spi, u8 *val) ti_qspi_write(qspi, memval, QSPI_SPI_SETUP0_REG); } +static void ti_qspi_get_mem_buf(struct spi_master *master) +{ + struct ti_qspi *qspi = spi_master_get_devdata(master); + + pm_runtime_get_sync(qspi->dev); + master->mem = qspi->mmap_base; +} + +static void ti_qspi_put_mem_buf(struct spi_master *master) +{ + struct ti_qspi *qspi = spi_master_get_devdata(master); + + pm_runtime_put(qspi->dev); +} + static void ti_qspi_restore_ctx(struct ti_qspi *qspi) { struct ti_qspi_regs *ctx_reg = &qspi->ctx_reg; @@ -515,6 +530,8 @@ static int ti_qspi_probe(struct platform_device *pdev) master->dev.of_node = pdev->dev.of_node; master->bits_per_word_mask = BIT(32 - 1) | BIT(16 - 1) | BIT(8 - 1); master->configure_from_slave = ti_qspi_configure_from_slave; + master->get_buf = ti_qspi_get_mem_buf; + master->put_buf = ti_qspi_put_mem_buf; if (!of_property_read_u32(np, "num-cs", &num_cs)) master->num_chipselect = num_cs;