Re: [PATCH] spi: Add PXA2xx SSP SPI Driver

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

 



[email protected] wrote:
> From: Stephen Street <[email protected]>
> 
> The driver turns a PXA2xx synchronous serial port (SSP) into a SPI master 
> controller (see Documentation/spi/spi_summary). The driver has the following
> features:

I've not tested this on my PXA27x platform yet (I'll try and get this
done this tomorrow) but a few comments.

> --- linux-2.6.16-rc2/drivers/spi/pxa2xx_spi.c	1969-12-31 16:00:00.000000000 -0800
> +++ linux-spi/drivers/spi/pxa2xx_spi.c	2006-02-06 18:39:45.339334630 -0800


> +#define CLOCK_SPEED_HZ 3686400

PXA27x has a clock speed of 13000000 Hz.

> +	chip->cr0 = SSCR0_SerClkDiv((CLOCK_SPEED_HZ / spi->max_speed_hz) + 2)

Consider spi->max_speed_hz == CLOCK_SPEED_HZ which gives a divisor of 3
(when it should be 1).

You need SSCR0_SerClkDiv(CLOCK_SPEED_HZ / (spi->max_speed_hz + 1) + 1)
for the correct divisor and for proper rounding.

> +	/* Attach to IRQ */
> +	irq = platform_get_irq(pdev, 0);
> +	if (irq == 0) {
> +		dev_err(&pdev->dev, "irq resource not defined\n");
> +		status = -ENODEV;
> +		goto out_error_master_alloc;
> +	}

Greg K-H has a patch pending that makes platform_get_irq() return -ENXIO
instead of 0 on error.  This is required for SSP3 on the PXA27x which
uses IRQ 0.

> +	/* Release IRQ */
> +	irq = platform_get_irq(pdev, 0);
> +	if (irq != 0)
> +		free_irq(irq, drv_data);

Similarly.

David Vrabel
-- 
David Vrabel, Design Engineer

Arcom, Clifton Road           Tel: +44 (0)1223 411200 ext. 3233
Cambridge CB1 7EA, UK         Web: http://www.arcom.com/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux