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: 4774391 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 37C409F38D for ; Mon, 25 Aug 2014 12:30:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 64E88200D6 for ; Mon, 25 Aug 2014 12:30:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 875F4200FF for ; Mon, 25 Aug 2014 12:30:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932184AbaHYMaV (ORCPT ); Mon, 25 Aug 2014 08:30:21 -0400 Received: from mail-wg0-f46.google.com ([74.125.82.46]:38138 "EHLO mail-wg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932305AbaHYM0d (ORCPT ); Mon, 25 Aug 2014 08:26:33 -0400 Received: by mail-wg0-f46.google.com with SMTP id m15so12944145wgh.17 for ; Mon, 25 Aug 2014 05:26:31 -0700 (PDT) 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=JpZHsfqqi0gat9FutFs9aaOZtkFUHPloW6lrDlm7SJ4=; b=SOfUCsHyrP2DGf8rlS0PpXqgCv2bglgwELiXcSOmmyHzarGzRsh85SW9BYdzuMlGzj Xqu0pY3Q4HBX27ZosDB6mp01fo622njIC7GmUs4VAA5lgA/iMb35OsbOlIshZSqxQcjU bebtO9GSm6YutL1y5lhA1fXriTt8SPg3KEqvTZdqvbOlaV6eFMh9uAQVTMHi4UjFlQ/Y 9wFkyXYbrgJF7x2zmc+ftl1qRtbBJcE7JF7lmpKZ0uKSKwMV5jOUI6fzUjSQ6WyzNAYy TOVOpWWsHbE3X+2e86EKNSuWpy0H2k/gV2xNicii1IzQ5/jn4l2XGNF6ZosIrVdwv4fI /TFg== X-Gm-Message-State: ALoCoQnAahhbQG7yUyGDKeq7y+NBhaid9b6+gc84HQanr9Ggut/9vQoFDlu/6Q1+hvCir0JnOs9Q 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> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@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=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 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);