Re: [PATCH 2/2] spi: convert drivers to use bits_per_word_mask

2013-07-09 Thread Mark Brown
On Tue, Jul 09, 2013 at 10:49:10PM +0100, Mark Brown wrote:
> On Tue, Jul 09, 2013 at 05:47:04PM +0200, Michal Simek wrote:
> 
> > Probably the best solution is just revert this part of patch.
> > Mark: What do you think?
> 
> We should make it so that the user does not need to supply empty
> functions if none are needed.

...though this is stuff that went to Linus in the merge window so as a
bug fix we should restore that function then for v3.12 we should do the
proper fix.


signature.asc
Description: Digital signature


Re: [PATCH 2/2] spi: convert drivers to use bits_per_word_mask

2013-07-09 Thread Mark Brown
On Tue, Jul 09, 2013 at 05:47:04PM +0200, Michal Simek wrote:

> Probably the best solution is just revert this part of patch.
> Mark: What do you think?

We should make it so that the user does not need to supply empty
functions if none are needed.


signature.asc
Description: Digital signature


Re: [PATCH 2/2] spi: convert drivers to use bits_per_word_mask

2013-07-09 Thread Stephen Warren
On 07/09/2013 09:47 AM, Michal Simek wrote:
>> diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c 
>> index e1d7696..f321bf9 100644 --- a/drivers/spi/spi-xilinx.c +++
>> b/drivers/spi/spi-xilinx.c @@ -232,21 +232,6 @@ static int
>> xilinx_spi_setup_transfer(struct spi_device *spi, return 0; }
>> 
>> -static int xilinx_spi_setup(struct spi_device *spi) -{ -/*
>> always return 0, we can not check the number of bits. -   * There
>> are cases when SPI setup is called before any driver is - *
>> there, in that case the SPI core defaults to 8 bits, which we -
>> * do not support in some cases. But if we return an error, the -
>> * SPI device would not be registered and no driver can get hold
>> of it -   * When the driver is there, it will call SPI setup again
>> with the -* correct number of bits per transfer. -* If a
>> driver setups with the wrong bit number, it will fail when -  *
>> it tries to do a transfer -   */ -   return 0; -} - static void
>> xilinx_spi_fill_tx_fifo(struct xilinx_spi *xspi) { u8 sr; @@
>> -377,7 +362,6 @@ struct spi_master *xilinx_spi_init(struct device
>> *dev, struct resource *mem, xspi->bitbang.chipselect =
>> xilinx_spi_chipselect; xspi->bitbang.setup_transfer =
>> xilinx_spi_setup_transfer; xspi->bitbang.txrx_bufs =
>> xilinx_spi_txrx_bufs; -  xspi->bitbang.master->setup =
>> xilinx_spi_setup; init_completion(>done);
>> 
>> if (!request_mem_region(mem->start, resource_size(mem),
>> 
> 
> This part of this patch is breaking xilinx spi driver because when 
> spi_bitbang_start is called it goes through some if else... and
> because bitbang->txrx_bufs is defined it end up in this code } else
> if (!master->setup) { return -EINVAL; }
> 
> Probably the best solution is just revert this part of patch. Mark:
> What do you think?

Hmm. Why is master->setup required by the bitbang driver, if it's
legal (i.e. the code works) to implement it just by doing nothing?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] spi: convert drivers to use bits_per_word_mask

2013-07-09 Thread Michal Simek
> diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
> index e1d7696..f321bf9 100644
> --- a/drivers/spi/spi-xilinx.c
> +++ b/drivers/spi/spi-xilinx.c
> @@ -232,21 +232,6 @@ static int xilinx_spi_setup_transfer(struct spi_device 
> *spi,
>   return 0;
>  }
>  
> -static int xilinx_spi_setup(struct spi_device *spi)
> -{
> - /* always return 0, we can not check the number of bits.
> -  * There are cases when SPI setup is called before any driver is
> -  * there, in that case the SPI core defaults to 8 bits, which we
> -  * do not support in some cases. But if we return an error, the
> -  * SPI device would not be registered and no driver can get hold of it
> -  * When the driver is there, it will call SPI setup again with the
> -  * correct number of bits per transfer.
> -  * If a driver setups with the wrong bit number, it will fail when
> -  * it tries to do a transfer
> -  */
> - return 0;
> -}
> -
>  static void xilinx_spi_fill_tx_fifo(struct xilinx_spi *xspi)
>  {
>   u8 sr;
> @@ -377,7 +362,6 @@ struct spi_master *xilinx_spi_init(struct device *dev, 
> struct resource *mem,
>   xspi->bitbang.chipselect = xilinx_spi_chipselect;
>   xspi->bitbang.setup_transfer = xilinx_spi_setup_transfer;
>   xspi->bitbang.txrx_bufs = xilinx_spi_txrx_bufs;
> - xspi->bitbang.master->setup = xilinx_spi_setup;
>   init_completion(>done);
>  
>   if (!request_mem_region(mem->start, resource_size(mem),
> 

This part of this patch is breaking xilinx spi driver because when
spi_bitbang_start is called it goes through some if else...
and because bitbang->txrx_bufs is defined
it end up in this code
} else if (!master->setup) {
return -EINVAL;
}

Probably the best solution is just revert this part of patch.
Mark: What do you think?

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform




signature.asc
Description: OpenPGP digital signature


Re: [PATCH 2/2] spi: convert drivers to use bits_per_word_mask

2013-07-09 Thread Mark Brown
On Tue, Jul 09, 2013 at 05:47:04PM +0200, Michal Simek wrote:

 Probably the best solution is just revert this part of patch.
 Mark: What do you think?

We should make it so that the user does not need to supply empty
functions if none are needed.


signature.asc
Description: Digital signature


Re: [PATCH 2/2] spi: convert drivers to use bits_per_word_mask

2013-07-09 Thread Mark Brown
On Tue, Jul 09, 2013 at 10:49:10PM +0100, Mark Brown wrote:
 On Tue, Jul 09, 2013 at 05:47:04PM +0200, Michal Simek wrote:
 
  Probably the best solution is just revert this part of patch.
  Mark: What do you think?
 
 We should make it so that the user does not need to supply empty
 functions if none are needed.

...though this is stuff that went to Linus in the merge window so as a
bug fix we should restore that function then for v3.12 we should do the
proper fix.


signature.asc
Description: Digital signature


Re: [PATCH 2/2] spi: convert drivers to use bits_per_word_mask

2013-07-09 Thread Michal Simek
 diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
 index e1d7696..f321bf9 100644
 --- a/drivers/spi/spi-xilinx.c
 +++ b/drivers/spi/spi-xilinx.c
 @@ -232,21 +232,6 @@ static int xilinx_spi_setup_transfer(struct spi_device 
 *spi,
   return 0;
  }
  
 -static int xilinx_spi_setup(struct spi_device *spi)
 -{
 - /* always return 0, we can not check the number of bits.
 -  * There are cases when SPI setup is called before any driver is
 -  * there, in that case the SPI core defaults to 8 bits, which we
 -  * do not support in some cases. But if we return an error, the
 -  * SPI device would not be registered and no driver can get hold of it
 -  * When the driver is there, it will call SPI setup again with the
 -  * correct number of bits per transfer.
 -  * If a driver setups with the wrong bit number, it will fail when
 -  * it tries to do a transfer
 -  */
 - return 0;
 -}
 -
  static void xilinx_spi_fill_tx_fifo(struct xilinx_spi *xspi)
  {
   u8 sr;
 @@ -377,7 +362,6 @@ struct spi_master *xilinx_spi_init(struct device *dev, 
 struct resource *mem,
   xspi-bitbang.chipselect = xilinx_spi_chipselect;
   xspi-bitbang.setup_transfer = xilinx_spi_setup_transfer;
   xspi-bitbang.txrx_bufs = xilinx_spi_txrx_bufs;
 - xspi-bitbang.master-setup = xilinx_spi_setup;
   init_completion(xspi-done);
  
   if (!request_mem_region(mem-start, resource_size(mem),
 

This part of this patch is breaking xilinx spi driver because when
spi_bitbang_start is called it goes through some if else...
and because bitbang-txrx_bufs is defined
it end up in this code
} else if (!master-setup) {
return -EINVAL;
}

Probably the best solution is just revert this part of patch.
Mark: What do you think?

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP - KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform




signature.asc
Description: OpenPGP digital signature


Re: [PATCH 2/2] spi: convert drivers to use bits_per_word_mask

2013-07-09 Thread Stephen Warren
On 07/09/2013 09:47 AM, Michal Simek wrote:
 diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c 
 index e1d7696..f321bf9 100644 --- a/drivers/spi/spi-xilinx.c +++
 b/drivers/spi/spi-xilinx.c @@ -232,21 +232,6 @@ static int
 xilinx_spi_setup_transfer(struct spi_device *spi, return 0; }
 
 -static int xilinx_spi_setup(struct spi_device *spi) -{ -/*
 always return 0, we can not check the number of bits. -   * There
 are cases when SPI setup is called before any driver is - *
 there, in that case the SPI core defaults to 8 bits, which we -
 * do not support in some cases. But if we return an error, the -
 * SPI device would not be registered and no driver can get hold
 of it -   * When the driver is there, it will call SPI setup again
 with the -* correct number of bits per transfer. -* If a
 driver setups with the wrong bit number, it will fail when -  *
 it tries to do a transfer -   */ -   return 0; -} - static void
 xilinx_spi_fill_tx_fifo(struct xilinx_spi *xspi) { u8 sr; @@
 -377,7 +362,6 @@ struct spi_master *xilinx_spi_init(struct device
 *dev, struct resource *mem, xspi-bitbang.chipselect =
 xilinx_spi_chipselect; xspi-bitbang.setup_transfer =
 xilinx_spi_setup_transfer; xspi-bitbang.txrx_bufs =
 xilinx_spi_txrx_bufs; -  xspi-bitbang.master-setup =
 xilinx_spi_setup; init_completion(xspi-done);
 
 if (!request_mem_region(mem-start, resource_size(mem),
 
 
 This part of this patch is breaking xilinx spi driver because when 
 spi_bitbang_start is called it goes through some if else... and
 because bitbang-txrx_bufs is defined it end up in this code } else
 if (!master-setup) { return -EINVAL; }
 
 Probably the best solution is just revert this part of patch. Mark:
 What do you think?

Hmm. Why is master-setup required by the bitbang driver, if it's
legal (i.e. the code works) to implement it just by doing nothing?
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] spi: convert drivers to use bits_per_word_mask

2013-05-31 Thread Arnd Bergmann
On Friday 31 May 2013, Stephen Warren wrote:
> > drivers/spi/spi-pxa2xx.c: In function 'pxa2xx_spi_probe':
> > drivers/spi/spi-pxa2xx.c:1152:3: warning: left shift count >= width of type 
> > [enabled by default]
> >master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);
> >^
> 
> That should be fixed by the patches I sent yesterday.

Cool, thanks!

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] spi: convert drivers to use bits_per_word_mask

2013-05-31 Thread Stephen Warren
On 05/31/2013 02:45 AM, Arnd Bergmann wrote:
> Can you check this part again:
> 
> On Tuesday 21 May 2013 20:36:35 Stephen Warren wrote:
>> diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
...
>> @@ -1190,11 +1172,13 @@ static int pxa2xx_spi_probe(struct platform_device 
>> *pdev)
>> drv_data->ioaddr = ssp->mmio_base;
>> drv_data->ssdr_physical = ssp->phys_base + SSDR;
>> if (pxa25x_ssp_comp(drv_data)) {
>> +   master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 16);
>> drv_data->int_cr1 = SSCR1_TIE | SSCR1_RIE;
>> drv_data->dma_cr1 = 0;
>> drv_data->clear_sr = SSSR_ROR;
>> drv_data->mask_sr = SSSR_RFS | SSSR_TFS | SSSR_ROR;
>> } else {
>> +   master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);
>> drv_data->int_cr1 = SSCR1_TIE | SSCR1_RIE | SSCR1_TINTE;
>> drv_data->dma_cr1 = DEFAULT_DMA_CR1;
>> drv_data->clear_sr = SSSR_ROR | SSSR_TINT;
> 
> I get a new build warning
> 
> drivers/spi/spi-pxa2xx.c: In function 'pxa2xx_spi_probe':
> drivers/spi/spi-pxa2xx.c:1152:3: warning: left shift count >= width of type 
> [enabled by default]
>master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);
>^

That should be fixed by the patches I sent yesterday.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] spi: convert drivers to use bits_per_word_mask

2013-05-31 Thread Arnd Bergmann
Can you check this part again:

On Tuesday 21 May 2013 20:36:35 Stephen Warren wrote:
> diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
> index f5d84d6..7de2ca1 100644
> --- a/drivers/spi/spi-pxa2xx.c
> +++ b/drivers/spi/spi-pxa2xx.c
> @@ -881,21 +881,6 @@ static int setup(struct spi_device *spi)
> rx_thres = RX_THRESH_DFLT;
> }
>  
> -   if (!pxa25x_ssp_comp(drv_data)
> -   && (spi->bits_per_word < 4 || spi->bits_per_word > 32)) {
> -   dev_err(>dev, "failed setup: ssp_type=%d, bits/wrd=%d "
> -   "b/w not 4-32 for type non-PXA25x_SSP\n",
> -   drv_data->ssp_type, spi->bits_per_word);
> -   return -EINVAL;
> -   } else if (pxa25x_ssp_comp(drv_data)
> -   && (spi->bits_per_word < 4
> -   || spi->bits_per_word > 16)) {
> -   dev_err(>dev, "failed setup: ssp_type=%d, bits/wrd=%d "
> -   "b/w not 4-16 for type PXA25x_SSP\n",
> -   drv_data->ssp_type, spi->bits_per_word);
> -   return -EINVAL;
> -   }
> -
> /* Only alloc on first setup */
> chip = spi_get_ctldata(spi);
> if (!chip) {
> @@ -1011,9 +996,6 @@ static int setup(struct spi_device *spi)
> chip->n_bytes = 4;
> chip->read = u32_reader;
> chip->write = u32_writer;
> -   } else {
> -   dev_err(>dev, "invalid wordsize\n");
> -   return -ENODEV;
> }
> chip->bits_per_word = spi->bits_per_word;
>  
> @@ -1190,11 +1172,13 @@ static int pxa2xx_spi_probe(struct platform_device 
> *pdev)
> drv_data->ioaddr = ssp->mmio_base;
> drv_data->ssdr_physical = ssp->phys_base + SSDR;
> if (pxa25x_ssp_comp(drv_data)) {
> +   master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 16);
> drv_data->int_cr1 = SSCR1_TIE | SSCR1_RIE;
> drv_data->dma_cr1 = 0;
> drv_data->clear_sr = SSSR_ROR;
> drv_data->mask_sr = SSSR_RFS | SSSR_TFS | SSSR_ROR;
> } else {
> +   master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);
> drv_data->int_cr1 = SSCR1_TIE | SSCR1_RIE | SSCR1_TINTE;
> drv_data->dma_cr1 = DEFAULT_DMA_CR1;
> drv_data->clear_sr = SSSR_ROR | SSSR_TINT;

I get a new build warning

drivers/spi/spi-pxa2xx.c: In function 'pxa2xx_spi_probe':
drivers/spi/spi-pxa2xx.c:1152:3: warning: left shift count >= width of type 
[enabled by default]
   master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);
   ^

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] spi: convert drivers to use bits_per_word_mask

2013-05-31 Thread Arnd Bergmann
Can you check this part again:

On Tuesday 21 May 2013 20:36:35 Stephen Warren wrote:
 diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
 index f5d84d6..7de2ca1 100644
 --- a/drivers/spi/spi-pxa2xx.c
 +++ b/drivers/spi/spi-pxa2xx.c
 @@ -881,21 +881,6 @@ static int setup(struct spi_device *spi)
 rx_thres = RX_THRESH_DFLT;
 }
  
 -   if (!pxa25x_ssp_comp(drv_data)
 -(spi-bits_per_word  4 || spi-bits_per_word  32)) {
 -   dev_err(spi-dev, failed setup: ssp_type=%d, bits/wrd=%d 
 -   b/w not 4-32 for type non-PXA25x_SSP\n,
 -   drv_data-ssp_type, spi-bits_per_word);
 -   return -EINVAL;
 -   } else if (pxa25x_ssp_comp(drv_data)
 -(spi-bits_per_word  4
 -   || spi-bits_per_word  16)) {
 -   dev_err(spi-dev, failed setup: ssp_type=%d, bits/wrd=%d 
 -   b/w not 4-16 for type PXA25x_SSP\n,
 -   drv_data-ssp_type, spi-bits_per_word);
 -   return -EINVAL;
 -   }
 -
 /* Only alloc on first setup */
 chip = spi_get_ctldata(spi);
 if (!chip) {
 @@ -1011,9 +996,6 @@ static int setup(struct spi_device *spi)
 chip-n_bytes = 4;
 chip-read = u32_reader;
 chip-write = u32_writer;
 -   } else {
 -   dev_err(spi-dev, invalid wordsize\n);
 -   return -ENODEV;
 }
 chip-bits_per_word = spi-bits_per_word;
  
 @@ -1190,11 +1172,13 @@ static int pxa2xx_spi_probe(struct platform_device 
 *pdev)
 drv_data-ioaddr = ssp-mmio_base;
 drv_data-ssdr_physical = ssp-phys_base + SSDR;
 if (pxa25x_ssp_comp(drv_data)) {
 +   master-bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 16);
 drv_data-int_cr1 = SSCR1_TIE | SSCR1_RIE;
 drv_data-dma_cr1 = 0;
 drv_data-clear_sr = SSSR_ROR;
 drv_data-mask_sr = SSSR_RFS | SSSR_TFS | SSSR_ROR;
 } else {
 +   master-bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);
 drv_data-int_cr1 = SSCR1_TIE | SSCR1_RIE | SSCR1_TINTE;
 drv_data-dma_cr1 = DEFAULT_DMA_CR1;
 drv_data-clear_sr = SSSR_ROR | SSSR_TINT;

I get a new build warning

drivers/spi/spi-pxa2xx.c: In function 'pxa2xx_spi_probe':
drivers/spi/spi-pxa2xx.c:1152:3: warning: left shift count = width of type 
[enabled by default]
   master-bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);
   ^

Arnd
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] spi: convert drivers to use bits_per_word_mask

2013-05-31 Thread Stephen Warren
On 05/31/2013 02:45 AM, Arnd Bergmann wrote:
 Can you check this part again:
 
 On Tuesday 21 May 2013 20:36:35 Stephen Warren wrote:
 diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
...
 @@ -1190,11 +1172,13 @@ static int pxa2xx_spi_probe(struct platform_device 
 *pdev)
 drv_data-ioaddr = ssp-mmio_base;
 drv_data-ssdr_physical = ssp-phys_base + SSDR;
 if (pxa25x_ssp_comp(drv_data)) {
 +   master-bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 16);
 drv_data-int_cr1 = SSCR1_TIE | SSCR1_RIE;
 drv_data-dma_cr1 = 0;
 drv_data-clear_sr = SSSR_ROR;
 drv_data-mask_sr = SSSR_RFS | SSSR_TFS | SSSR_ROR;
 } else {
 +   master-bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);
 drv_data-int_cr1 = SSCR1_TIE | SSCR1_RIE | SSCR1_TINTE;
 drv_data-dma_cr1 = DEFAULT_DMA_CR1;
 drv_data-clear_sr = SSSR_ROR | SSSR_TINT;
 
 I get a new build warning
 
 drivers/spi/spi-pxa2xx.c: In function 'pxa2xx_spi_probe':
 drivers/spi/spi-pxa2xx.c:1152:3: warning: left shift count = width of type 
 [enabled by default]
master-bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);
^

That should be fixed by the patches I sent yesterday.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] spi: convert drivers to use bits_per_word_mask

2013-05-31 Thread Arnd Bergmann
On Friday 31 May 2013, Stephen Warren wrote:
  drivers/spi/spi-pxa2xx.c: In function 'pxa2xx_spi_probe':
  drivers/spi/spi-pxa2xx.c:1152:3: warning: left shift count = width of type 
  [enabled by default]
 master-bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);
 ^
 
 That should be fixed by the patches I sent yesterday.

Cool, thanks!

Arnd
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] spi: convert drivers to use bits_per_word_mask

2013-05-29 Thread Mark Brown
On Tue, May 21, 2013 at 08:36:35PM -0600, Stephen Warren wrote:
> Fill in the recently added spi_master.bits_per_word_mask field in as
> many drivers as possible. Make related cleanups, such as removing any
> redundant error-checking, or empty setup callbacks.

Applied, thanks.


signature.asc
Description: Digital signature


Re: [PATCH 2/2] spi: convert drivers to use bits_per_word_mask

2013-05-29 Thread Mark Brown
On Tue, May 21, 2013 at 08:36:35PM -0600, Stephen Warren wrote:
 Fill in the recently added spi_master.bits_per_word_mask field in as
 many drivers as possible. Make related cleanups, such as removing any
 redundant error-checking, or empty setup callbacks.

Applied, thanks.


signature.asc
Description: Digital signature


RE: [PATCH 2/2] spi: convert drivers to use bits_per_word_mask

2013-05-24 Thread H Hartley Sweeten
On Tuesday, May 21, 2013 7:37 PM, Stephen Warren wrote:
>
> Fill in the recently added spi_master.bits_per_word_mask field in as
> many drivers as possible. Make related cleanups, such as removing any
> redundant error-checking, or empty setup callbacks.
>
> Cc: device-drivers-de...@blackfin.uclinux.org
> Cc: Mike Frysinger 
> Signed-off-by: Stephen Warren 
> ---



>  drivers/spi/spi-ep93xx.c|   11 +--



> diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c
> index d7bac60..f1b1497 100644
> --- a/drivers/spi/spi-ep93xx.c
> +++ b/drivers/spi/spi-ep93xx.c
> @@ -296,12 +296,6 @@ static int ep93xx_spi_setup(struct spi_device *spi)
>   struct ep93xx_spi *espi = spi_master_get_devdata(spi->master);
>   struct ep93xx_spi_chip *chip;
>  
> - if (spi->bits_per_word < 4 || spi->bits_per_word > 16) {
> - dev_err(>pdev->dev, "invalid bits per word %d\n",
> - spi->bits_per_word);
> - return -EINVAL;
> - }
> -
>   chip = spi_get_ctldata(spi);
>   if (!chip) {
>   dev_dbg(>pdev->dev, "initial setup for %s\n",
> @@ -365,10 +359,6 @@ static int ep93xx_spi_transfer(struct spi_device *spi, 
> struct spi_message *msg)
>  
>   /* first validate each transfer */
>   list_for_each_entry(t, >transfers, transfer_list) {
> - if (t->bits_per_word) {
> - if (t->bits_per_word < 4 || t->bits_per_word > 16)
> - return -EINVAL;
> - }
>   if (t->speed_hz && t->speed_hz < espi->min_rate)
>   return -EINVAL;
>   }
> @@ -1046,6 +1036,7 @@ static int ep93xx_spi_probe(struct platform_device 
> *pdev)
>   master->bus_num = pdev->id;
>   master->num_chipselect = info->num_chipselect;
>   master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
> + master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 16);
>  
>   platform_set_drvdata(pdev, master);

Seems reasonable. For the spi-ep93xx driver:

Acked-by: H Hartley Sweeten 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH 2/2] spi: convert drivers to use bits_per_word_mask

2013-05-24 Thread H Hartley Sweeten
On Tuesday, May 21, 2013 7:37 PM, Stephen Warren wrote:

 Fill in the recently added spi_master.bits_per_word_mask field in as
 many drivers as possible. Make related cleanups, such as removing any
 redundant error-checking, or empty setup callbacks.

 Cc: device-drivers-de...@blackfin.uclinux.org
 Cc: Mike Frysinger vap...@gentoo.org
 Signed-off-by: Stephen Warren swar...@wwwdotorg.org
 ---

snip

  drivers/spi/spi-ep93xx.c|   11 +--

snip

 diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c
 index d7bac60..f1b1497 100644
 --- a/drivers/spi/spi-ep93xx.c
 +++ b/drivers/spi/spi-ep93xx.c
 @@ -296,12 +296,6 @@ static int ep93xx_spi_setup(struct spi_device *spi)
   struct ep93xx_spi *espi = spi_master_get_devdata(spi-master);
   struct ep93xx_spi_chip *chip;
  
 - if (spi-bits_per_word  4 || spi-bits_per_word  16) {
 - dev_err(espi-pdev-dev, invalid bits per word %d\n,
 - spi-bits_per_word);
 - return -EINVAL;
 - }
 -
   chip = spi_get_ctldata(spi);
   if (!chip) {
   dev_dbg(espi-pdev-dev, initial setup for %s\n,
 @@ -365,10 +359,6 @@ static int ep93xx_spi_transfer(struct spi_device *spi, 
 struct spi_message *msg)
  
   /* first validate each transfer */
   list_for_each_entry(t, msg-transfers, transfer_list) {
 - if (t-bits_per_word) {
 - if (t-bits_per_word  4 || t-bits_per_word  16)
 - return -EINVAL;
 - }
   if (t-speed_hz  t-speed_hz  espi-min_rate)
   return -EINVAL;
   }
 @@ -1046,6 +1036,7 @@ static int ep93xx_spi_probe(struct platform_device 
 *pdev)
   master-bus_num = pdev-id;
   master-num_chipselect = info-num_chipselect;
   master-mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
 + master-bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 16);
  
   platform_set_drvdata(pdev, master);

Seems reasonable. For the spi-ep93xx driver:

Acked-by: H Hartley Sweeten hswee...@visionengravers.com


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] spi: convert drivers to use bits_per_word_mask

2013-05-21 Thread Stephen Warren
Fill in the recently added spi_master.bits_per_word_mask field in as
many drivers as possible. Make related cleanups, such as removing any
redundant error-checking, or empty setup callbacks.

Cc: device-drivers-de...@blackfin.uclinux.org
Cc: Mike Frysinger 
Signed-off-by: Stephen Warren 
---
The only part of this change I'm not 100% sure of is to spi-bfin-*.c;
these used to support any bits_per_word value that was a multiple of 8
or 16. However, the code only has u8_ops and u16_ops, which implies to
me that it actually supports only 8 and 16 bits_per_word, not multiples
of those. However, it'd be good if the maintainers of those files could
confirm this.
---
 drivers/spi/spi-altera.c|   12 
 drivers/spi/spi-ath79.c |4 +---
 drivers/spi/spi-atmel.c |9 +
 drivers/spi/spi-au1550.c|   12 +---
 drivers/spi/spi-bcm63xx.c   |   20 +---
 drivers/spi/spi-bfin-sport.c|   10 ++
 drivers/spi/spi-bfin5xx.c   |   21 +
 drivers/spi/spi-clps711x.c  |7 +--
 drivers/spi/spi-coldfire-qspi.c |   11 ++-
 drivers/spi/spi-davinci.c   |8 
 drivers/spi/spi-dw.c|   26 --
 drivers/spi/spi-ep93xx.c|   11 +--
 drivers/spi/spi-fsl-espi.c  |9 ++---
 drivers/spi/spi-gpio.c  |4 +---
 drivers/spi/spi-imx.c   |6 +++---
 drivers/spi/spi-mxs.c   |7 +--
 drivers/spi/spi-nuc900.c|   13 -
 drivers/spi/spi-omap-100k.c |   12 ++--
 drivers/spi/spi-omap2-mcspi.c   |   13 ++---
 drivers/spi/spi-ppc4xx.c|   13 +
 drivers/spi/spi-pxa2xx.c|   20 ++--
 drivers/spi/spi-s3c64xx.c   |3 ++-
 drivers/spi/spi-sirf.c  |6 ++
 drivers/spi/spi-ti-ssp.c|   16 +---
 drivers/spi/spi-topcliff-pch.c  |   17 +
 drivers/spi/spi-txx9.c  |8 +---
 drivers/spi/spi-xcomm.c |   12 ++--
 drivers/spi/spi-xilinx.c|   16 
 28 files changed, 46 insertions(+), 280 deletions(-)

diff --git a/drivers/spi/spi-altera.c b/drivers/spi/spi-altera.c
index a537f8d..6b7096e 100644
--- a/drivers/spi/spi-altera.c
+++ b/drivers/spi/spi-altera.c
@@ -103,16 +103,6 @@ static void altera_spi_chipsel(struct spi_device *spi, int 
value)
}
 }
 
-static int altera_spi_setupxfer(struct spi_device *spi, struct spi_transfer *t)
-{
-   return 0;
-}
-
-static int altera_spi_setup(struct spi_device *spi)
-{
-   return 0;
-}
-
 static inline unsigned int hw_txbyte(struct altera_spi *hw, int count)
 {
if (hw->tx) {
@@ -231,7 +221,6 @@ static int altera_spi_probe(struct platform_device *pdev)
master->bus_num = pdev->id;
master->num_chipselect = 16;
master->mode_bits = SPI_CS_HIGH;
-   master->setup = altera_spi_setup;
 
hw = spi_master_get_devdata(master);
platform_set_drvdata(pdev, hw);
@@ -240,7 +229,6 @@ static int altera_spi_probe(struct platform_device *pdev)
hw->bitbang.master = spi_master_get(master);
if (!hw->bitbang.master)
return err;
-   hw->bitbang.setup_transfer = altera_spi_setupxfer;
hw->bitbang.chipselect = altera_spi_chipsel;
hw->bitbang.txrx_bufs = altera_spi_txrx;
 
diff --git a/drivers/spi/spi-ath79.c b/drivers/spi/spi-ath79.c
index e504b76..5e2d52c 100644
--- a/drivers/spi/spi-ath79.c
+++ b/drivers/spi/spi-ath79.c
@@ -155,9 +155,6 @@ static int ath79_spi_setup(struct spi_device *spi)
 {
int status = 0;
 
-   if (spi->bits_per_word > 32)
-   return -EINVAL;
-
if (!spi->controller_state) {
status = ath79_spi_setup_cs(spi);
if (status)
@@ -226,6 +223,7 @@ static int ath79_spi_probe(struct platform_device *pdev)
 
pdata = pdev->dev.platform_data;
 
+   master->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 32);
master->setup = ath79_spi_setup;
master->cleanup = ath79_spi_cleanup;
if (pdata) {
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 380387a..31cfc87 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -1268,13 +1268,6 @@ static int atmel_spi_setup(struct spi_device *spi)
return -EINVAL;
}
 
-   if (bits < 8 || bits > 16) {
-   dev_dbg(>dev,
-   "setup: invalid bits_per_word %u (8 to 16)\n",
-   bits);
-   return -EINVAL;
-   }
-
/* see notes above re chipselect */
if (!atmel_spi_is_v2(as)
&& spi->chip_select == 0
@@ -1515,7 +1508,7 @@ static int atmel_spi_probe(struct platform_device *pdev)
 
/* the spi->mode bits understood by this driver: */
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
-
+   

[PATCH 2/2] spi: convert drivers to use bits_per_word_mask

2013-05-21 Thread Stephen Warren
Fill in the recently added spi_master.bits_per_word_mask field in as
many drivers as possible. Make related cleanups, such as removing any
redundant error-checking, or empty setup callbacks.

Cc: device-drivers-de...@blackfin.uclinux.org
Cc: Mike Frysinger vap...@gentoo.org
Signed-off-by: Stephen Warren swar...@wwwdotorg.org
---
The only part of this change I'm not 100% sure of is to spi-bfin-*.c;
these used to support any bits_per_word value that was a multiple of 8
or 16. However, the code only has u8_ops and u16_ops, which implies to
me that it actually supports only 8 and 16 bits_per_word, not multiples
of those. However, it'd be good if the maintainers of those files could
confirm this.
---
 drivers/spi/spi-altera.c|   12 
 drivers/spi/spi-ath79.c |4 +---
 drivers/spi/spi-atmel.c |9 +
 drivers/spi/spi-au1550.c|   12 +---
 drivers/spi/spi-bcm63xx.c   |   20 +---
 drivers/spi/spi-bfin-sport.c|   10 ++
 drivers/spi/spi-bfin5xx.c   |   21 +
 drivers/spi/spi-clps711x.c  |7 +--
 drivers/spi/spi-coldfire-qspi.c |   11 ++-
 drivers/spi/spi-davinci.c   |8 
 drivers/spi/spi-dw.c|   26 --
 drivers/spi/spi-ep93xx.c|   11 +--
 drivers/spi/spi-fsl-espi.c  |9 ++---
 drivers/spi/spi-gpio.c  |4 +---
 drivers/spi/spi-imx.c   |6 +++---
 drivers/spi/spi-mxs.c   |7 +--
 drivers/spi/spi-nuc900.c|   13 -
 drivers/spi/spi-omap-100k.c |   12 ++--
 drivers/spi/spi-omap2-mcspi.c   |   13 ++---
 drivers/spi/spi-ppc4xx.c|   13 +
 drivers/spi/spi-pxa2xx.c|   20 ++--
 drivers/spi/spi-s3c64xx.c   |3 ++-
 drivers/spi/spi-sirf.c  |6 ++
 drivers/spi/spi-ti-ssp.c|   16 +---
 drivers/spi/spi-topcliff-pch.c  |   17 +
 drivers/spi/spi-txx9.c  |8 +---
 drivers/spi/spi-xcomm.c |   12 ++--
 drivers/spi/spi-xilinx.c|   16 
 28 files changed, 46 insertions(+), 280 deletions(-)

diff --git a/drivers/spi/spi-altera.c b/drivers/spi/spi-altera.c
index a537f8d..6b7096e 100644
--- a/drivers/spi/spi-altera.c
+++ b/drivers/spi/spi-altera.c
@@ -103,16 +103,6 @@ static void altera_spi_chipsel(struct spi_device *spi, int 
value)
}
 }
 
-static int altera_spi_setupxfer(struct spi_device *spi, struct spi_transfer *t)
-{
-   return 0;
-}
-
-static int altera_spi_setup(struct spi_device *spi)
-{
-   return 0;
-}
-
 static inline unsigned int hw_txbyte(struct altera_spi *hw, int count)
 {
if (hw-tx) {
@@ -231,7 +221,6 @@ static int altera_spi_probe(struct platform_device *pdev)
master-bus_num = pdev-id;
master-num_chipselect = 16;
master-mode_bits = SPI_CS_HIGH;
-   master-setup = altera_spi_setup;
 
hw = spi_master_get_devdata(master);
platform_set_drvdata(pdev, hw);
@@ -240,7 +229,6 @@ static int altera_spi_probe(struct platform_device *pdev)
hw-bitbang.master = spi_master_get(master);
if (!hw-bitbang.master)
return err;
-   hw-bitbang.setup_transfer = altera_spi_setupxfer;
hw-bitbang.chipselect = altera_spi_chipsel;
hw-bitbang.txrx_bufs = altera_spi_txrx;
 
diff --git a/drivers/spi/spi-ath79.c b/drivers/spi/spi-ath79.c
index e504b76..5e2d52c 100644
--- a/drivers/spi/spi-ath79.c
+++ b/drivers/spi/spi-ath79.c
@@ -155,9 +155,6 @@ static int ath79_spi_setup(struct spi_device *spi)
 {
int status = 0;
 
-   if (spi-bits_per_word  32)
-   return -EINVAL;
-
if (!spi-controller_state) {
status = ath79_spi_setup_cs(spi);
if (status)
@@ -226,6 +223,7 @@ static int ath79_spi_probe(struct platform_device *pdev)
 
pdata = pdev-dev.platform_data;
 
+   master-bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 32);
master-setup = ath79_spi_setup;
master-cleanup = ath79_spi_cleanup;
if (pdata) {
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 380387a..31cfc87 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -1268,13 +1268,6 @@ static int atmel_spi_setup(struct spi_device *spi)
return -EINVAL;
}
 
-   if (bits  8 || bits  16) {
-   dev_dbg(spi-dev,
-   setup: invalid bits_per_word %u (8 to 16)\n,
-   bits);
-   return -EINVAL;
-   }
-
/* see notes above re chipselect */
if (!atmel_spi_is_v2(as)
 spi-chip_select == 0
@@ -1515,7 +1508,7 @@ static int atmel_spi_probe(struct platform_device *pdev)
 
/* the spi-mode bits understood by this driver: */
master-mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
-
+