From patchwork Tue May 26 08:04:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1251 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 6ECBA3F08B for ; Tue, 26 May 2020 10:05:02 +0200 (CEST) Received: by mail-pf1-f197.google.com with SMTP id 67sf16219606pfe.0 for ; Tue, 26 May 2020 01:05:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1590480301; cv=pass; d=google.com; s=arc-20160816; b=fRvBysf6M2pVYt0daEX5dFgjqjNLpHMNMsxWh5LXZPmXGlSJwSiDhmpkH7RjPh62j9 pUVxX6c7D1sHtSX8XC8qTD4aRKfUDNCh+YQKjfZkJPRfodLtLdtAEaK8huvWqYo0MFHW z38+X4W6IPri5hn/qh355HaQotgzLjd1Px5PQY457EvLO/K7KgQgf5ITKmm9mdyzLLdn VIEkJLUYKOkCsycJrl72rIFkj/HjwCsVTIwGghKYzUKB3IYHo+6DYD+O8BOStuXcbykL rV9ZqeG61/lbiXY39Oq7If/dOepadT8CMtOVc7kj5bdDGczqlTyQxGVMfQuuNrleBGcj VUOQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=B2kr/hTdmjldnfEIS8tfk2j2s4kyfbekwwhpNxKT6CM=; b=0uluQB9GSW/klpJTeJeDUClJTiA4903R3/9C5pf39Ne+cD+iwt9Q+/z9U/NPlXm9a8 krYR8kNjJhi3drK9v+/cMovblO9pbpCs7ma1F4/+Sh/A/w2RfNVS5m+rse89y7Jwg/IJ vZBBtjbFYSndqo7GaFivyDuEqPYslHzg9K3jWPREhI5aX0xm38Zvi7T9TAqoQXduBNz4 6pmoSBgyc7tCr27PBamK6ME2XhxYi/oV4q+FjykKYobKKzJx+os3HRTVzq89TNwnOme3 66KSA3qu5bYR7Q/1sbSY6/1VqktWB57BHv+RV9jCdKZoe8YcOKwLr98/G3vMfdwSIBl4 QOwA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=bEGiIepp; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=B2kr/hTdmjldnfEIS8tfk2j2s4kyfbekwwhpNxKT6CM=; b=gIVcWR9uTJ7+HgFkRlQ4iXXtzK8sbVerVyafwwqYBZB7/hU7wGvXiQRaM1AUJHmqNo MtzCC+OPsdtznGijnbvhJm74rb8AgzsIzYyPkROZ2VU0FZ9nH5XHwEkcMXlUTaIYn7zt CcCFquX1zrdDW29nhgpxdvzQ0jwkjEQhKBq8o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=B2kr/hTdmjldnfEIS8tfk2j2s4kyfbekwwhpNxKT6CM=; b=O6Ie2/czUp8n2p0LJNiTR5aOvdol2cVgfrC5I3fDJXGeKm54J5ZDbBSl1X5LxnIEE/ UHTHndsn+BLrtAngdDmBbOOQ/8y5N5tUwhhQWEANwV641iEcL4RarkI61nVal1XaJ146 VXcTND3AiigOVF4pEtmFXSZXI7QxNP6M8+iSUX1pEIJoouyoe8GW0LY2hZTCsyvq7i6+ RW6Lm6bYbhJURCbW+sZyxUOlXVWbbJLwaxwelgabVDGvNwKcfT3j+Kes+glpZzBOI08Q GlWlPnzGa3/EN4PgtN3jj7LXYS+wDdM/PNKOZ+l5Jx9rXuv4LcOqMbyPKtSd7C/0/Fho jqsg== X-Gm-Message-State: AOAM5311JRmzX5+x3hdWWEifIrz3TXpGouL+a/PIrKFGaLoLHK9P8gV0 cbm8aXlRn7FAijttGayEpu98bm30 X-Google-Smtp-Source: ABdhPJyKd/oRaXITwneZ7tGKi/8nuGeOv/oxjKK2NP1y8KvJhE3bVVXxxx311FPWEdJEww1Aag+t7A== X-Received: by 2002:a17:902:fe8d:: with SMTP id x13mr32513833plm.198.1590480301210; Tue, 26 May 2020 01:05:01 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:9638:: with SMTP id r24ls3683126pfg.3.gmail; Tue, 26 May 2020 01:05:00 -0700 (PDT) X-Received: by 2002:a63:ab0b:: with SMTP id p11mr19402010pgf.278.1590480300733; Tue, 26 May 2020 01:05:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590480300; cv=none; d=google.com; s=arc-20160816; b=O2kWmuvaQnv6YPijVitRDMUZDcMz6kv/9KtByDtqMmCMbiCic9997YQq4IcV8XTY8D XdwR61100+NMKAS/H5MU80sOe2F/h1RZwyI18rlAKJghp4ePqLKJwFEHt53RMK57vCRL CW0qgyxFSaty56042KlaKojEP9N+c7lhNUGYLzCgcwZnPrUHyGFF0eXiqE+lqnzy0EIr DJlTldEv7J9odPPD28i11y4gqiuGXwgg6Mb37G2SEqDnzsAwN1WI+MbiS9grSw7djdZO s7b0nZE5uyfDsf4an1GXNzMIdSVdPlLpalViSEQhsvGOJZbvY2iUGVmf6tZpYoK/+x9n CLtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=5Nm0eF0dA9bJ6VTlBhFILrJggjJvdbTspnxw67TrO54=; b=v+KctNifu60p9+P1K2D9/J0uF1qNVxUOSCVrKdu8Afo+FdXMySyjgUiO80YMeSvqHu KlnAZMtgzzclKNIeLiWChlCVWZ60bfM7wEflswLxT4VCKLFO7bxvhIDw1aJI8kNADB7Z pZR4b1gpaa5yKJRlW+dmzJFzBGdgLcB1K5qZW6nvMmw2Ahyop0SOH+iPZXrGVo0M17MC EfDIue9wP4jqfVDfxZlGSAImafOnTWuVIc0KFjLYZILhHC2KVTmO7FtBlCIvbDUEZ5Ul Da2EEtUoeqMOJmrXMxlph6f0xbFi/mN2Yfb+Eqcq4+62TFwIpXqRW7mCzuw+pknwlxU2 Y1AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=bEGiIepp; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id z19sor24037604pgk.11.2020.05.26.01.05.00 for (Google Transport Security); Tue, 26 May 2020 01:05:00 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a63:7412:: with SMTP id p18mr23706409pgc.308.1590480300479; Tue, 26 May 2020 01:05:00 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:3:4404:74c7:87fd]) by smtp.gmail.com with ESMTPSA id d8sm14560782pfq.123.2020.05.26.01.04.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 May 2020 01:04:59 -0700 (PDT) From: Jagan Teki To: Simon Glass , Tom Rini Cc: u-boot@lists.denx.de, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH 7/9] spi: mxs: Code cleanup Date: Tue, 26 May 2020 13:34:28 +0530 Message-Id: <20200526080430.118262-8-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200526080430.118262-1-jagan@amarulasolutions.com> References: <20200526080430.118262-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=bEGiIepp; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Order the macros, private structures and simple functions in a proper way to have more code readability. No functionality changed. Signed-off-by: Jagan Teki --- drivers/spi/mxs_spi.c | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/drivers/spi/mxs_spi.c b/drivers/spi/mxs_spi.c index a21419a15a..e231e96e58 100644 --- a/drivers/spi/mxs_spi.c +++ b/drivers/spi/mxs_spi.c @@ -13,7 +13,10 @@ */ #include +#include +#include #include +#include #include #include #include @@ -34,21 +37,9 @@ #define MXSSSP_SMALL_TRANSFER 512 -static void mxs_spi_start_xfer(struct mxs_ssp_regs *ssp_regs) -{ - writel(SSP_CTRL0_LOCK_CS, &ssp_regs->hw_ssp_ctrl0_set); - writel(SSP_CTRL0_IGNORE_CRC, &ssp_regs->hw_ssp_ctrl0_clr); -} - -static void mxs_spi_end_xfer(struct mxs_ssp_regs *ssp_regs) -{ - writel(SSP_CTRL0_LOCK_CS, &ssp_regs->hw_ssp_ctrl0_clr); - writel(SSP_CTRL0_IGNORE_CRC, &ssp_regs->hw_ssp_ctrl0_set); -} - -#include -#include -#include +/* Base numbers of i.MX2[38] clk for ssp0 IP block */ +#define MXS_SSP_IMX23_CLKID_SSP0 33 +#define MXS_SSP_IMX28_CLKID_SSP0 46 #ifdef CONFIG_MX28 #define dtd_fsl_imx_spi dtd_fsl_imx28_spi @@ -75,6 +66,18 @@ struct mxs_spi_priv { unsigned int mode; }; +static void mxs_spi_start_xfer(struct mxs_ssp_regs *ssp_regs) +{ + writel(SSP_CTRL0_LOCK_CS, &ssp_regs->hw_ssp_ctrl0_set); + writel(SSP_CTRL0_IGNORE_CRC, &ssp_regs->hw_ssp_ctrl0_clr); +} + +static void mxs_spi_end_xfer(struct mxs_ssp_regs *ssp_regs) +{ + writel(SSP_CTRL0_LOCK_CS, &ssp_regs->hw_ssp_ctrl0_clr); + writel(SSP_CTRL0_IGNORE_CRC, &ssp_regs->hw_ssp_ctrl0_set); +} + static int mxs_spi_xfer_pio(struct mxs_spi_priv *priv, char *data, int length, int write, unsigned long flags) @@ -312,10 +315,6 @@ int mxs_spi_xfer(struct udevice *dev, unsigned int bitlen, } } -/* Base numbers of i.MX2[38] clk for ssp0 IP block */ -#define MXS_SSP_IMX23_CLKID_SSP0 33 -#define MXS_SSP_IMX28_CLKID_SSP0 46 - static int mxs_spi_probe(struct udevice *bus) { struct mxs_spi_platdata *plat = dev_get_platdata(bus);