From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: patches-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
"Uwe Kleine-König"
<u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
"Sascha Hauer" <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH v2 3/7] spi/imx: do not use spi_imx2_3 to name SPI_IMX_VER_2_3 function and macro
Date: Thu, 14 Jul 2011 20:53:45 -0600 [thread overview]
Message-ID: <20110715025345.GS2927@ponder.secretlab.ca> (raw)
In-Reply-To: <1310231801-18761-4-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
On Sun, Jul 10, 2011 at 01:16:37AM +0800, Shawn Guo wrote:
> It's confusing to use spi_imx2_3 to name SPI_IMX_VER_2_3 function
> and macro, as it easily make people think of imx2 and imx3. It's
> better to use specific soc name just like what other SPI_IMX_VER
> do. For SPI_IMX_VER_2_3 case, it will be mx51. To distinguish it
> from CSPI on mx51, mx51_ecspi might be a good choice.
>
> Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Cc: Uwe Kleine-König <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Cc: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Cc: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Applied, thanks.
g.
> ---
> drivers/spi/spi-imx.c | 107 +++++++++++++++++++++++++------------------------
> 1 files changed, 54 insertions(+), 53 deletions(-)
>
> diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
> index ad928b1..052959df 100644
> --- a/drivers/spi/spi-imx.c
> +++ b/drivers/spi/spi-imx.c
> @@ -171,30 +171,30 @@ static unsigned int spi_imx_clkdiv_2(unsigned int fin,
> return 7;
> }
>
> -#define SPI_IMX2_3_CTRL 0x08
> -#define SPI_IMX2_3_CTRL_ENABLE (1 << 0)
> -#define SPI_IMX2_3_CTRL_XCH (1 << 2)
> -#define SPI_IMX2_3_CTRL_MODE_MASK (0xf << 4)
> -#define SPI_IMX2_3_CTRL_POSTDIV_OFFSET 8
> -#define SPI_IMX2_3_CTRL_PREDIV_OFFSET 12
> -#define SPI_IMX2_3_CTRL_CS(cs) ((cs) << 18)
> -#define SPI_IMX2_3_CTRL_BL_OFFSET 20
> -
> -#define SPI_IMX2_3_CONFIG 0x0c
> -#define SPI_IMX2_3_CONFIG_SCLKPHA(cs) (1 << ((cs) + 0))
> -#define SPI_IMX2_3_CONFIG_SCLKPOL(cs) (1 << ((cs) + 4))
> -#define SPI_IMX2_3_CONFIG_SBBCTRL(cs) (1 << ((cs) + 8))
> -#define SPI_IMX2_3_CONFIG_SSBPOL(cs) (1 << ((cs) + 12))
> -
> -#define SPI_IMX2_3_INT 0x10
> -#define SPI_IMX2_3_INT_TEEN (1 << 0)
> -#define SPI_IMX2_3_INT_RREN (1 << 3)
> -
> -#define SPI_IMX2_3_STAT 0x18
> -#define SPI_IMX2_3_STAT_RR (1 << 3)
> +#define MX51_ECSPI_CTRL 0x08
> +#define MX51_ECSPI_CTRL_ENABLE (1 << 0)
> +#define MX51_ECSPI_CTRL_XCH (1 << 2)
> +#define MX51_ECSPI_CTRL_MODE_MASK (0xf << 4)
> +#define MX51_ECSPI_CTRL_POSTDIV_OFFSET 8
> +#define MX51_ECSPI_CTRL_PREDIV_OFFSET 12
> +#define MX51_ECSPI_CTRL_CS(cs) ((cs) << 18)
> +#define MX51_ECSPI_CTRL_BL_OFFSET 20
> +
> +#define MX51_ECSPI_CONFIG 0x0c
> +#define MX51_ECSPI_CONFIG_SCLKPHA(cs) (1 << ((cs) + 0))
> +#define MX51_ECSPI_CONFIG_SCLKPOL(cs) (1 << ((cs) + 4))
> +#define MX51_ECSPI_CONFIG_SBBCTRL(cs) (1 << ((cs) + 8))
> +#define MX51_ECSPI_CONFIG_SSBPOL(cs) (1 << ((cs) + 12))
> +
> +#define MX51_ECSPI_INT 0x10
> +#define MX51_ECSPI_INT_TEEN (1 << 0)
> +#define MX51_ECSPI_INT_RREN (1 << 3)
> +
> +#define MX51_ECSPI_STAT 0x18
> +#define MX51_ECSPI_STAT_RR (1 << 3)
>
> /* MX51 eCSPI */
> -static unsigned int spi_imx2_3_clkdiv(unsigned int fin, unsigned int fspi)
> +static unsigned int mx51_ecspi_clkdiv(unsigned int fin, unsigned int fspi)
> {
> /*
> * there are two 4-bit dividers, the pre-divider divides by
> @@ -222,36 +222,37 @@ static unsigned int spi_imx2_3_clkdiv(unsigned int fin, unsigned int fspi)
>
> pr_debug("%s: fin: %u, fspi: %u, post: %u, pre: %u\n",
> __func__, fin, fspi, post, pre);
> - return (pre << SPI_IMX2_3_CTRL_PREDIV_OFFSET) |
> - (post << SPI_IMX2_3_CTRL_POSTDIV_OFFSET);
> + return (pre << MX51_ECSPI_CTRL_PREDIV_OFFSET) |
> + (post << MX51_ECSPI_CTRL_POSTDIV_OFFSET);
> }
>
> -static void __maybe_unused spi_imx2_3_intctrl(struct spi_imx_data *spi_imx, int enable)
> +static void __maybe_unused
> +mx51_ecspi_intctrl(struct spi_imx_data *spi_imx, int enable)
> {
> unsigned val = 0;
>
> if (enable & MXC_INT_TE)
> - val |= SPI_IMX2_3_INT_TEEN;
> + val |= MX51_ECSPI_INT_TEEN;
>
> if (enable & MXC_INT_RR)
> - val |= SPI_IMX2_3_INT_RREN;
> + val |= MX51_ECSPI_INT_RREN;
>
> - writel(val, spi_imx->base + SPI_IMX2_3_INT);
> + writel(val, spi_imx->base + MX51_ECSPI_INT);
> }
>
> -static void __maybe_unused spi_imx2_3_trigger(struct spi_imx_data *spi_imx)
> +static void __maybe_unused mx51_ecspi_trigger(struct spi_imx_data *spi_imx)
> {
> u32 reg;
>
> - reg = readl(spi_imx->base + SPI_IMX2_3_CTRL);
> - reg |= SPI_IMX2_3_CTRL_XCH;
> - writel(reg, spi_imx->base + SPI_IMX2_3_CTRL);
> + reg = readl(spi_imx->base + MX51_ECSPI_CTRL);
> + reg |= MX51_ECSPI_CTRL_XCH;
> + writel(reg, spi_imx->base + MX51_ECSPI_CTRL);
> }
>
> -static int __maybe_unused spi_imx2_3_config(struct spi_imx_data *spi_imx,
> +static int __maybe_unused mx51_ecspi_config(struct spi_imx_data *spi_imx,
> struct spi_imx_config *config)
> {
> - u32 ctrl = SPI_IMX2_3_CTRL_ENABLE, cfg = 0;
> + u32 ctrl = MX51_ECSPI_CTRL_ENABLE, cfg = 0;
>
> /*
> * The hardware seems to have a race condition when changing modes. The
> @@ -260,42 +261,42 @@ static int __maybe_unused spi_imx2_3_config(struct spi_imx_data *spi_imx,
> * the same time.
> * So set master mode for all channels as we do not support slave mode.
> */
> - ctrl |= SPI_IMX2_3_CTRL_MODE_MASK;
> + ctrl |= MX51_ECSPI_CTRL_MODE_MASK;
>
> /* set clock speed */
> - ctrl |= spi_imx2_3_clkdiv(spi_imx->spi_clk, config->speed_hz);
> + ctrl |= mx51_ecspi_clkdiv(spi_imx->spi_clk, config->speed_hz);
>
> /* set chip select to use */
> - ctrl |= SPI_IMX2_3_CTRL_CS(config->cs);
> + ctrl |= MX51_ECSPI_CTRL_CS(config->cs);
>
> - ctrl |= (config->bpw - 1) << SPI_IMX2_3_CTRL_BL_OFFSET;
> + ctrl |= (config->bpw - 1) << MX51_ECSPI_CTRL_BL_OFFSET;
>
> - cfg |= SPI_IMX2_3_CONFIG_SBBCTRL(config->cs);
> + cfg |= MX51_ECSPI_CONFIG_SBBCTRL(config->cs);
>
> if (config->mode & SPI_CPHA)
> - cfg |= SPI_IMX2_3_CONFIG_SCLKPHA(config->cs);
> + cfg |= MX51_ECSPI_CONFIG_SCLKPHA(config->cs);
>
> if (config->mode & SPI_CPOL)
> - cfg |= SPI_IMX2_3_CONFIG_SCLKPOL(config->cs);
> + cfg |= MX51_ECSPI_CONFIG_SCLKPOL(config->cs);
>
> if (config->mode & SPI_CS_HIGH)
> - cfg |= SPI_IMX2_3_CONFIG_SSBPOL(config->cs);
> + cfg |= MX51_ECSPI_CONFIG_SSBPOL(config->cs);
>
> - writel(ctrl, spi_imx->base + SPI_IMX2_3_CTRL);
> - writel(cfg, spi_imx->base + SPI_IMX2_3_CONFIG);
> + writel(ctrl, spi_imx->base + MX51_ECSPI_CTRL);
> + writel(cfg, spi_imx->base + MX51_ECSPI_CONFIG);
>
> return 0;
> }
>
> -static int __maybe_unused spi_imx2_3_rx_available(struct spi_imx_data *spi_imx)
> +static int __maybe_unused mx51_ecspi_rx_available(struct spi_imx_data *spi_imx)
> {
> - return readl(spi_imx->base + SPI_IMX2_3_STAT) & SPI_IMX2_3_STAT_RR;
> + return readl(spi_imx->base + MX51_ECSPI_STAT) & MX51_ECSPI_STAT_RR;
> }
>
> -static void __maybe_unused spi_imx2_3_reset(struct spi_imx_data *spi_imx)
> +static void __maybe_unused mx51_ecspi_reset(struct spi_imx_data *spi_imx)
> {
> /* drain receive buffer */
> - while (spi_imx2_3_rx_available(spi_imx))
> + while (mx51_ecspi_rx_available(spi_imx))
> readl(spi_imx->base + MXC_CSPIRXDATA);
> }
>
> @@ -583,11 +584,11 @@ static struct spi_imx_devtype_data spi_imx_devtype_data[] = {
> #endif
> #ifdef CONFIG_SPI_IMX_VER_2_3
> [SPI_IMX_VER_2_3] = {
> - .intctrl = spi_imx2_3_intctrl,
> - .config = spi_imx2_3_config,
> - .trigger = spi_imx2_3_trigger,
> - .rx_available = spi_imx2_3_rx_available,
> - .reset = spi_imx2_3_reset,
> + .intctrl = mx51_ecspi_intctrl,
> + .config = mx51_ecspi_config,
> + .trigger = mx51_ecspi_trigger,
> + .rx_available = mx51_ecspi_rx_available,
> + .reset = mx51_ecspi_reset,
> .fifosize = 64,
> },
> #endif
> --
> 1.7.4.1
>
------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric
Ries, the creator of the Lean Startup Methodology on "Lean Startup
Secrets Revealed." This video shows you how to validate your ideas,
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
next prev parent reply other threads:[~2011-07-15 2:53 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-09 17:16 [PATCH v2 0/7] Add device tree support for imx spi driver Shawn Guo
[not found] ` <1310231801-18761-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-07-09 17:16 ` [PATCH v2 1/7] spi/imx: do not make copy of spi_imx_devtype_data Shawn Guo
2011-07-11 7:15 ` Lothar Waßmann
[not found] ` <19994.41750.920408.162356-VjFSrY7JcPWvSplVBqRQBQ@public.gmane.org>
2011-07-11 7:31 ` Uwe Kleine-König
2011-07-11 7:49 ` Lothar Waßmann
2011-07-11 7:35 ` Shawn Guo
[not found] ` <20110711073523.GA19105-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2011-07-11 7:32 ` Lothar Waßmann
[not found] ` <1310231801-18761-2-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-07-15 2:53 ` Grant Likely
2011-07-09 17:16 ` [PATCH v2 2/7] spi/imx: use mx21 to name SPI_IMX_VER_0_0 function and macro Shawn Guo
[not found] ` <1310231801-18761-3-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-07-11 7:35 ` Uwe Kleine-König
[not found] ` <20110711073523.GB13840-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2011-07-15 2:53 ` Grant Likely
2011-07-09 17:16 ` [PATCH v2 3/7] spi/imx: do not use spi_imx2_3 to name SPI_IMX_VER_2_3 " Shawn Guo
[not found] ` <1310231801-18761-4-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-07-15 2:53 ` Grant Likely [this message]
2011-07-09 17:16 ` [PATCH v2 4/7] spi/imx: merge type SPI_IMX_VER_0_7 into SPI_IMX_VER_0_4 Shawn Guo
[not found] ` <1310231801-18761-5-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-07-11 7:38 ` Uwe Kleine-König
2011-07-09 17:16 ` [PATCH v2 5/7] spi/imx: use soc name in spi device type naming scheme Shawn Guo
[not found] ` <1310231801-18761-6-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-07-15 2:53 ` Grant Likely
2011-07-09 17:16 ` [PATCH v2 6/7] spi/imx: copy gpio number passed by platform data into driver private data Shawn Guo
[not found] ` <1310231801-18761-7-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-07-11 7:45 ` Uwe Kleine-König
2011-07-09 17:16 ` [PATCH v2 7/7] spi/imx: add device tree probe support Shawn Guo
[not found] ` <1310231801-18761-8-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-07-15 2:53 ` Grant Likely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110715025345.GS2927@ponder.secretlab.ca \
--to=grant.likely-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=patches-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
--cc=shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).