From patchwork Tue Feb 14 20:06:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9572729 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7F9D0601E7 for ; Tue, 14 Feb 2017 20:08:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7CF3026E4D for ; Tue, 14 Feb 2017 20:08:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 71F3728415; Tue, 14 Feb 2017 20:08:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2320426E4D for ; Tue, 14 Feb 2017 20:08:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:References:To:Subject:From:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aY0N95k/pFDq3Zcf/VjELPz6QioZ9fS8TeV9ANMi5cc=; b=GZx+aMteJa0Spk 7p6K9m0MZstPDRe713yByqCe96Q67cTLrbLGgaQ43wJdjl/ITAuqlfNiVPHHH/OowmMfw3KD3KcJv kO7EP5IHBqT0hcLE5/k2/SYAX8mwUv/QJ414AW2earWZl8AWJdms/ZRAA7tv/+VxOO/dLan92xYq2 9agzPKXVEyB8JCfR//IxAF18iUwOsGy14RKhWfW+twe+FXJlxkA+fk37n8Sv5XtSBi9cnUH+RoZE+ /kluW/yej8eEciWQAZuhrFa5fXOtQvK61tZ7RAI9tolEOD9XyXP3SyxkrqYT9Uq803/Tq1lA7Bq7l VXppX03TpZQkHyjsaWMw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cdjOO-0001xW-7z; Tue, 14 Feb 2017 20:08:04 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cdjOE-0001l1-Ah for linux-amlogic@lists.infradead.org; Tue, 14 Feb 2017 20:07:59 +0000 Received: by mail-wm0-x241.google.com with SMTP id c85so5235833wmi.1 for ; Tue, 14 Feb 2017 12:07:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:references:cc:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=FUowOfHLtu13vFUaMvMP125t28L6Mrj5pdL9UsKBXpI=; b=nSLBJcEOmfqKr6fbY9hWG2d2JyN0fSba4qOIN/E0zJyB2K0sKpD73YDameCzgTqKI+ ua48ZJ4oABl9sLZbgkp8u0oc7bxqGxAwJaXDWI1fJr0Gsbr5FyL2ZuEQ4cQp+VE6VJtg M8Gnmcm8CFOh13hh/prrssiOCXDznQwS+tocfgfTdf8RNbSD3KvGjwy0jJgL7pPCm1E2 2lT6jrKzDAeACczO0Zah7tK8LGR4JJIhJCPx9Tipt4g7dvPh/QvzTjUxeoijlOBEQ5Kq 8CiMydqw6/jpmXLO7YoUqsTGgcjWNcfczcZ7Ee5h6JzQkxAt/EinPOurgI94X7pyBKfy 7lbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:references:cc:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=FUowOfHLtu13vFUaMvMP125t28L6Mrj5pdL9UsKBXpI=; b=Qjic/SEjmbeEt/OUp517BRNfxWtX6dYW0muO476ClUdJ5L8gFszZ91EtnDXN+4yMn2 fP7dJ7A1Vseofet8nwF3FtzpHQJP13b5rsXcQgzEaSom0P3H3X+U6Ywbt9+MmzeTfsdL osxFggYgHTb75jL1oXKuYlGwqsXOxCrhueC3MQJAbVpWJaU+T3RhAk+nx9lrMqlGeJmJ 6FxvI2tgTiyfQqnnbTNtJpz1QyOr2NFVCj6CSlRrs27Buvcw2DrauYZLRme9iJmxiALI eZGjQnw5byB9askqUSUQCO+tdhQ79pmraJULzSc1lR/Tr7/D124DTFuabagouusJX2k2 m0pg== X-Gm-Message-State: AMke39leCRIlbQFKmeo51Gg2FZ7LOxNvxpgjjh7x0AbisfYw5+bf4YfzrCrhwOA5kdjMDA== X-Received: by 10.28.207.7 with SMTP id f7mr4917239wmg.112.1487102855617; Tue, 14 Feb 2017 12:07:35 -0800 (PST) Received: from ?IPv6:2003:c6:ebdc:4000:9533:a20:55f1:fb4b? (p200300C6EBDC400095330A2055F1FB4B.dip0.t-ipconnect.de. [2003:c6:ebdc:4000:9533:a20:55f1:fb4b]) by smtp.googlemail.com with ESMTPSA id a35sm2071310wra.21.2017.02.14.12.07.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Feb 2017 12:07:35 -0800 (PST) From: Heiner Kallweit Subject: [PATCH 05/18] mmc: meson-gx: eliminate struct sd_emmc_data To: Ulf Hansson , Kevin Hilman References: <420b75a9-b8c2-b3d7-ae60-3ed8a5a18ead@gmail.com> Message-ID: <4a344def-d2de-ef25-8506-8ad92b8147ce@gmail.com> Date: Tue, 14 Feb 2017 21:06:22 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <420b75a9-b8c2-b3d7-ae60-3ed8a5a18ead@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170214_120754_592220_EA40A5EC X-CRM114-Status: GOOD ( 12.39 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Carlo Caione , linux-amlogic@lists.infradead.org, "linux-mmc@vger.kernel.org" Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Struct sd_emmc_data is used in meson_mmc_start_cmd only, so we can get rid of this struct and replace the two used members with local variables. Signed-off-by: Heiner Kallweit --- drivers/mmc/host/meson-gx-mmc.c | 69 +++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 40 deletions(-) diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c index 630e0590..c7bf0e12 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c @@ -146,12 +146,6 @@ struct meson_host { bool vqmmc_enabled; }; -struct sd_emmc_desc { - u32 cmd_cfg; - u32 cmd_arg; - u32 cmd_data; - u32 cmd_resp; -}; #define CMD_CFG_LENGTH_SHIFT 0 #define CMD_CFG_LENGTH_MASK 0x1ff #define CMD_CFG_BLOCK_MODE BIT(9) @@ -443,45 +437,41 @@ static int meson_mmc_request_done(struct mmc_host *mmc, struct mmc_request *mrq) static void meson_mmc_start_cmd(struct mmc_host *mmc, struct mmc_command *cmd) { struct meson_host *host = mmc_priv(mmc); - struct sd_emmc_desc *desc, desc_tmp; - u32 cfg; + u32 cfg, cmd_cfg = 0, cmd_data = 0; u8 blk_len, cmd_cfg_timeout; unsigned int xfer_bytes = 0; /* Setup descriptors */ dma_rmb(); - desc = &desc_tmp; - memset(desc, 0, sizeof(struct sd_emmc_desc)); - desc->cmd_cfg |= (cmd->opcode & CMD_CFG_CMD_INDEX_MASK) << - CMD_CFG_CMD_INDEX_SHIFT; - desc->cmd_cfg |= CMD_CFG_OWNER; /* owned by CPU */ + cmd_cfg |= (cmd->opcode & CMD_CFG_CMD_INDEX_MASK) << + CMD_CFG_CMD_INDEX_SHIFT; + cmd_cfg |= CMD_CFG_OWNER; /* owned by CPU */ /* Response */ if (cmd->flags & MMC_RSP_PRESENT) { - desc->cmd_cfg &= ~CMD_CFG_NO_RESP; + cmd_cfg &= ~CMD_CFG_NO_RESP; if (cmd->flags & MMC_RSP_136) - desc->cmd_cfg |= CMD_CFG_RESP_128; - desc->cmd_cfg |= CMD_CFG_RESP_NUM; + cmd_cfg |= CMD_CFG_RESP_128; + cmd_cfg |= CMD_CFG_RESP_NUM; writel(0, host->regs + SD_EMMC_CMD_RSP); if (!(cmd->flags & MMC_RSP_CRC)) - desc->cmd_cfg |= CMD_CFG_RESP_NOCRC; + cmd_cfg |= CMD_CFG_RESP_NOCRC; if (cmd->flags & MMC_RSP_BUSY) - desc->cmd_cfg |= CMD_CFG_R1B; + cmd_cfg |= CMD_CFG_R1B; } else { - desc->cmd_cfg |= CMD_CFG_NO_RESP; + cmd_cfg |= CMD_CFG_NO_RESP; } /* data? */ if (cmd->data) { - desc->cmd_cfg |= CMD_CFG_DATA_IO; + cmd_cfg |= CMD_CFG_DATA_IO; if (cmd->data->blocks > 1) { - desc->cmd_cfg |= CMD_CFG_BLOCK_MODE; - desc->cmd_cfg |= - (cmd->data->blocks & CMD_CFG_LENGTH_MASK) << - CMD_CFG_LENGTH_SHIFT; + cmd_cfg |= CMD_CFG_BLOCK_MODE; + cmd_cfg |= (cmd->data->blocks & CMD_CFG_LENGTH_MASK) << + CMD_CFG_LENGTH_SHIFT; /* check if block-size matches, if not update */ cfg = readl(host->regs + SD_EMMC_CFG); @@ -497,48 +487,47 @@ static void meson_mmc_start_cmd(struct mmc_host *mmc, struct mmc_command *cmd) writel(cfg, host->regs + SD_EMMC_CFG); } } else { - desc->cmd_cfg &= ~CMD_CFG_BLOCK_MODE; - desc->cmd_cfg |= - (cmd->data->blksz & CMD_CFG_LENGTH_MASK) << - CMD_CFG_LENGTH_SHIFT; + cmd_cfg &= ~CMD_CFG_BLOCK_MODE; + cmd_cfg |= (cmd->data->blksz & CMD_CFG_LENGTH_MASK) << + CMD_CFG_LENGTH_SHIFT; } cmd->data->bytes_xfered = 0; xfer_bytes = cmd->data->blksz * cmd->data->blocks; if (cmd->data->flags & MMC_DATA_WRITE) { - desc->cmd_cfg |= CMD_CFG_DATA_WR; + cmd_cfg |= CMD_CFG_DATA_WR; WARN_ON(xfer_bytes > host->bounce_buf_size); sg_copy_to_buffer(cmd->data->sg, cmd->data->sg_len, host->bounce_buf, xfer_bytes); cmd->data->bytes_xfered = xfer_bytes; dma_wmb(); } else { - desc->cmd_cfg &= ~CMD_CFG_DATA_WR; + cmd_cfg &= ~CMD_CFG_DATA_WR; } if (xfer_bytes > 0) { - desc->cmd_cfg &= ~CMD_CFG_DATA_NUM; - desc->cmd_data = host->bounce_dma_addr & CMD_DATA_MASK; + cmd_cfg &= ~CMD_CFG_DATA_NUM; + cmd_data = host->bounce_dma_addr & CMD_DATA_MASK; } else { /* write data to data_addr */ - desc->cmd_cfg |= CMD_CFG_DATA_NUM; - desc->cmd_data = 0; + cmd_cfg |= CMD_CFG_DATA_NUM; + cmd_data = 0; } cmd_cfg_timeout = 12; } else { - desc->cmd_cfg &= ~CMD_CFG_DATA_IO; + cmd_cfg &= ~CMD_CFG_DATA_IO; cmd_cfg_timeout = 10; } - desc->cmd_cfg |= (cmd_cfg_timeout & CMD_CFG_TIMEOUT_MASK) << - CMD_CFG_TIMEOUT_SHIFT; + cmd_cfg |= (cmd_cfg_timeout & CMD_CFG_TIMEOUT_MASK) << + CMD_CFG_TIMEOUT_SHIFT; host->cmd = cmd; /* Last descriptor */ - desc->cmd_cfg |= CMD_CFG_END_OF_CHAIN; - writel(desc->cmd_cfg, host->regs + SD_EMMC_CMD_CFG); - writel(desc->cmd_data, host->regs + SD_EMMC_CMD_DAT); + cmd_cfg |= CMD_CFG_END_OF_CHAIN; + writel(cmd_cfg, host->regs + SD_EMMC_CMD_CFG); + writel(cmd_data, host->regs + SD_EMMC_CMD_DAT); wmb(); /* ensure descriptor is written before kicked */ writel(cmd->arg, host->regs + SD_EMMC_CMD_ARG); }