* [PATCH 1/2] spi: cadence: Init HW after reading devicetree attributes @ 2014-11-27 15:12 Lars-Peter Clausen [not found] ` <1417101138-2619-1-git-send-email-lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org> 0 siblings, 1 reply; 5+ messages in thread From: Lars-Peter Clausen @ 2014-11-27 15:12 UTC (permalink / raw) To: Mark Brown Cc: Michal Simek, Soren Brinkmann, linux-spi-u79uwXL29TY76Z2rM5mHXA, Paul Cercueil, Lars-Peter Clausen From: Paul Cercueil <paul.cercueil-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org> This will make it possible to use the settings specified in the devicetree to configure the hardware. Signed-off-by: Paul Cercueil <paul.cercueil-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org> Signed-off-by: Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org> --- drivers/spi/spi-cadence.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c index 7b811e3..2404937 100644 --- a/drivers/spi/spi-cadence.c +++ b/drivers/spi/spi-cadence.c @@ -516,6 +516,17 @@ static int cdns_spi_probe(struct platform_device *pdev) goto clk_dis_apb; } + ret = of_property_read_u32(pdev->dev.of_node, "num-cs", &num_cs); + if (ret < 0) + master->num_chipselect = CDNS_SPI_DEFAULT_NUM_CS; + else + master->num_chipselect = num_cs; + + ret = of_property_read_u32(pdev->dev.of_node, "is-decoded-cs", + &xspi->is_decoded_cs); + if (ret < 0) + xspi->is_decoded_cs = 0; + /* SPI controller initializations */ cdns_spi_init_hw(xspi); @@ -534,19 +545,6 @@ static int cdns_spi_probe(struct platform_device *pdev) goto remove_master; } - ret = of_property_read_u32(pdev->dev.of_node, "num-cs", &num_cs); - - if (ret < 0) - master->num_chipselect = CDNS_SPI_DEFAULT_NUM_CS; - else - master->num_chipselect = num_cs; - - ret = of_property_read_u32(pdev->dev.of_node, "is-decoded-cs", - &xspi->is_decoded_cs); - - if (ret < 0) - xspi->is_decoded_cs = 0; - master->prepare_transfer_hardware = cdns_prepare_transfer_hardware; master->prepare_message = cdns_prepare_message; master->transfer_one = cdns_transfer_one; -- 1.8.0 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 5+ messages in thread
[parent not found: <1417101138-2619-1-git-send-email-lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>]
* [PATCH 2/2] spi: cadence: Fix 3-to-8 mux mode [not found] ` <1417101138-2619-1-git-send-email-lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org> @ 2014-11-27 15:12 ` Lars-Peter Clausen [not found] ` <1417101138-2619-2-git-send-email-lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org> 2014-11-28 7:52 ` [PATCH 1/2] spi: cadence: Init HW after reading devicetree attributes Michal Simek 2014-11-28 11:42 ` Mark Brown 2 siblings, 1 reply; 5+ messages in thread From: Lars-Peter Clausen @ 2014-11-27 15:12 UTC (permalink / raw) To: Mark Brown Cc: Michal Simek, Soren Brinkmann, linux-spi-u79uwXL29TY76Z2rM5mHXA, Lars-Peter Clausen In 3-to-8 mux mode for the CS pins we need to set the PERI_SEL bit in the control register. Currently the driver never sets this bit even when configured for 3-to-8 mux mode. This patch adds code which sets the bit during device initialization when necessary. Signed-off-by: Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org> --- drivers/spi/spi-cadence.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c index 2404937..5a67498 100644 --- a/drivers/spi/spi-cadence.c +++ b/drivers/spi/spi-cadence.c @@ -47,6 +47,7 @@ #define CDNS_SPI_CR_CPHA_MASK 0x00000004 /* Clock Phase Control */ #define CDNS_SPI_CR_CPOL_MASK 0x00000002 /* Clock Polarity Control */ #define CDNS_SPI_CR_SSCTRL_MASK 0x00003C00 /* Slave Select Mask */ +#define CDNS_SPI_CR_PERI_SEL_MASK 0x00000200 /* Peripheral Select Decode */ #define CDNS_SPI_CR_BAUD_DIV_MASK 0x00000038 /* Baud Rate Divisor Mask */ #define CDNS_SPI_CR_MSTREN_MASK 0x00000001 /* Master Enable Mask */ #define CDNS_SPI_CR_MANSTRTEN_MASK 0x00008000 /* Manual TX Enable Mask */ @@ -148,6 +149,11 @@ static inline void cdns_spi_write(struct cdns_spi *xspi, u32 offset, u32 val) */ static void cdns_spi_init_hw(struct cdns_spi *xspi) { + u32 ctrl_reg = CDNS_SPI_CR_DEFAULT_MASK; + + if (xspi->is_decoded_cs) + ctrl_reg |= CDNS_SPI_CR_PERI_SEL_MASK; + cdns_spi_write(xspi, CDNS_SPI_ER_OFFSET, CDNS_SPI_ER_DISABLE_MASK); cdns_spi_write(xspi, CDNS_SPI_IDR_OFFSET, @@ -160,8 +166,7 @@ static void cdns_spi_init_hw(struct cdns_spi *xspi) cdns_spi_write(xspi, CDNS_SPI_ISR_OFFSET, CDNS_SPI_IXR_ALL_MASK); - cdns_spi_write(xspi, CDNS_SPI_CR_OFFSET, - CDNS_SPI_CR_DEFAULT_MASK); + cdns_spi_write(xspi, CDNS_SPI_CR_OFFSET, ctrl_reg); cdns_spi_write(xspi, CDNS_SPI_ER_OFFSET, CDNS_SPI_ER_ENABLE_MASK); } -- 1.8.0 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 5+ messages in thread
[parent not found: <1417101138-2619-2-git-send-email-lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>]
* Re: [PATCH 2/2] spi: cadence: Fix 3-to-8 mux mode [not found] ` <1417101138-2619-2-git-send-email-lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org> @ 2014-11-28 6:52 ` Harini Katakam 0 siblings, 0 replies; 5+ messages in thread From: Harini Katakam @ 2014-11-28 6:52 UTC (permalink / raw) To: Lars-Peter Clausen; +Cc: Mark Brown, Michal Simek, Soren Brinkmann, linux-spi On Thu, Nov 27, 2014 at 8:42 PM, Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org> wrote: > In 3-to-8 mux mode for the CS pins we need to set the PERI_SEL bit in the > control register. Currently the driver never sets this bit even when > configured for 3-to-8 mux mode. This patch adds code which sets the bit > during device initialization when necessary. > > Signed-off-by: Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org> Acked-by: Harini Katakam <harinik-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> Regards, Harini -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] spi: cadence: Init HW after reading devicetree attributes [not found] ` <1417101138-2619-1-git-send-email-lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org> 2014-11-27 15:12 ` [PATCH 2/2] spi: cadence: Fix 3-to-8 mux mode Lars-Peter Clausen @ 2014-11-28 7:52 ` Michal Simek 2014-11-28 11:42 ` Mark Brown 2 siblings, 0 replies; 5+ messages in thread From: Michal Simek @ 2014-11-28 7:52 UTC (permalink / raw) To: Lars-Peter Clausen, Mark Brown Cc: Michal Simek, Soren Brinkmann, linux-spi-u79uwXL29TY76Z2rM5mHXA, Paul Cercueil On 11/27/2014 04:12 PM, Lars-Peter Clausen wrote: > From: Paul Cercueil <paul.cercueil-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org> > > This will make it possible to use the settings specified in the devicetree > to configure the hardware. > > Signed-off-by: Paul Cercueil <paul.cercueil-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org> > Signed-off-by: Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org> > --- > drivers/spi/spi-cadence.c | 24 +++++++++++------------- > 1 file changed, 11 insertions(+), 13 deletions(-) > > diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c > index 7b811e3..2404937 100644 > --- a/drivers/spi/spi-cadence.c > +++ b/drivers/spi/spi-cadence.c > @@ -516,6 +516,17 @@ static int cdns_spi_probe(struct platform_device *pdev) > goto clk_dis_apb; > } > > + ret = of_property_read_u32(pdev->dev.of_node, "num-cs", &num_cs); > + if (ret < 0) > + master->num_chipselect = CDNS_SPI_DEFAULT_NUM_CS; > + else > + master->num_chipselect = num_cs; > + > + ret = of_property_read_u32(pdev->dev.of_node, "is-decoded-cs", > + &xspi->is_decoded_cs); > + if (ret < 0) > + xspi->is_decoded_cs = 0; > + > /* SPI controller initializations */ > cdns_spi_init_hw(xspi); > > @@ -534,19 +545,6 @@ static int cdns_spi_probe(struct platform_device *pdev) > goto remove_master; > } > > - ret = of_property_read_u32(pdev->dev.of_node, "num-cs", &num_cs); > - > - if (ret < 0) > - master->num_chipselect = CDNS_SPI_DEFAULT_NUM_CS; > - else > - master->num_chipselect = num_cs; > - > - ret = of_property_read_u32(pdev->dev.of_node, "is-decoded-cs", > - &xspi->is_decoded_cs); > - > - if (ret < 0) > - xspi->is_decoded_cs = 0; > - > master->prepare_transfer_hardware = cdns_prepare_transfer_hardware; > master->prepare_message = cdns_prepare_message; > master->transfer_one = cdns_transfer_one; > That's reasonable patch to do without any functional impact now. Reviewed-by: Michal Simek <michal.simek-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> Thanks, Michal -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] spi: cadence: Init HW after reading devicetree attributes [not found] ` <1417101138-2619-1-git-send-email-lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org> 2014-11-27 15:12 ` [PATCH 2/2] spi: cadence: Fix 3-to-8 mux mode Lars-Peter Clausen 2014-11-28 7:52 ` [PATCH 1/2] spi: cadence: Init HW after reading devicetree attributes Michal Simek @ 2014-11-28 11:42 ` Mark Brown 2 siblings, 0 replies; 5+ messages in thread From: Mark Brown @ 2014-11-28 11:42 UTC (permalink / raw) To: Lars-Peter Clausen Cc: Michal Simek, Soren Brinkmann, linux-spi-u79uwXL29TY76Z2rM5mHXA, Paul Cercueil [-- Attachment #1: Type: text/plain, Size: 285 bytes --] On Thu, Nov 27, 2014 at 04:12:17PM +0100, Lars-Peter Clausen wrote: > From: Paul Cercueil <paul.cercueil-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org> > > This will make it possible to use the settings specified in the devicetree > to configure the hardware. Applied both, thanks. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-11-28 11:42 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-11-27 15:12 [PATCH 1/2] spi: cadence: Init HW after reading devicetree attributes Lars-Peter Clausen [not found] ` <1417101138-2619-1-git-send-email-lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org> 2014-11-27 15:12 ` [PATCH 2/2] spi: cadence: Fix 3-to-8 mux mode Lars-Peter Clausen [not found] ` <1417101138-2619-2-git-send-email-lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org> 2014-11-28 6:52 ` Harini Katakam 2014-11-28 7:52 ` [PATCH 1/2] spi: cadence: Init HW after reading devicetree attributes Michal Simek 2014-11-28 11:42 ` Mark Brown
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).