From: Michal Suchanek <hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> To: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org, Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>, Pawel Moll <pawel.moll-5wv7dgnIgG8@public.gmane.org>, Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>, Ian Campbell <ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org>, Kumar Gala <galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>, Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>, Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>, Russell King <linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org>, Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>, Michal Suchanek <hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>, Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>, Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>, Krzysztof Kozlowski <k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>, Javier Martinez Canillas <javier-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>, Simon Horman <horms+renesas-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>, Sjoerd Simons <sjoerd.simons-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org>, Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>, Alison Wang <b18965-KZfg59tc24xl57MIdRCFDg@public.gmane.org>, Timo Sigurdsson <public_timo.s-fWgRPtSzPNU3WX+qO2AYSQ@public.gmane.org>, Jonathan Liu <net147-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>, Gerhard Bertelsmann <info-La43T0Mi4bH5xCKuJOYmCvaTkwRoYoCU@public.gmane.org>, Pri Subject: [PATCH v3 08/13] spi: sunxi: synchronize whitespace, comments, struct Date: 13 Jun 2016 17:46:51 -0000 [thread overview] Message-ID: <96b6a34fb7bb60376928e1c92de56c19277abd51.1465490774.git.hramrach@gmail.com> (raw) In-Reply-To: <cover.1465490774.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Minimize differences between sun4i and sun6i driver without code changes. Signed-off-by: Michal Suchanek <hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- drivers/spi/spi-sun4i.c | 11 ++++++----- drivers/spi/spi-sun6i.c | 8 +++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/spi/spi-sun4i.c b/drivers/spi/spi-sun4i.c index b7f8de1..bbb0996 100644 --- a/drivers/spi/spi-sun4i.c +++ b/drivers/spi/spi-sun4i.c @@ -19,6 +19,7 @@ #include <linux/module.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> +#include <linux/reset.h> #include <linux/spi/spi.h> @@ -56,7 +57,7 @@ #define SUNXI_CLK_CTL_REG 0x1c #define SUNXI_CLK_CTL_CDR2_MASK 0xff -#define SUNXI_CLK_CTL_CDR2(div) ((div) & SUNXI_CLK_CTL_CDR2_MASK) +#define SUNXI_CLK_CTL_CDR2(div) (((div) & SUNXI_CLK_CTL_CDR2_MASK) << 0) #define SUNXI_CLK_CTL_CDR1_MASK 0xf #define SUNXI_CLK_CTL_CDR1(div) (((div) & SUNXI_CLK_CTL_CDR1_MASK) << 8) #define SUNXI_CLK_CTL_DRS BIT(12) @@ -78,6 +79,7 @@ struct sunxi_spi { void __iomem *base_addr; struct clk *hclk; struct clk *mclk; + struct reset_control *rstc; struct completion done; @@ -136,7 +138,6 @@ static void sunxi_spi_set_cs(struct spi_device *spi, bool enable) u32 reg; reg = sunxi_spi_read(sspi, SUNXI_TFR_CTL_REG); - reg &= ~SUNXI_TFR_CTL_CS_MASK; reg |= SUNXI_TFR_CTL_CS(spi->chip_select); @@ -198,7 +199,6 @@ static int sunxi_spi_transfer_one(struct spi_master *master, /* Clear pending interrupts */ sunxi_spi_write(sspi, SUNXI_INT_STA_REG, ~0); - reg = sunxi_spi_read(sspi, SUNXI_TFR_CTL_REG); /* Reset FIFOs */ @@ -224,7 +224,6 @@ static int sunxi_spi_transfer_one(struct spi_master *master, else reg &= ~SUNXI_TFR_CTL_FBS; - /* * If it's a TX only transfer, we don't want to fill the RX * FIFO with bogus data @@ -248,7 +247,7 @@ static int sunxi_spi_transfer_one(struct spi_master *master, * * We have two choices there. Either we can use the clock * divide rate 1, which is calculated thanks to this formula: - * SPI_CLK = MOD_CLK / (2 ^ (cdr + 1)) + * SPI_CLK = MOD_CLK / (2 ^ cdr) * Or we can use CDR2, which is calculated with the formula: * SPI_CLK = MOD_CLK / (2 * (cdr + 1)) * Wether we use the former or the latter is set through the @@ -352,6 +351,8 @@ static int sunxi_spi_runtime_resume(struct device *dev) return 0; +err2: + clk_disable_unprepare(sspi->mclk); err: clk_disable_unprepare(sspi->hclk); out: diff --git a/drivers/spi/spi-sun6i.c b/drivers/spi/spi-sun6i.c index f26b52a..d14a953 100644 --- a/drivers/spi/spi-sun6i.c +++ b/drivers/spi/spi-sun6i.c @@ -29,7 +29,6 @@ #define SUNXI_CTL_ENABLE BIT(0) #define SUNXI_CTL_MASTER BIT(1) #define SUNXI_CTL_TP BIT(7) -#define SUNXI_GBL_CTL_RST BIT(31) #define SUNXI_TFR_CTL_REG 0x08 #define SUNXI_TFR_CTL_CPHA BIT(0) @@ -44,7 +43,6 @@ #define SUNXI_TFR_CTL_XCH BIT(31) #define SUNXI_INT_CTL_REG 0x10 -#define SUNXI_INT_CTL_RF_OVF BIT(8) #define SUNXI_INT_CTL_TC BIT(12) #define SUNXI_INT_STA_REG 0x14 @@ -200,7 +198,9 @@ static int sunxi_spi_transfer_one(struct spi_master *master, /* Clear pending interrupts */ sunxi_spi_write(sspi, SUNXI_INT_STA_REG, ~0); - /* Reset FIFO */ + reg = sunxi_spi_read(sspi, SUNXI_TFR_CTL_REG); + + /* Reset FIFOs */ sunxi_spi_write(sspi, SUNXI_FIFO_CTL_REG, SUNXI_CTL_RF_RST | SUNXI_CTL_TF_RST); @@ -208,8 +208,6 @@ static int sunxi_spi_transfer_one(struct spi_master *master, * Setup the transfer control register: Chip Select, * polarities, etc. */ - reg = sunxi_spi_read(sspi, SUNXI_TFR_CTL_REG); - if (spi->mode & SPI_CPOL) reg |= SUNXI_TFR_CTL_CPOL; else -- 2.8.1
WARNING: multiple messages have this Message-ID (diff)
From: hramrach@gmail.com (Michal Suchanek) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 08/13] spi: sunxi: synchronize whitespace, comments, struct Date: 13 Jun 2016 17:46:51 -0000 [thread overview] Message-ID: <96b6a34fb7bb60376928e1c92de56c19277abd51.1465490774.git.hramrach@gmail.com> (raw) In-Reply-To: <cover.1465490774.git.hramrach@gmail.com> Minimize differences between sun4i and sun6i driver without code changes. Signed-off-by: Michal Suchanek <hramrach@gmail.com> --- drivers/spi/spi-sun4i.c | 11 ++++++----- drivers/spi/spi-sun6i.c | 8 +++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/spi/spi-sun4i.c b/drivers/spi/spi-sun4i.c index b7f8de1..bbb0996 100644 --- a/drivers/spi/spi-sun4i.c +++ b/drivers/spi/spi-sun4i.c @@ -19,6 +19,7 @@ #include <linux/module.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> +#include <linux/reset.h> #include <linux/spi/spi.h> @@ -56,7 +57,7 @@ #define SUNXI_CLK_CTL_REG 0x1c #define SUNXI_CLK_CTL_CDR2_MASK 0xff -#define SUNXI_CLK_CTL_CDR2(div) ((div) & SUNXI_CLK_CTL_CDR2_MASK) +#define SUNXI_CLK_CTL_CDR2(div) (((div) & SUNXI_CLK_CTL_CDR2_MASK) << 0) #define SUNXI_CLK_CTL_CDR1_MASK 0xf #define SUNXI_CLK_CTL_CDR1(div) (((div) & SUNXI_CLK_CTL_CDR1_MASK) << 8) #define SUNXI_CLK_CTL_DRS BIT(12) @@ -78,6 +79,7 @@ struct sunxi_spi { void __iomem *base_addr; struct clk *hclk; struct clk *mclk; + struct reset_control *rstc; struct completion done; @@ -136,7 +138,6 @@ static void sunxi_spi_set_cs(struct spi_device *spi, bool enable) u32 reg; reg = sunxi_spi_read(sspi, SUNXI_TFR_CTL_REG); - reg &= ~SUNXI_TFR_CTL_CS_MASK; reg |= SUNXI_TFR_CTL_CS(spi->chip_select); @@ -198,7 +199,6 @@ static int sunxi_spi_transfer_one(struct spi_master *master, /* Clear pending interrupts */ sunxi_spi_write(sspi, SUNXI_INT_STA_REG, ~0); - reg = sunxi_spi_read(sspi, SUNXI_TFR_CTL_REG); /* Reset FIFOs */ @@ -224,7 +224,6 @@ static int sunxi_spi_transfer_one(struct spi_master *master, else reg &= ~SUNXI_TFR_CTL_FBS; - /* * If it's a TX only transfer, we don't want to fill the RX * FIFO with bogus data @@ -248,7 +247,7 @@ static int sunxi_spi_transfer_one(struct spi_master *master, * * We have two choices there. Either we can use the clock * divide rate 1, which is calculated thanks to this formula: - * SPI_CLK = MOD_CLK / (2 ^ (cdr + 1)) + * SPI_CLK = MOD_CLK / (2 ^ cdr) * Or we can use CDR2, which is calculated with the formula: * SPI_CLK = MOD_CLK / (2 * (cdr + 1)) * Wether we use the former or the latter is set through the @@ -352,6 +351,8 @@ static int sunxi_spi_runtime_resume(struct device *dev) return 0; +err2: + clk_disable_unprepare(sspi->mclk); err: clk_disable_unprepare(sspi->hclk); out: diff --git a/drivers/spi/spi-sun6i.c b/drivers/spi/spi-sun6i.c index f26b52a..d14a953 100644 --- a/drivers/spi/spi-sun6i.c +++ b/drivers/spi/spi-sun6i.c @@ -29,7 +29,6 @@ #define SUNXI_CTL_ENABLE BIT(0) #define SUNXI_CTL_MASTER BIT(1) #define SUNXI_CTL_TP BIT(7) -#define SUNXI_GBL_CTL_RST BIT(31) #define SUNXI_TFR_CTL_REG 0x08 #define SUNXI_TFR_CTL_CPHA BIT(0) @@ -44,7 +43,6 @@ #define SUNXI_TFR_CTL_XCH BIT(31) #define SUNXI_INT_CTL_REG 0x10 -#define SUNXI_INT_CTL_RF_OVF BIT(8) #define SUNXI_INT_CTL_TC BIT(12) #define SUNXI_INT_STA_REG 0x14 @@ -200,7 +198,9 @@ static int sunxi_spi_transfer_one(struct spi_master *master, /* Clear pending interrupts */ sunxi_spi_write(sspi, SUNXI_INT_STA_REG, ~0); - /* Reset FIFO */ + reg = sunxi_spi_read(sspi, SUNXI_TFR_CTL_REG); + + /* Reset FIFOs */ sunxi_spi_write(sspi, SUNXI_FIFO_CTL_REG, SUNXI_CTL_RF_RST | SUNXI_CTL_TF_RST); @@ -208,8 +208,6 @@ static int sunxi_spi_transfer_one(struct spi_master *master, * Setup the transfer control register: Chip Select, * polarities, etc. */ - reg = sunxi_spi_read(sspi, SUNXI_TFR_CTL_REG); - if (spi->mode & SPI_CPOL) reg |= SUNXI_TFR_CTL_CPOL; else -- 2.8.1
next prev parent reply other threads:[~2016-06-13 17:46 UTC|newest] Thread overview: 121+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-06-13 17:46 [PATCH v3 00/13] sunxi spi fixes Michal Suchanek 2016-06-13 17:46 ` Michal Suchanek 2016-06-13 17:46 ` [PATCH v3 01/13] spi: sunxi: set maximum and minimum speed of SPI master Michal Suchanek 2016-06-13 17:46 ` Michal Suchanek 2016-06-13 19:55 ` Maxime Ripard 2016-06-13 19:55 ` Maxime Ripard 2016-06-13 19:55 ` Maxime Ripard 2016-06-13 17:46 ` [PATCH v3 04/13] spi: sunxi: expose maximum transfer size limit Michal Suchanek 2016-06-13 17:46 ` Michal Suchanek 2016-06-13 19:56 ` Maxime Ripard 2016-06-13 19:56 ` Maxime Ripard 2016-06-13 19:56 ` Maxime Ripard [not found] ` <cover.1465490774.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2016-06-13 17:46 ` [PATCH v3 03/13] spi: sun4i: fix FIFO limit Michal Suchanek 2016-06-13 17:46 ` Michal Suchanek 2016-06-13 19:56 ` Maxime Ripard 2016-06-13 19:56 ` Maxime Ripard 2016-06-13 19:56 ` Maxime Ripard 2016-06-13 17:46 ` [PATCH v3 02/13] spi: sunxi: fix transfer timeout Michal Suchanek 2016-06-13 17:46 ` Michal Suchanek 2016-06-13 19:55 ` Maxime Ripard 2016-06-13 19:55 ` Maxime Ripard 2016-06-13 19:55 ` Maxime Ripard 2016-06-13 17:46 ` [PATCH v3 06/13] spi: sunxi: rename sun4i,sun6i -> sunxi Michal Suchanek 2016-06-13 17:46 ` Michal Suchanek 2016-06-13 17:46 ` [PATCH v3 05/13] spi: sun6i: update CS handling from spi-sun4i Michal Suchanek 2016-06-13 17:46 ` Michal Suchanek 2016-06-13 17:46 ` Michal Suchanek [this message] 2016-06-13 17:46 ` [PATCH v3 08/13] spi: sunxi: synchronize whitespace, comments, struct Michal Suchanek 2016-06-13 17:46 ` [PATCH v3 09/13] spi: sunxi: use register map Michal Suchanek 2016-06-13 17:46 ` Michal Suchanek 2016-06-13 17:46 ` [PATCH v3 07/13] spi: sunxi: rename constants to match between sun4i and sun6i Michal Suchanek 2016-06-13 17:46 ` Michal Suchanek 2016-06-13 23:31 ` [linux-sunxi] " Julian Calaby 2016-06-13 23:31 ` Julian Calaby 2016-06-13 23:31 ` Julian Calaby 2016-06-13 23:31 ` Julian Calaby 2016-06-14 4:43 ` [linux-sunxi] " Michal Suchanek 2016-06-14 4:43 ` Michal Suchanek 2016-06-14 4:43 ` Michal Suchanek 2016-06-14 4:43 ` Michal Suchanek 2016-06-13 17:46 ` [PATCH v3 11/13] dt: spi: sun4i: merge sun4i and sun6i binding doc Michal Suchanek 2016-06-13 17:46 ` Michal Suchanek 2016-06-13 23:45 ` [linux-sunxi] " Julian Calaby 2016-06-13 23:45 ` Julian Calaby 2016-06-13 23:45 ` Julian Calaby 2016-06-13 23:45 ` Julian Calaby 2016-06-14 4:40 ` [linux-sunxi] " Michal Suchanek 2016-06-14 4:40 ` Michal Suchanek 2016-06-14 4:40 ` Michal Suchanek 2016-06-14 4:40 ` Michal Suchanek 2016-06-14 4:48 ` [linux-sunxi] " Julian Calaby 2016-06-14 4:48 ` Julian Calaby 2016-06-14 4:48 ` Julian Calaby 2016-06-14 4:48 ` Julian Calaby 2016-06-13 17:46 ` [PATCH v3 10/13] spi: sunxi: merge sun4i and sun6i SPI driver Michal Suchanek 2016-06-13 17:46 ` Michal Suchanek 2016-06-13 23:43 ` [linux-sunxi] " Julian Calaby 2016-06-13 23:43 ` Julian Calaby 2016-06-13 23:43 ` Julian Calaby 2016-06-13 23:43 ` Julian Calaby 2016-06-14 4:34 ` [linux-sunxi] " Michal Suchanek 2016-06-14 4:34 ` Michal Suchanek 2016-06-14 4:34 ` Michal Suchanek 2016-06-14 4:34 ` Michal Suchanek 2016-06-14 4:47 ` [linux-sunxi] " Julian Calaby 2016-06-14 4:47 ` Julian Calaby 2016-06-14 4:47 ` Julian Calaby 2016-06-14 4:47 ` Julian Calaby 2016-06-14 5:28 ` [linux-sunxi] " Michal Suchanek 2016-06-14 5:28 ` Michal Suchanek 2016-06-14 5:28 ` Michal Suchanek 2016-06-14 5:28 ` Michal Suchanek 2016-06-14 5:45 ` [linux-sunxi] " Julian Calaby 2016-06-14 5:45 ` Julian Calaby 2016-06-14 5:45 ` Julian Calaby 2016-06-14 5:45 ` Julian Calaby 2016-06-14 6:35 ` Michal Suchanek 2016-06-14 6:35 ` Michal Suchanek 2016-06-14 6:35 ` Michal Suchanek 2016-06-14 6:35 ` Michal Suchanek 2016-06-14 11:20 ` [linux-sunxi] " Julian Calaby 2016-06-14 11:20 ` Julian Calaby 2016-06-14 11:20 ` Julian Calaby 2016-06-14 11:20 ` Julian Calaby 2016-06-13 17:46 ` [PATCH v3 13/13] spi: sun4i: add DMA support Michal 2016-06-13 17:46 ` Michal 2016-06-13 17:46 ` [PATCH v3 12/13] spi: sunxi: remove CONFIG_SPI_SUN6I Michal Suchanek 2016-06-13 17:46 ` Michal Suchanek 2016-06-13 19:57 ` [PATCH v3 00/13] sunxi spi fixes Maxime Ripard 2016-06-13 19:57 ` Maxime Ripard 2016-06-13 19:57 ` Maxime Ripard 2016-06-14 4:50 ` Michal Suchanek 2016-06-14 4:50 ` Michal Suchanek 2016-06-14 4:50 ` Michal Suchanek 2016-06-14 4:50 ` Michal Suchanek 2016-06-14 4:50 ` Michal Suchanek 2016-06-17 10:34 ` Michal Suchanek 2016-06-17 10:34 ` Michal Suchanek 2016-06-17 10:34 ` Michal Suchanek 2016-06-17 10:34 ` Michal Suchanek 2016-06-17 10:34 ` Michal Suchanek 2016-07-25 7:32 ` Maxime Ripard 2016-07-25 7:32 ` Maxime Ripard 2016-07-25 7:32 ` Maxime Ripard 2016-07-25 7:32 ` Maxime Ripard 2016-07-25 7:32 ` Maxime Ripard 2016-07-25 8:03 ` Michal Suchanek 2016-07-25 8:03 ` Michal Suchanek 2016-07-25 8:03 ` Michal Suchanek 2016-07-25 8:03 ` Michal Suchanek 2016-07-25 8:03 ` Michal Suchanek 2016-07-29 20:22 ` Maxime Ripard 2016-07-29 20:22 ` Maxime Ripard 2016-07-29 20:22 ` Maxime Ripard 2016-07-29 20:22 ` Maxime Ripard 2016-07-29 20:22 ` Maxime Ripard 2016-07-30 17:32 ` Michal Suchanek 2016-07-30 17:32 ` Michal Suchanek 2016-07-30 17:32 ` Michal Suchanek 2016-07-30 17:32 ` Michal Suchanek 2016-07-30 17:32 ` Michal Suchanek
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=96b6a34fb7bb60376928e1c92de56c19277abd51.1465490774.git.hramrach@gmail.com \ --to=hramrach-re5jqeeqqe8avxtiumwx3w@public.gmane.org \ --cc=arnd-r2nGTMty4D4@public.gmane.org \ --cc=b18965-KZfg59tc24xl57MIdRCFDg@public.gmane.org \ --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \ --cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \ --cc=horms+renesas-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org \ --cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \ --cc=info-La43T0Mi4bH5xCKuJOYmCvaTkwRoYoCU@public.gmane.org \ --cc=javier-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org \ --cc=k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \ --cc=linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org \ --cc=linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \ --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \ --cc=maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \ --cc=net147-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \ --cc=olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org \ --cc=pawel.moll-5wv7dgnIgG8@public.gmane.org \ --cc=public_timo.s-fWgRPtSzPNU3WX+qO2AYSQ@public.gmane.org \ --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \ --cc=sjoerd.simons-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org \ --cc=treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \ --cc=wens-jdAy2FN1RRM@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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.