From patchwork Sun Apr 28 20:28:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 322 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 283733F08F for ; Sun, 28 Apr 2019 22:29:22 +0200 (CEST) Received: by mail-pf1-f198.google.com with SMTP id f7sf6119480pfd.7 for ; Sun, 28 Apr 2019 13:29:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1556483361; cv=pass; d=google.com; s=arc-20160816; b=fFEW86+Zhm7k3qmofVvBh2ZX0Q1dLVmWtKGMrwejru1w7vrfiNb53dVapdJ6XqtNMk z2u3ADPIP1tODxCsqbN6sb2x6g0hDS6U0ywRufRIhPjd2CjuWAakIJ9dLRSgbhJ+Mgmz 3GlsA60SAu+9yZFByrU1sb80XG0sDR9c/y7FTbka+GEuE+V2LaipS30nG16/CnC8YZez 62B0qVJ4g/77sg45L8dOyG1wH6BaQ6FMYS7Y2QnCDKi9od295j/gMUiiyjiPM/F3zJXs Dvy/HFIXsTNjHH5/mpWi/+U1FaInWw53CNUMroetmwSNH/KIcyHW41bovIr2ymM7Ff0L 8Sfw== 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=geinYyYYsNoCs/KSfmpDUc3iHLrK1kor8kD4YBxhmao=; b=L71wuZDvc0XCXk0djNdhNFdxZ6T5pSpgKsmqIId1e9D8xM17y//DgFzWryY9CSgFJ3 cLqGJjF3NajzBXv+Cp4bVbVo8Jo9FsshYOn7RNoKMAlbimICyUOIQFGb3lBRNQLcG9le oqDbjH0Mj7fBruf7aCDU6JDT2wH7GPA0b7m8iVTvj6e9usPHWKDl70bsVPMkeVkOR96M rO25BMujT2lmSVEQQrG34FBs37aaafiGqopHuYBXku7MvUpjLl8g2dd5L70fWKFzDcej /jNYl7HA8/L/xNPARDwgFUzph+BpR8PHPQ9A5/XgfB1ULUNn542LRI7fvGJydPjIwnyD IOKQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=p0VCetkn; 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=geinYyYYsNoCs/KSfmpDUc3iHLrK1kor8kD4YBxhmao=; b=VErl+vfmAMyY1aqLEszpAHGMwtve9ohUcfbht4Q/hXF/o1+keNLEbz64rnbX4Z/VBF HJwLFdbttUWiJ31p9ARLDn+JAoTKYfBtM3lA+Hnbhx1seLl9kTYpYL8+5sBECLpLG4c+ WhrAj/1RHwa6LvWmeLAZu9TZc90T0jibNWYyA= 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=geinYyYYsNoCs/KSfmpDUc3iHLrK1kor8kD4YBxhmao=; b=fOp9zHM1gqYA4+pzHe1D0n89WfBL0Lh5BDaM5ijhpO2iiMsGvMIsq2HX72HTcwXCSt 2z2Bag4rhbqEYosXZcz3KM6XYfZUbx93A6cYkypNi7zDDg/1WqseC56yPNZzHGvvxakG 1bbfE7s7XVZWdO+p9wJdEDdRz0vPyHZgO1m7eoilgJfsWVefoihoNKvpLDXkssjsWTCX zo8GD9Zj+NQFcfGmcfhaGm9fjt1+55a3agh5jURuDraY7DXnyzTbq/15YpMQ26wrdY8y 20zbbo07LBXxQZQwvLbaaF9Tscd/vJayn/M3kXwzff+tMpS+H4/ZP1q486PNikju3byx A0hQ== X-Gm-Message-State: APjAAAW74cnbw7t1PR+rLJdGVP82OYZkTaIf8jvA+/ky31lzUOjHzfUr BScwXFBWkDj7jhrR64Qo8frN9lDO X-Google-Smtp-Source: APXvYqx1rY89J6Y0eeZ1yl1p4yr6ox7oQ8M+ZAFz1+NyQ2FjUDiWeLlUJw+7HONCfbs/3x+yC9iWNg== X-Received: by 2002:a17:902:8f82:: with SMTP id z2mr5226132plo.51.1556483360997; Sun, 28 Apr 2019 13:29:20 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:8a82:: with SMTP id a2ls401233pfc.13.gmail; Sun, 28 Apr 2019 13:29:20 -0700 (PDT) X-Received: by 2002:a63:5466:: with SMTP id e38mr56363805pgm.340.1556483360600; Sun, 28 Apr 2019 13:29:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556483360; cv=none; d=google.com; s=arc-20160816; b=c4J0uUnvFMPYYQHcvyJVtOnvVUkp4DyQ+rFAveiLYVumlDnpk7Pbd+MFao8xbot9v5 v5FWhoeGGWvJLrUnOzfVbOABA0o+6n8hjD77Z52J2j7ODVnurBtowk5fg20jRRvau2n2 /wDQcfRwX2rVmDp3W25fSvaWOcWF9gelVwdA9LqydehWw4XFarm95pmlrn9ejI6vS3IV ogM4Dd8Xpo/J+UkLlx+xDRH8+A25eXaSyI/tdqLY9S/ZcO1GD5GlTrUbmWSlhrY5uiaB TNeN87UjiwODJJv8yIQzcjsHV2zY5AAtqsFfPu23N7OuvZxf+YFr+fIFds9AMYmAuaCB BI4A== 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=nSqHcrr6BR1bt08FkCONc5tzPnqtk3OYZmvPa2WM1jw=; b=0hkpjhqTLHOIsMrV3g86Ge20xfAZNQSud4dJMt/KNs2pkiaXMFinL4O9wSkzt8+9Wy ntJoGKwxKM5uTK8uqpCbS/j3ihzZaoBwEiPt5NKvk1ftVxtcfBCLhg2uOdbt8ZAt+sVx A2m0crTi5qyWRId/a0tLElVXT9A6ki03wwm0XD/BMrK+eAJdVZbcc+lLWGf7P07OAoj5 vBJNu6fgiszcGK3LSTykkNQse+pxT7Q5qnu8NmEWf9YKObna5hXrrYzzd2D8AgtaGiyn Lq3j21A0DqATSSKtuen+wtd6nrofZozG9DCCmPNftS+CryzXHW/8pYof7AdTGC0IjA+v mtzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=p0VCetkn; 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 186sor35625886pff.48.2019.04.28.13.29.20 for (Google Transport Security); Sun, 28 Apr 2019 13:29:20 -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:a62:6a81:: with SMTP id f123mr60400771pfc.40.1556483360309; Sun, 28 Apr 2019 13:29:20 -0700 (PDT) Received: from localhost.localdomain ([115.97.185.144]) by smtp.gmail.com with ESMTPSA id x66sm68841439pfb.78.2019.04.28.13.29.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Apr 2019 13:29:19 -0700 (PDT) From: Jagan Teki To: Heiko Schocher , Tom Rini Cc: u-boot@lists.denx.de, linux-amarula@amarulasolutions.com, Mario Six Subject: [PATCH v2 06/19] spi: mpc8xxx: Replace defines with enums Date: Mon, 29 Apr 2019 01:58:41 +0530 Message-Id: <20190428202854.8590-7-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190428202854.8590-1-jagan@amarulasolutions.com> References: <20190428202854.8590-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=p0VCetkn; 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: , From: Mario Six Replace pre-processor defines with proper enums, and use the BIT macro where applicable. Signed-off-by: Mario Six --- drivers/spi/mpc8xxx_spi.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/spi/mpc8xxx_spi.c b/drivers/spi/mpc8xxx_spi.c index 91b639f1e6..7b2ab1e4af 100644 --- a/drivers/spi/mpc8xxx_spi.c +++ b/drivers/spi/mpc8xxx_spi.c @@ -10,13 +10,25 @@ #include #include -#define SPI_EV_NE (0x80000000 >> 22) /* Receiver Not Empty */ -#define SPI_EV_NF (0x80000000 >> 23) /* Transmitter Not Full */ - -#define SPI_MODE_LOOP (0x80000000 >> 1) /* Loopback mode */ -#define SPI_MODE_REV (0x80000000 >> 5) /* Reverse mode - MSB first */ -#define SPI_MODE_MS (0x80000000 >> 6) /* Always master */ -#define SPI_MODE_EN (0x80000000 >> 7) /* Enable interface */ +enum { + SPI_EV_NE = BIT(31 - 22), /* Receiver Not Empty */ + SPI_EV_NF = BIT(31 - 23), /* Transmitter Not Full */ +}; + +enum { + SPI_MODE_LOOP = BIT(31 - 1), /* Loopback mode */ + SPI_MODE_CI = BIT(31 - 2), /* Clock invert */ + SPI_MODE_CP = BIT(31 - 3), /* Clock phase */ + SPI_MODE_DIV16 = BIT(31 - 4), /* Divide clock source by 16 */ + SPI_MODE_REV = BIT(31 - 5), /* Reverse mode - MSB first */ + SPI_MODE_MS = BIT(31 - 6), /* Always master */ + SPI_MODE_EN = BIT(31 - 7), /* Enable interface */ + + SPI_MODE_LEN_MASK = 0xf00000, + SPI_MODE_PM_MASK = 0xf0000, + + SPI_COM_LST = BIT(31 - 9), +}; #define SPI_TIMEOUT 1000