[Meego-kernel] [Meego Kernel][PATCH] Add support for modem firmware download
Alan Cox
alan at linux.intel.com
Thu Oct 14 04:54:17 PDT 2010
On Wed, 13 Oct 2010 17:28:37 -0700
"Mills, Ken K" <ken.k.mills at intel.com> wrote:
> This patch adds two new ioctl functions to the IFX protocol driver
> that allows the setting of the SPI message transfer size to either
> 2048 or 2060 bytes. This is to enable modem firmware download over
> SPI.
What is the use model for the firmware download. How will I do the
download bit ?
> @@ -682,6 +684,7 @@ static int ifx_spi_ioctl(struct tty_struct *tty,
> struct file *file, unsigned int cmd, unsigned long arg)
> {
> int nreset;
> + int transfer_size;
Should probably an unsigned fixed size type (eg u32)
> struct ifx_spi_device *ifx_dev = saved_ifx_dev;
>
> dev_dbg(&ifx_dev->spi_dev->dev,
> @@ -698,6 +701,31 @@ static int ifx_spi_ioctl(struct tty_struct *tty,
> struct file *file, return -EFAULT;
> break;
>
> + case IFX_GET_SPI_TRANSFER_SIZE:
> + if (!capable(CAP_SYS_RAWIO))
> + return -EPERM;
> + transfer_size = ifx_dev->ifx_transfer_size;
> + if (copy_to_user((int __user *)arg, &transfer_size,
> + sizeof(int)))
> + return -EFAULT;
return put_user(....)
(and no real need for a private copy first)
> + break;
> +
> + case IFX_SET_SPI_TRANSFER_SIZE:
> + if (!capable(CAP_SYS_RAWIO))
> + return -EPERM;
> + if (arg == 0) {
> + ifx_dev->ifx_transfer_size =
It would be more symmetrical to pass the actual size in and check for
2048/2060 (oh yes and what occurs if neither is true for 0/1). Passing
the value also means that the interface doesn't change if a new chip
needs a different size setup.
> /*initialize transfer and dma buffers */
> - ifx_dev->tx_buffer = kzalloc(IFX_SPI_TRANSFER_SIZE,
> + ifx_dev->tx_buffer = kzalloc(IFX_SPI_MAX_BUFFER_SIZE,
> GFP_KERNEL | GFP_DMA);
These are still wrong - you need to use the dma_alloc_ functions for
DMAable buffers.
More information about the Meego-kernel
mailing list