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: 3156351 Return-Path: X-Original-To: patchwork-linux-mmc@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 8B4CEBEEB2 for ; Fri, 8 Nov 2013 06:06:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A2594203B4 for ; Fri, 8 Nov 2013 06:06:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A47BB203AE for ; Fri, 8 Nov 2013 06:06:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751813Ab3KHGGf (ORCPT ); Fri, 8 Nov 2013 01:06:35 -0500 Received: from mail-la0-f53.google.com ([209.85.215.53]:35892 "EHLO mail-la0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751290Ab3KHGGe (ORCPT ); Fri, 8 Nov 2013 01:06:34 -0500 Received: by mail-la0-f53.google.com with SMTP id eh20so1360008lab.40 for ; Thu, 07 Nov 2013 22:06:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=R6hGTlHBwuN5x43ZoyrGYb7URJFUWBE5BS4CDxIZnW4=; b=M50Fqjj2s09g0exzXSqDYdGtJvN8Cd7bRvhDD3zfIRyBuX2FYUJuyU33DwMYTMnD/C 9kCSuxMoqahSg6tdqbrpgKiZwMp6cEFG9S2RcIJwx/xgnJ1C0urunXE2ueZZZOmGtgYu JnxaNPq3L2Eqf2Z3B7+bee5d8BIpbU9ieZtMqW/R+lMEdLjygoUEVxEk2Co1w1GojYyX 3cRV3zwMCcvYzE7+DGU7f+7a4yukUc38FxHvoeN5vI0bDHnl5YIc3iEe3hRXPk6BlV/V un9TxnUbU0Ac5C38fG5GSqgq8EeYGybIJ+OEvhIYcrlZhn1A0JdVkXYlBNx6+5k3Z15t n1CQ== X-Gm-Message-State: ALoCoQm/jt8LsLBOjWrq4FceXd8Nxge8C8Lb4Yy5YnUjmVfnc3fMfOm7BEdfIpxwIFjTeppDVVMW 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> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 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);