From patchwork Sun Jan 6 22:44:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13846 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id E76C123E2D for ; Sun, 6 Jan 2013 22:44:22 +0000 (UTC) Received: from mail-vb0-f53.google.com (mail-vb0-f53.google.com [209.85.212.53]) by fiordland.canonical.com (Postfix) with ESMTP id 8DBE9A18950 for ; Sun, 6 Jan 2013 22:44:22 +0000 (UTC) Received: by mail-vb0-f53.google.com with SMTP id b23so18191891vbz.26 for ; Sun, 06 Jan 2013 14:44:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:from:to:cc:subject:date:message-id:x-mailer :mime-version:content-type:x-gm-message-state; bh=JhzB5qBC7o6SOMlD+JLiBcPWDjGoPZt/CQo5Hh3q7nM=; b=dlqVrIYsxWR868MRycNaf6/tkUvEmnoBFfD6dhcdnqt7fnBjMKbxCDdtblRSHKLI18 Z9frq21S+0kpTnDAACnjJAfB9Y2FIJTsgoUPWkh3Ang18dgFpOG+Eyjwkz1AMOaZ4km4 SZEIlvEbp8mdUq6klaeELy50UFTaPQlsaVxPJwwlaW+nsAOYsV3ILqIXTEdXn1swCTPg 1G0ET9kFrYt65fCrqCdTxF8esl42dUxF6zv+zwWts2t2cFDjVXF59Iw/vbvC/7w7tvI3 aYsNSJ8olPOvAshpAb0nZMZr9uBnCHeE9bvLpsnAes5pN7RHlWzdUoD79gvAHyvkLwPi J9/w== X-Received: by 10.220.157.9 with SMTP id z9mr81697385vcw.45.1357512262049; Sun, 06 Jan 2013 14:44:22 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.145.101 with SMTP id st5csp37324veb; Sun, 6 Jan 2013 14:44:21 -0800 (PST) X-Received: by 10.14.177.1 with SMTP id c1mr161471564eem.8.1357512260946; Sun, 06 Jan 2013 14:44:20 -0800 (PST) Received: from eu1sys200aog101.obsmtp.com (eu1sys200aog101.obsmtp.com [207.126.144.111]) by mx.google.com with SMTP id b7si51864184eep.19.2013.01.06.14.44.18 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 06 Jan 2013 14:44:20 -0800 (PST) Received-SPF: neutral (google.com: 207.126.144.111 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.111; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.111 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-us.st.com ([167.4.1.35]) (using TLSv1) by eu1sys200aob101.postini.com ([207.126.147.11]) with SMTP ID DSNKUOn+PuPCjZgz4TbQfET3StFGD1hYmxmS@postini.com; Sun, 06 Jan 2013 22:44:20 UTC Received: from zeta.dmz-us.st.com (ns4.st.com [167.4.16.71]) by beta.dmz-us.st.com (STMicroelectronics) with ESMTP id 0028840; Sun, 6 Jan 2013 22:43:30 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-us.st.com (STMicroelectronics) with ESMTP id CACB84E; Sun, 6 Jan 2013 17:14:29 +0000 (GMT) Received: from exdcvycastm004.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm004", Issuer "exdcvycastm004" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 4490DA8072; Sun, 6 Jan 2013 23:44:04 +0100 (CET) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.2) with Microsoft SMTP Server (TLS) id 8.3.83.0; Sun, 6 Jan 2013 23:44:12 +0100 From: Linus Walleij To: Vinod Koul Cc: , Dan Williams , Anmar Oueja , Linus Walleij Subject: [PATCH 8/8] dma: coh901318: cut down on platform data abstraction Date: Sun, 6 Jan 2013 23:44:09 +0100 Message-ID: <1357512249-5848-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.11.3 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQlcJLCM5a5djEYKVGilX9Xv365N3QhZAz/PgDYRUOx7rM5MNzlj2xqYFnAxFuX/hsDBnEGz From: Linus Walleij Since we merged the platform data into the driver we can remove the middle-man abstraction. Signed-off-by: Linus Walleij --- drivers/dma/coh901318.c | 74 +++++-------------------------------------------- 1 file changed, 7 insertions(+), 67 deletions(-) diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c index 0604273..a2f079a 100644 --- a/drivers/dma/coh901318.c +++ b/drivers/dma/coh901318.c @@ -199,16 +199,6 @@ struct coh_dma_channel { }; /** - * dma_access_memory_state_t - register dma for memory access - * - * @dev: The dma device - * @active: 1 means dma intends to access memory - * 0 means dma wont access memory - */ -typedef void (*dma_access_memory_state_t)(struct device *dev, - bool active); - -/** * struct powersave - DMA power save structure * @lock: lock protecting data in this struct * @started_channels: bit mask indicating active dma channels @@ -218,22 +208,6 @@ struct powersave { u64 started_channels; }; -/** - * struct coh901318_platform - platform arch structure - * @chans_slave: specifying dma slave channels - * @chans_memcpy: specifying dma memcpy channels - * @access_memory_state: requesting DMA memory access (on / off) - * @chan_conf: dma channel configurations - * @max_channels: max number of dma chanenls - */ -struct coh901318_platform { - const int *chans_slave; - const int *chans_memcpy; - const dma_access_memory_state_t access_memory_state; - const struct coh_dma_channel *chan_conf; - const int max_channels; -}; - /* points out all dma slave channels. * Syntax is [A1, B1, A2, B2, .... ,-1,-1] * Select all channels from A to B, end of list is marked with -1,-1 @@ -246,15 +220,6 @@ static int dma_slave_channels[] = { static int dma_memcpy_channels[] = { U300_DMA_GENERAL_PURPOSE_0, U300_DMA_GENERAL_PURPOSE_8, -1, -1}; -/** register dma for memory access - * - * active 1 means dma intends to access memory - * 0 means dma wont access memory - */ -static void coh901318_access_memory_state(struct device *dev, bool active) -{ -} - #define flags_memcpy_config (COH901318_CX_CFG_CH_DISABLE | \ COH901318_CX_CFG_RM_MEMORY_TO_MEMORY | \ COH901318_CX_CFG_LCR_DISABLE | \ @@ -1291,14 +1256,6 @@ const struct coh_dma_channel chan_config[U300_DMA_CHANNELS] = { } }; -static struct coh901318_platform coh901318_platform = { - .chans_slave = dma_slave_channels, - .chans_memcpy = dma_memcpy_channels, - .access_memory_state = coh901318_access_memory_state, - .chan_conf = chan_config, - .max_channels = U300_DMA_CHANNELS, -}; - #define COHC_2_DEV(cohc) (&cohc->chan.dev->device) #ifdef VERBOSE_DEBUG @@ -1327,7 +1284,6 @@ struct coh901318_base { struct dma_device dma_slave; struct dma_device dma_memcpy; struct coh901318_chan *chans; - struct coh901318_platform *platform; }; struct coh901318_chan { @@ -1395,7 +1351,7 @@ static int coh901318_debugfs_read(struct file *file, char __user *buf, tmp += sprintf(tmp, "DMA -- enabled dma channels\n"); - for (i = 0; i < debugfs_dma_base->platform->max_channels; i++) + for (i = 0; i < U300_DMA_CHANNELS; i++) if (started_channels & (1 << i)) tmp += sprintf(tmp, "channel %d\n", i); @@ -1463,13 +1419,13 @@ static inline struct coh901318_chan *to_coh901318_chan(struct dma_chan *chan) static inline const struct coh901318_params * cohc_chan_param(struct coh901318_chan *cohc) { - return &cohc->base->platform->chan_conf[cohc->id].param; + return &chan_config[cohc->id].param; } static inline const struct coh_dma_channel * cohc_chan_conf(struct coh901318_chan *cohc) { - return &cohc->base->platform->chan_conf[cohc->id]; + return &chan_config[cohc->id]; } static void enable_powersave(struct coh901318_chan *cohc) @@ -1481,12 +1437,6 @@ static void enable_powersave(struct coh901318_chan *cohc) pm->started_channels &= ~(1ULL << cohc->id); - if (!pm->started_channels) { - /* DMA no longer intends to access memory */ - cohc->base->platform->access_memory_state(cohc->base->dev, - false); - } - spin_unlock_irqrestore(&pm->lock, flags); } static void disable_powersave(struct coh901318_chan *cohc) @@ -1496,12 +1446,6 @@ static void disable_powersave(struct coh901318_chan *cohc) spin_lock_irqsave(&pm->lock, flags); - if (!pm->started_channels) { - /* DMA intends to access memory */ - cohc->base->platform->access_memory_state(cohc->base->dev, - true); - } - pm->started_channels |= (1ULL << cohc->id); spin_unlock_irqrestore(&pm->lock, flags); @@ -1860,7 +1804,7 @@ static int coh901318_config(struct coh901318_chan *cohc, if (param) p = param; else - p = &cohc->base->platform->chan_conf[channel].param; + p = cohc_chan_param(cohc); /* Clear any pending BE or TC interrupt */ if (channel < 32) { @@ -2695,7 +2639,6 @@ void coh901318_base_init(struct dma_device *dma, const int *pick_chans, static int __init coh901318_probe(struct platform_device *pdev) { int err = 0; - struct coh901318_platform *pdata; struct coh901318_base *base; int irq; struct resource *io; @@ -2711,11 +2654,9 @@ static int __init coh901318_probe(struct platform_device *pdev) pdev->dev.driver->name) == NULL) return -ENOMEM; - pdata = &coh901318_platform, - base = devm_kzalloc(&pdev->dev, ALIGN(sizeof(struct coh901318_base), 4) + - pdata->max_channels * + U300_DMA_CHANNELS * sizeof(struct coh901318_chan), GFP_KERNEL); if (!base) @@ -2728,7 +2669,6 @@ static int __init coh901318_probe(struct platform_device *pdev) return -ENOMEM; base->dev = &pdev->dev; - base->platform = pdata; spin_lock_init(&base->pm.lock); base->pm.started_channels = 0; @@ -2750,7 +2690,7 @@ static int __init coh901318_probe(struct platform_device *pdev) return err; /* init channels for device transfers */ - coh901318_base_init(&base->dma_slave, base->platform->chans_slave, + coh901318_base_init(&base->dma_slave, dma_slave_channels, base); dma_cap_zero(base->dma_slave.cap_mask); @@ -2770,7 +2710,7 @@ static int __init coh901318_probe(struct platform_device *pdev) goto err_register_slave; /* init channels for memcpy */ - coh901318_base_init(&base->dma_memcpy, base->platform->chans_memcpy, + coh901318_base_init(&base->dma_memcpy, dma_memcpy_channels, base); dma_cap_zero(base->dma_memcpy.cap_mask);