From patchwork Fri Nov 8 06:06:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 21420 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f72.google.com (mail-oa0-f72.google.com [209.85.219.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EB8A8244F2 for ; Fri, 8 Nov 2013 06:06:35 +0000 (UTC) Received: by mail-oa0-f72.google.com with SMTP id o6sf1305942oag.3 for ; Thu, 07 Nov 2013 22:06:35 -0800 (PST) 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=R6hGTlHBwuN5x43ZoyrGYb7URJFUWBE5BS4CDxIZnW4=; b=Dl29lHo8AnHBndu3a69DFajWnJGFUNdjP2VHDhHRmgsuLzkrUkET4nf1GmiebgdjnE +f19cbh7PV7ZA9BKSTEcdizSXO5EucSfah6wdQUprHDQ4N4gvLQdztXVmFUzeBsWVC8v cm6gCH60Po8uc5OUW0kkJ4z2IKCsTzcIGAbXkztRvUOUOlZFe29lpVuGH+jlPcbKd658 RJti5CplbcIXtxKY7+xYaUi2rW+Ud5onPwRnMKMR060zSNQs+3yyaizD+vmxXCgUzJot a0Hdi0x9CFxbwmeR8fpXGIFk48nVxREKj6hTMtCj/WBPdyxYWVE26Bq7/LvYWDONnqfv 6BcQ== X-Gm-Message-State: ALoCoQl3lHuABRlwFlltsQrDRKS2yDcNXO4CcBGb0WIrTUBZUZ70N/N7p3Ax2FWxCep+zCTzBTR/ X-Received: by 10.42.85.148 with SMTP id q20mr3517183icl.22.1383890795228; Thu, 07 Nov 2013 22:06:35 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.119.9 with SMTP id kq9ls1558694qeb.48.gmail; Thu, 07 Nov 2013 22:06:35 -0800 (PST) X-Received: by 10.58.216.74 with SMTP id oo10mr10291888vec.0.1383890795104; Thu, 07 Nov 2013 22:06:35 -0800 (PST) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id i8si3275694vcp.31.2013.11.07.22.06.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 07 Nov 2013 22:06:35 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id ij19so1093286vcb.12 for ; Thu, 07 Nov 2013 22:06:35 -0800 (PST) X-Received: by 10.52.34.76 with SMTP id x12mr245259vdi.35.1383890795037; Thu, 07 Nov 2013 22:06:35 -0800 (PST) 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.220.174.196 with SMTP id u4csp6970vcz; Thu, 7 Nov 2013 22:06:34 -0800 (PST) X-Received: by 10.112.144.5 with SMTP id si5mr214818lbb.33.1383890794111; Thu, 07 Nov 2013 22:06:34 -0800 (PST) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com [209.85.215.43]) by mx.google.com with ESMTPS id l10si2874884lam.69.2013.11.07.22.06.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 07 Nov 2013 22:06:34 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.43 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=209.85.215.43; Received: by mail-la0-f43.google.com with SMTP id n7so344688lam.30 for ; Thu, 07 Nov 2013 22:06:33 -0800 (PST) X-Received: by 10.152.143.6 with SMTP id sa6mr9499680lab.20.1383890793394; Thu, 07 Nov 2013 22:06:33 -0800 (PST) Received: from linaro-ulf.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id f4sm6860209lah.0.2013.11.07.22.06.31 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 07 Nov 2013 22:06:32 -0800 (PST) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Chris Ball Cc: Ulf Hansson , Guennadi Liakhovetski Subject: [PATCH 6/8] mmc: tmio: Extract bus_width modifications to a function Date: Fri, 8 Nov 2013 07:06:14 +0100 Message-Id: <1383890776-6912-7-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1383890776-6912-1-git-send-email-ulf.hansson@linaro.org> References: <1383890776-6912-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=neutral (google.com: 209.85.220.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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: , Cc: Guennadi Liakhovetski 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 33a5e26..fefe86c 100644 --- a/drivers/mmc/host/tmio_mmc_pio.c +++ b/drivers/mmc/host/tmio_mmc_pio.c @@ -837,6 +837,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 @@ -920,16 +933,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);