Due to a limitation of the ES1.0 modem h/w, in the case of blank modem flahing the driver must not initialize the modem. Otherwise a blank modem (w/o firmware already installed) cannot be successfully flashed.
Added an early parameter 'blank_modem' which if set causes the driver probe routine to perform minimal actions suitable for flashing a blank modem This patch is a temporary fix for a hardware issue. This issue will ultimately be addressed in hardware but this patch is needed until that time. Signed-off-by: Russ Gorby <[email protected]> --- drivers/serial/ifx6x60.c | 67 ++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 65 insertions(+), 2 deletions(-) diff --git a/drivers/serial/ifx6x60.c b/drivers/serial/ifx6x60.c index 8284132..4418887 100644 --- a/drivers/serial/ifx6x60.c +++ b/drivers/serial/ifx6x60.c @@ -76,6 +76,7 @@ static int spi_b16 = 1; /* 8 or 16 bit word length */ static struct tty_driver *tty_drv; static struct ifx_spi_device *saved_ifx_dev; static struct lock_class_key ifx_spi_key; +static unsigned int flashing_blank_modem; static int tm_ignore_srdy; static int tm_ignore_spito; static unsigned int ignore_spito_stop = 10; @@ -1452,7 +1453,7 @@ static int ifx_spi_spi_probe(struct spi_device *spi) { int ret; int srdy; - int modem; + int modem = spi_get_device_id(spi)->driver_data; struct ifx_modem_platform_data *pl_data = NULL; struct ifx_spi_device *ifx_dev; char *drv_name = (char *)spi->dev.driver->name; @@ -1462,6 +1463,46 @@ static int ifx_spi_spi_probe(struct spi_device *spi) dev_dbg(&spi->dev, "ignoring subsequent detection"); return -ENODEV; } + + /* + * FIXME: Workaround for hardware issue + * + * When the kernel is booted with blank_modem=1, do not start ifx_spi + * In this case, GPIOs for modem control are exported, so that the + * user space flashing application can start the modem just before + * initiating the flashing sequence. + * But no modem reset is done from the SPI driver, and the probe + * function exits without further hardware initializations. + * This is required due to a limitation of ES1.0 modem h/w: + * the clock that samples the rst_pmu pin is not present for a + * blank modem. + * So the modem has to be started just before being programmed + */ + if (modem == IFX_6260 && flashing_blank_modem == 1) { + dev_dbg(&spi->dev, "reset disabled to flash blank modem"); + + pl_data = (struct ifx_modem_platform_data *) + spi->dev.platform_data; + ret = gpio_request(pl_data->rst_pmu, "ifxModem"); + ret += gpio_direction_output(pl_data->rst_pmu, 0); + ret += gpio_export(pl_data->rst_pmu, 1); + if (ret) { + dev_err(&spi->dev, "unable to configure GPIO%d (RESET)", + pl_data->rst_pmu); + return -EBUSY; + } + + ret = gpio_request(pl_data->pwr_on, "ifxModem"); + ret += gpio_direction_output(pl_data->pwr_on, 0); + ret += gpio_export(pl_data->pwr_on, 1); + if (ret) { + dev_err(&spi->dev, "unable to configure GPIO%d (RESET)", + pl_data->pwr_on); + return -EBUSY; + } + return 0; + } + /* we check here only the SPI mode and correct them, if needed */ if (IFX_SPI_MODE != (spi->mode & (SPI_CPHA | SPI_CPOL | SPI_CS_HIGH | @@ -1474,7 +1515,6 @@ static int ifx_spi_spi_probe(struct spi_device *spi) if (spi->mode & SPI_LOOP) dev_warn(&spi->dev, "SPI device in loop back"); - modem = spi_get_device_id(spi)->driver_data; switch (modem) { case IFX_6160: spi->max_speed_hz = 12500000; @@ -1797,6 +1837,29 @@ static void __exit ifx_spi_exit(void) } /** + * setup_flash_blank_modem - early parameter function + * + * FIXME: remove when ES1.0 hardware no longer supported + */ +#ifndef MODULE +static int __init setup_flash_blank_modem(char *p) +{ + flashing_blank_modem = 0; + + if (!p) + return -EINVAL; + + if (!strcasecmp(p, "1")) { + flashing_blank_modem = 1; + pr_info("%s : flash blank modem mode is set", DRVNAME); + } + + return 0; +} +early_param("blank_modem", setup_flash_blank_modem); +#endif + +/** * ifx_spi_init - module entry point * * Initialise the SPI and tty interfaces for the IFX SPI driver -- 1.6.0.6 _______________________________________________ MeeGo-kernel mailing list [email protected] http://lists.meego.com/listinfo/meego-kernel
