Re: [RFT][PATCH] spi: clps711x: Refactor to use core message parsing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Понедельник, 17 февраля 2014, 21:59 +08:00 от Axel Lin <axel.lin@xxxxxxxxxx>:
> Convert to use default implementation of transfer_one_message() which provides
> standard handling of delays and chip select management.
> 
> Signed-off-by: Axel Lin <axel.lin@xxxxxxxxxx>
> ---
> Hi Alexander,
> I don't have this hardware, can you help testing this patch.
> Thanks,
> Axel

OK, this will require about a week.

>  drivers/spi/spi-clps711x.c | 89 ++++++++++++++++++++--------------------------
>  1 file changed, 38 insertions(+), 51 deletions(-)
> 
> diff --git a/drivers/spi/spi-clps711x.c b/drivers/spi/spi-clps711x.c
> index f973e97..6ae0cbf 100644
> --- a/drivers/spi/spi-clps711x.c
> +++ b/drivers/spi/spi-clps711x.c
> @@ -24,8 +24,6 @@
>  #define DRIVER_NAME	"spi-clps711x"
>  
>  struct spi_clps711x_data {
> -	struct completion	done;
> -
>  	struct clk		*spi_clk;
>  	u32			max_speed_hz;
>  
> @@ -43,15 +41,6 @@ static int spi_clps711x_setup(struct spi_device *spi)
>  	return 0;
>  }
>  
> -static void spi_clps711x_setup_mode(struct spi_device *spi)
> -{
> -	/* Setup edge for transfer */
> -	if (spi->mode & SPI_CPHA)
> -		clps_writew(clps_readw(SYSCON3) | SYSCON3_ADCCKNSEN, SYSCON3);
> -	else
> -		clps_writew(clps_readw(SYSCON3) & ~SYSCON3_ADCCKNSEN, SYSCON3);
> -}
> -
>  static void spi_clps711x_setup_xfer(struct spi_device *spi,
>  				    struct spi_transfer *xfer)
>  {
> @@ -73,55 +62,52 @@ static void spi_clps711x_setup_xfer(struct spi_device *spi,
>  			    SYSCON1_ADCKSEL(0), SYSCON1);
>  }
>  
> -static int spi_clps711x_transfer_one_message(struct spi_master *master,
> -					     struct spi_message *msg)
> +static void spi_clps711x_set_cs(struct spi_device *spi, bool enable)
>  {
> -	struct spi_clps711x_data *hw = spi_master_get_devdata(master);
> -	struct spi_device *spi = msg->spi;
> -	struct spi_transfer *xfer;
> -
> -	spi_clps711x_setup_mode(spi);
> -
> -	list_for_each_entry(xfer, &msg->transfers, transfer_list) {
> -		u8 data;
> -
> -		spi_clps711x_setup_xfer(spi, xfer);
> -
> +	if (enable)
>  		gpio_set_value(spi->cs_gpio, !!(spi->mode & SPI_CS_HIGH));
> +	else
> +		gpio_set_value(spi->cs_gpio, !(spi->mode & SPI_CS_HIGH));
> +}

You can eliminate spi_clps711x_set_cs() function entirely.
GPIOs can be handled by SPI core, see spi_set_cs() function.

---
��.n��������+%������w��{.n�����{����)��jg��������ݢj����G�������j:+v���w�m������w�������h�����٥





[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux