From patchwork Mon Aug 25 12:25:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 35899 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f69.google.com (mail-oa0-f69.google.com [209.85.219.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id ABDA5203C0 for ; Mon, 25 Aug 2014 12:26:33 +0000 (UTC) Received: by mail-oa0-f69.google.com with SMTP id i7sf80899535oag.8 for ; Mon, 25 Aug 2014 05:26:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=JpZHsfqqi0gat9FutFs9aaOZtkFUHPloW6lrDlm7SJ4=; b=G7pA8nXn+UNpvztQOLtvha3qOLpKpG6nte5DBwRjTO/yz9I9vSCBr0Ff4aBYRdDhte hi8Np66l1P9uKidV5NhZnPhiZr6Pa+lABfq39C0BpwHUjq6nqlqMnOpv6d+/Db+AG00s x8tYLXb35iURJi3IKo/1idUR2n93+qKYytExPG7q8br3m3TmaUWG0Pl65bfjiHsA/kio V74LKXhSoRfF2ER/o2UCf4n0vYLxqc0G0in8aue4Lvt2j6lmJgSTg0+DTRvPhN992Uua n6ecZtpq+yVZkKRz/JFthVkG8rlUOyju4xWrmsm13iHeDTxSJDUwkIEvjK/v02nLcqTI 7tPQ== X-Gm-Message-State: ALoCoQmUmRmN4C454kqY/pSZp05gMTHZsWxVvy20k5krA2IFu2wd4tQNtjlLnCLNrmEw2vX9x5za X-Received: by 10.42.58.138 with SMTP id i10mr17626059ich.18.1408969593296; Mon, 25 Aug 2014 05:26:33 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.34.206 with SMTP id l72ls2012063qgl.46.gmail; Mon, 25 Aug 2014 05:26:33 -0700 (PDT) X-Received: by 10.52.165.116 with SMTP id yx20mr12787627vdb.13.1408969593156; Mon, 25 Aug 2014 05:26:33 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id xk3si13148874vdb.7.2014.08.25.05.26.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Aug 2014 05:26:33 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id ij19so14955860vcb.39 for ; Mon, 25 Aug 2014 05:26:33 -0700 (PDT) X-Received: by 10.52.129.200 with SMTP id ny8mr1467121vdb.27.1408969593088; Mon, 25 Aug 2014 05:26:33 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp113256vcb; Mon, 25 Aug 2014 05:26:32 -0700 (PDT) X-Received: by 10.194.60.240 with SMTP id k16mr2657924wjr.109.1408969592088; Mon, 25 Aug 2014 05:26:32 -0700 (PDT) Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by mx.google.com with ESMTPS id a1si55641476wje.8.2014.08.25.05.26.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Aug 2014 05:26:32 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 74.125.82.50 as permitted sender) client-ip=74.125.82.50; Received: by mail-wg0-f50.google.com with SMTP id n12so12928166wgh.33 for ; Mon, 25 Aug 2014 05:26:31 -0700 (PDT) X-Received: by 10.180.210.163 with SMTP id mv3mr15327858wic.15.1408969591605; Mon, 25 Aug 2014 05:26:31 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id u5sm145337wia.17.2014.08.25.05.26.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Aug 2014 05:26:31 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ian Molton , Chris Ball Cc: Geert Uytterhoeven , Linux-sh list , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH 03/12] mmc: tmio: Extract bus_width modifications to a separate function Date: Mon, 25 Aug 2014 14:25:55 +0200 Message-Id: <1408969564-6335-4-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1408969564-6335-1-git-send-email-ulf.hansson@linaro.org> References: <1408969564-6335-1-git-send-email-ulf.hansson@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Move code for bus_width modification, out of the ->set_ios() callback and into a separate function, to simplify code. Signed-off-by: Ulf Hansson --- drivers/mmc/host/tmio_mmc_pio.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c index d63d292..8f5b5cc 100644 --- a/drivers/mmc/host/tmio_mmc_pio.c +++ b/drivers/mmc/host/tmio_mmc_pio.c @@ -831,6 +831,19 @@ static void tmio_mmc_power_off(struct tmio_mmc_host *host) host->set_pwr(host->pdev, 0); } +static void tmio_mmc_set_bus_width(struct tmio_mmc_host *host, + unsigned char bus_width) +{ + switch (bus_width) { + case MMC_BUS_WIDTH_1: + sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x80e0); + break; + case MMC_BUS_WIDTH_4: + sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x00e0); + break; + } +} + /* Set MMC clock / power. * Note: This controller uses a simple divider scheme therefore it cannot * run a MMC card at full speed (20MHz). The max clock is 24MHz on SD, but as @@ -914,16 +927,8 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) } } - if (host->power != TMIO_MMC_OFF_STOP) { - switch (ios->bus_width) { - case MMC_BUS_WIDTH_1: - sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x80e0); - break; - case MMC_BUS_WIDTH_4: - sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x00e0); - break; - } - } + if (host->power != TMIO_MMC_OFF_STOP) + tmio_mmc_set_bus_width(host, ios->bus_width); /* Let things settle. delay taken from winCE driver */ udelay(140);