Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

serial: ifx6x60: expanded info available from platform data

Some platform attributes (e.g. max_hz, use_dma) were being intuited
from the modem type. These things should be specified by the platform
data.

Added max_hz, use_dma to ifx_modem_platform_data definition,
replaced is_6160 w/ modem_type, and changed clients accordingly

Signed-off-by: Russ Gorby <russ.gorby@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Russ Gorby and committed by
Greg Kroah-Hartman
2f1522ec a5f4dbf0

+32 -24
+17 -16
drivers/tty/serial/ifx6x60.c
··· 8 8 * Jan Dumon <j.dumon@option.com> 9 9 * 10 10 * Copyright (C) 2009, 2010 Intel Corp 11 - * Russ Gorby <richardx.r.gorby@intel.com> 11 + * Russ Gorby <russ.gorby@intel.com> 12 12 * 13 13 * This program is free software; you can redistribute it and/or modify 14 14 * it under the terms of the GNU General Public License version 2 as ··· 732 732 /* 733 733 * setup dma pointers 734 734 */ 735 - if (ifx_dev->is_6160) { 735 + if (ifx_dev->use_dma) { 736 736 ifx_dev->spi_msg.is_dma_mapped = 1; 737 737 ifx_dev->tx_dma = ifx_dev->tx_bus; 738 738 ifx_dev->rx_dma = ifx_dev->rx_bus; ··· 960 960 { 961 961 int ret; 962 962 int srdy; 963 - struct ifx_modem_platform_data *pl_data = NULL; 963 + struct ifx_modem_platform_data *pl_data; 964 964 struct ifx_spi_device *ifx_dev; 965 965 966 966 if (saved_ifx_dev) { 967 967 dev_dbg(&spi->dev, "ignoring subsequent detection"); 968 + return -ENODEV; 969 + } 970 + 971 + pl_data = (struct ifx_modem_platform_data *)spi->dev.platform_data; 972 + if (!pl_data) { 973 + dev_err(&spi->dev, "missing platform data!"); 968 974 return -ENODEV; 969 975 } 970 976 ··· 989 983 init_timer(&ifx_dev->spi_timer); 990 984 ifx_dev->spi_timer.function = ifx_spi_timeout; 991 985 ifx_dev->spi_timer.data = (unsigned long)ifx_dev; 992 - ifx_dev->is_6160 = pl_data->is_6160; 986 + ifx_dev->modem = pl_data->modem_type; 987 + ifx_dev->use_dma = pl_data->use_dma; 988 + ifx_dev->max_hz = pl_data->max_hz; 993 989 994 990 /* ensure SPI protocol flags are initialized to enable transfer */ 995 991 ifx_dev->spi_more = 0; ··· 1033 1025 goto error_ret; 1034 1026 } 1035 1027 1036 - pl_data = (struct ifx_modem_platform_data *)spi->dev.platform_data; 1037 - if (pl_data) { 1038 - ifx_dev->gpio.reset = pl_data->rst_pmu; 1039 - ifx_dev->gpio.po = pl_data->pwr_on; 1040 - ifx_dev->gpio.mrdy = pl_data->mrdy; 1041 - ifx_dev->gpio.srdy = pl_data->srdy; 1042 - ifx_dev->gpio.reset_out = pl_data->rst_out; 1043 - } else { 1044 - dev_err(&spi->dev, "missing platform data!"); 1045 - ret = -ENODEV; 1046 - goto error_ret; 1047 - } 1028 + ifx_dev->gpio.reset = pl_data->rst_pmu; 1029 + ifx_dev->gpio.po = pl_data->pwr_on; 1030 + ifx_dev->gpio.mrdy = pl_data->mrdy; 1031 + ifx_dev->gpio.srdy = pl_data->srdy; 1032 + ifx_dev->gpio.reset_out = pl_data->rst_out; 1048 1033 1049 1034 dev_info(&spi->dev, "gpios %d, %d, %d, %d, %d", 1050 1035 ifx_dev->gpio.reset, ifx_dev->gpio.po, ifx_dev->gpio.mrdy,
+3 -1
drivers/tty/serial/ifx6x60.h
··· 88 88 dma_addr_t rx_dma; 89 89 dma_addr_t tx_dma; 90 90 91 - int is_6160; /* Modem type */ 91 + int modem; /* Modem type */ 92 + int use_dma; /* provide dma-able addrs in SPI msg */ 93 + long max_hz; /* max SPI frequency */ 92 94 93 95 spinlock_t write_lock; 94 96 int write_pending;
+12 -7
include/linux/spi/ifx_modem.h
··· 2 2 #define LINUX_IFX_MODEM_H 3 3 4 4 struct ifx_modem_platform_data { 5 - unsigned short rst_out; /* modem reset out */ 6 - unsigned short pwr_on; /* power on */ 7 - unsigned short rst_pmu; /* reset modem */ 8 - unsigned short tx_pwr; /* modem power threshold */ 9 - unsigned short srdy; /* SRDY */ 10 - unsigned short mrdy; /* MRDY */ 11 - unsigned short is_6160; /* Modem type */ 5 + unsigned short rst_out; /* modem reset out */ 6 + unsigned short pwr_on; /* power on */ 7 + unsigned short rst_pmu; /* reset modem */ 8 + unsigned short tx_pwr; /* modem power threshold */ 9 + unsigned short srdy; /* SRDY */ 10 + unsigned short mrdy; /* MRDY */ 11 + unsigned char modem_type; /* Modem type */ 12 + unsigned long max_hz; /* max SPI frequency */ 13 + unsigned short use_dma:1; /* spi protocol driver supplies 14 + dma-able addrs */ 12 15 }; 16 + #define IFX_MODEM_6160 1 17 + #define IFX_MODEM_6260 2 13 18 14 19 #endif