From patchwork Sun Jun 16 20:54:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 2728691 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 91D5EC0AB1 for ; Sun, 16 Jun 2013 20:55:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A52BA20171 for ; Sun, 16 Jun 2013 20:55:29 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8A45220172 for ; Sun, 16 Jun 2013 20:55:28 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UoJyf-0006Yb-Up; Sun, 16 Jun 2013 20:55:10 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UoJya-00080F-PA; Sun, 16 Jun 2013 20:55:04 +0000 Received: from mail-bk0-x22d.google.com ([2a00:1450:4008:c01::22d]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UoJyL-0007xX-2Z for linux-arm-kernel@lists.infradead.org; Sun, 16 Jun 2013 20:54:50 +0000 Received: by mail-bk0-f45.google.com with SMTP id je9so889170bkc.32 for ; Sun, 16 Jun 2013 13:54:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=RmljP3F+IqBnEnECH3TRQXWc9XmbnEu8rwyRvzX5Qx8=; b=ic95vCAiZEYtGmj4rumh0eAs9UvVjl5uxpC86Xj71CkJS1e3bXHH/XYiOhnY6KIpGZ jZubwK14UzaVbDEex23SBNLzH0UxIuJOaEaMKmmcb8AOdvj8xRba75kIoLJovRWGBuXI IOYxphlFDD0/f98PcAmwHPBwOasXqLF0oP8PHBOsIi9zZApvnuT70dJwDY8ft8m2tG/D LzBVR4H/O1OJvaR4xF/2FYVk6JtQKAw0eNWykGMhUT+6ljXWgYAYooggml5Wq22mfNmT NeiR0g4LCserLfrj08JDhlRSbdGyeGShjCqonUb0kd6BHNms9ASV6yTV/CzAXGpzKMXc T7xw== X-Received: by 10.204.188.134 with SMTP id da6mr1545588bkb.121.1371416069166; Sun, 16 Jun 2013 13:54:29 -0700 (PDT) Received: from flatron.tomeq (87-207-52-162.dynamic.chello.pl. [87.207.52.162]) by mx.google.com with ESMTPSA id m6sm1996010bki.7.2013.06.16.13.54.26 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 16 Jun 2013 13:54:28 -0700 (PDT) From: Tomasz Figa To: linux-samsung-soc@vger.kernel.org Subject: [RFC PATCH 01/11] dma: amba-pl08x: Use bitmap to pass variant specific quirks Date: Sun, 16 Jun 2013 22:54:08 +0200 Message-Id: <1371416058-22047-2-git-send-email-tomasz.figa@gmail.com> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1371416058-22047-1-git-send-email-tomasz.figa@gmail.com> References: <1371416058-22047-1-git-send-email-tomasz.figa@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130616_165449_329725_E8075A4F X-CRM114-Status: GOOD ( 18.00 ) X-Spam-Score: -2.0 (--) Cc: alsa-devel@alsa-project.org, =?UTF-8?q?Heiko=20St=C3=BCbner?= , Padmavathi Venna , Takashi Iwai , Linus Walleij , Tomasz Figa , linux-kernel@vger.kernel.org, Giancarlo Asnaghi , Kukjin Kim , Russell King - ARM Linux , Vinod Koul , Thomas Abraham , Grant Likely , Alessandro Rubini , Arnd Bergmann , Mark Brown , Sylwester Nawrocki , Jaroslav Kysela , linux-arm-kernel@lists.infradead.org, Sangbeom Kim , Liam Girdwood , linux-spi@vger.kernel.org, Dan Williams , Olof Johansson , Alban Bedel X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Instead of defining new bool field in vendor_data struct for each quirk, it is more reasonable to use a single flags field and make each quirk use single bits. Signed-off-by: Tomasz Figa Acked-by: Linus Walleij --- drivers/dma/amba-pl08x.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index 8bad254..d443a68 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c @@ -93,18 +93,22 @@ static struct amba_driver pl08x_amba_driver; struct pl08x_driver_data; +/** Controller supports dual AHB masters. */ +#define PL08X_IS_DUALMASTER (1 << 0) +/** + * Controller has Nomadik security extension bits that need to be checked + * for permission before use and some registers are missing. + */ +#define PL08X_IS_NOMADIK (1 << 1) + /** * struct vendor_data - vendor-specific config parameters for PL08x derivatives * @channels: the number of channels available in this variant - * @dualmaster: whether this version supports dual AHB masters or not. - * @nomadik: whether the channels have Nomadik security extension bits - * that need to be checked for permission before use and some registers are - * missing + * @flags: Vendor-specific flags, see PL08X_IS_* */ struct vendor_data { u8 channels; - bool dualmaster; - bool nomadik; + u32 flags; }; /* @@ -1391,7 +1395,7 @@ static struct dma_async_tx_descriptor *pl08x_prep_dma_memcpy( /* Both to be incremented or the code will break */ txd->cctl |= PL080_CONTROL_SRC_INCR | PL080_CONTROL_DST_INCR; - if (pl08x->vd->dualmaster) + if (pl08x->vd->flags & PL08X_IS_DUALMASTER) txd->cctl |= pl08x_select_bus(pl08x->mem_buses, pl08x->mem_buses); @@ -1612,7 +1616,7 @@ bool pl08x_filter_id(struct dma_chan *chan, void *chan_id) static void pl08x_ensure_on(struct pl08x_driver_data *pl08x) { /* The Nomadik variant does not have the config register */ - if (pl08x->vd->nomadik) + if (pl08x->vd->flags & PL08X_IS_NOMADIK) return; writel(PL080_CONFIG_ENABLE, pl08x->base + PL080_CONFIG); } @@ -1897,7 +1901,7 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id) /* By default, AHB1 only. If dualmaster, from platform */ pl08x->lli_buses = PL08X_AHB1; pl08x->mem_buses = PL08X_AHB1; - if (pl08x->vd->dualmaster) { + if (pl08x->vd->flags & PL08X_IS_DUALMASTER) { pl08x->lli_buses = pl08x->pd->lli_buses; pl08x->mem_buses = pl08x->pd->mem_buses; } @@ -1954,7 +1958,7 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id) * down for the secure world only. Lock up these channels * by perpetually serving a dummy virtual channel. */ - if (vd->nomadik) { + if (vd->flags & PL08X_IS_NOMADIK) { u32 val; val = readl(ch->base + PL080_CH_CONFIG); @@ -2039,18 +2043,17 @@ out_no_pl08x: /* PL080 has 8 channels and the PL080 have just 2 */ static struct vendor_data vendor_pl080 = { .channels = 8, - .dualmaster = true, + .flags = PL08X_IS_DUALMASTER, }; static struct vendor_data vendor_nomadik = { .channels = 8, - .dualmaster = true, - .nomadik = true, + .flags = PL08X_IS_DUALMASTER | PL08X_IS_NOMADIK, }; static struct vendor_data vendor_pl081 = { .channels = 2, - .dualmaster = false, + .flags = 0, }; static struct amba_id pl08x_ids[] = {