2019-05-28 19:57:05 +03:00
// SPDX-License-Identifier: GPL-2.0-only
2010-02-04 14:18:52 +03:00
/*
* timberdale . c timberdale FPGA MFD driver
* Copyright ( c ) 2009 Intel Corporation
*/
/* Supports:
* Timberdale FPGA
*/
# include <linux/kernel.h>
# include <linux/module.h>
# include <linux/pci.h>
# include <linux/msi.h>
# include <linux/mfd/core.h>
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 11:04:11 +03:00
# include <linux/slab.h>
2010-02-04 14:18:52 +03:00
# include <linux/timb_gpio.h>
# include <linux/i2c.h>
2018-04-19 23:00:09 +03:00
# include <linux/platform_data/i2c-ocores.h>
2018-04-19 23:00:12 +03:00
# include <linux/platform_data/i2c-xiic.h>
2010-02-04 14:18:52 +03:00
# include <linux/spi/spi.h>
# include <linux/spi/xilinx_spi.h>
# include <linux/spi/max7301.h>
# include <linux/spi/mc33880.h>
2017-05-23 02:30:04 +03:00
# include <linux/platform_data/tsc2007.h>
2015-11-16 13:35:53 +03:00
# include <linux/platform_data/media/timb_radio.h>
# include <linux/platform_data/media/timb_video.h>
2010-02-20 01:41:54 +03:00
2010-03-25 21:44:23 +03:00
# include <linux/timb_dma.h>
2010-09-15 18:49:24 +04:00
# include <linux/ks8842.h>
2010-02-04 14:18:52 +03:00
# include "timberdale.h"
# define DRIVER_NAME "timberdale"
struct timberdale_device {
resource_size_t ctl_mapbase ;
unsigned char __iomem * ctl_membase ;
struct {
u32 major ;
u32 minor ;
u32 config ;
} fw ;
} ;
/*--------------------------------------------------------------------------*/
static struct tsc2007_platform_data timberdale_tsc2007_platform_data = {
. model = 2003 ,
. x_plate_ohms = 100
} ;
static struct i2c_board_info timberdale_i2c_board_info [ ] = {
{
I2C_BOARD_INFO ( " tsc2007 " , 0x48 ) ,
. platform_data = & timberdale_tsc2007_platform_data ,
. irq = IRQ_TIMBERDALE_TSC_INT
} ,
} ;
2012-11-19 22:24:21 +04:00
static struct xiic_i2c_platform_data
2010-03-16 12:43:28 +03:00
timberdale_xiic_platform_data = {
. devices = timberdale_i2c_board_info ,
. num_devices = ARRAY_SIZE ( timberdale_i2c_board_info )
} ;
2012-11-19 22:24:21 +04:00
static struct ocores_i2c_platform_data
2010-02-04 14:18:52 +03:00
timberdale_ocores_platform_data = {
2012-07-13 17:44:24 +04:00
. reg_shift = 2 ,
2010-02-04 14:18:52 +03:00
. clock_khz = 62500 ,
. devices = timberdale_i2c_board_info ,
. num_devices = ARRAY_SIZE ( timberdale_i2c_board_info )
} ;
2012-11-19 22:25:09 +04:00
static const struct resource timberdale_xiic_resources [ ] = {
2010-03-16 12:43:28 +03:00
{
. start = XIICOFFSET ,
. end = XIICEND ,
. flags = IORESOURCE_MEM ,
} ,
{
. start = IRQ_TIMBERDALE_I2C ,
. end = IRQ_TIMBERDALE_I2C ,
. flags = IORESOURCE_IRQ ,
} ,
} ;
2012-11-19 22:25:09 +04:00
static const struct resource timberdale_ocores_resources [ ] = {
2010-02-04 14:18:52 +03:00
{
. start = OCORESOFFSET ,
. end = OCORESEND ,
. flags = IORESOURCE_MEM ,
} ,
{
. start = IRQ_TIMBERDALE_I2C ,
. end = IRQ_TIMBERDALE_I2C ,
. flags = IORESOURCE_IRQ ,
} ,
} ;
2013-08-23 14:11:03 +04:00
static const struct max7301_platform_data timberdale_max7301_platform_data = {
2010-02-04 14:18:52 +03:00
. base = 200
} ;
2013-08-23 14:11:03 +04:00
static const struct mc33880_platform_data timberdale_mc33880_platform_data = {
2010-02-04 14:18:52 +03:00
. base = 100
} ;
static struct spi_board_info timberdale_spi_16bit_board_info [ ] = {
{
. modalias = " max7301 " ,
. max_speed_hz = 26000 ,
. chip_select = 2 ,
. mode = SPI_MODE_0 ,
. platform_data = & timberdale_max7301_platform_data
} ,
} ;
static struct spi_board_info timberdale_spi_8bit_board_info [ ] = {
{
. modalias = " mc33880 " ,
. max_speed_hz = 4000 ,
. chip_select = 1 ,
. mode = SPI_MODE_1 ,
. platform_data = & timberdale_mc33880_platform_data
} ,
} ;
2012-11-19 22:24:21 +04:00
static struct xspi_platform_data timberdale_xspi_platform_data = {
2010-02-04 14:18:52 +03:00
. num_chipselect = 3 ,
/* bits per word and devices will be filled in runtime depending
* on the HW config
*/
} ;
2012-11-19 22:25:09 +04:00
static const struct resource timberdale_spi_resources [ ] = {
2010-02-04 14:18:52 +03:00
{
. start = SPIOFFSET ,
. end = SPIEND ,
. flags = IORESOURCE_MEM ,
} ,
{
. start = IRQ_TIMBERDALE_SPI ,
. end = IRQ_TIMBERDALE_SPI ,
. flags = IORESOURCE_IRQ ,
} ,
} ;
2012-11-19 22:24:21 +04:00
static struct ks8842_platform_data
2010-09-15 18:49:24 +04:00
timberdale_ks8842_platform_data = {
. rx_dma_channel = DMA_ETH_RX ,
. tx_dma_channel = DMA_ETH_TX
} ;
2012-11-19 22:25:09 +04:00
static const struct resource timberdale_eth_resources [ ] = {
2010-02-04 14:18:52 +03:00
{
. start = ETHOFFSET ,
. end = ETHEND ,
. flags = IORESOURCE_MEM ,
} ,
{
. start = IRQ_TIMBERDALE_ETHSW_IF ,
. end = IRQ_TIMBERDALE_ETHSW_IF ,
. flags = IORESOURCE_IRQ ,
} ,
} ;
2012-11-19 22:24:21 +04:00
static struct timbgpio_platform_data
2010-02-04 14:18:52 +03:00
timberdale_gpio_platform_data = {
. gpio_base = 0 ,
. nr_pins = GPIO_NR_PINS ,
. irq_base = 200 ,
} ;
2012-11-19 22:25:09 +04:00
static const struct resource timberdale_gpio_resources [ ] = {
2010-02-04 14:18:52 +03:00
{
. start = GPIOOFFSET ,
. end = GPIOEND ,
. flags = IORESOURCE_MEM ,
} ,
{
. start = IRQ_TIMBERDALE_GPIO ,
. end = IRQ_TIMBERDALE_GPIO ,
. flags = IORESOURCE_IRQ ,
} ,
} ;
2012-11-19 22:25:09 +04:00
static const struct resource timberdale_mlogicore_resources [ ] = {
2010-02-04 14:18:52 +03:00
{
. start = MLCOREOFFSET ,
. end = MLCOREEND ,
. flags = IORESOURCE_MEM ,
} ,
{
. start = IRQ_TIMBERDALE_MLCORE ,
. end = IRQ_TIMBERDALE_MLCORE ,
. flags = IORESOURCE_IRQ ,
} ,
{
. start = IRQ_TIMBERDALE_MLCORE_BUF ,
. end = IRQ_TIMBERDALE_MLCORE_BUF ,
. flags = IORESOURCE_IRQ ,
} ,
} ;
2012-11-19 22:25:09 +04:00
static const struct resource timberdale_uart_resources [ ] = {
2010-02-04 14:18:52 +03:00
{
. start = UARTOFFSET ,
. end = UARTEND ,
. flags = IORESOURCE_MEM ,
} ,
{
. start = IRQ_TIMBERDALE_UART ,
. end = IRQ_TIMBERDALE_UART ,
. flags = IORESOURCE_IRQ ,
} ,
} ;
2012-11-19 22:25:09 +04:00
static const struct resource timberdale_uartlite_resources [ ] = {
2010-02-04 14:18:52 +03:00
{
. start = UARTLITEOFFSET ,
. end = UARTLITEEND ,
. flags = IORESOURCE_MEM ,
} ,
{
. start = IRQ_TIMBERDALE_UARTLITE ,
. end = IRQ_TIMBERDALE_UARTLITE ,
. flags = IORESOURCE_IRQ ,
} ,
} ;
2012-11-19 22:24:21 +04:00
static struct i2c_board_info timberdale_adv7180_i2c_board_info = {
2010-11-08 16:45:48 +03:00
/* Requires jumper JP9 to be off */
I2C_BOARD_INFO ( " adv7180 " , 0x42 > > 1 ) ,
. irq = IRQ_TIMBERDALE_ADV7180
} ;
2012-11-19 22:24:21 +04:00
static struct timb_video_platform_data
2010-11-08 16:45:48 +03:00
timberdale_video_platform_data = {
. dma_channel = DMA_VIDEO_RX ,
. i2c_adapter = 0 ,
. encoder = {
. info = & timberdale_adv7180_i2c_board_info
}
} ;
2012-11-19 22:25:09 +04:00
static const struct resource
2010-11-08 16:45:48 +03:00
timberdale_radio_resources [ ] = {
2010-02-20 01:41:54 +03:00
{
. start = RDSOFFSET ,
. end = RDSEND ,
. flags = IORESOURCE_MEM ,
} ,
{
. start = IRQ_TIMBERDALE_RDS ,
. end = IRQ_TIMBERDALE_RDS ,
. flags = IORESOURCE_IRQ ,
} ,
} ;
2012-11-19 22:24:21 +04:00
static struct i2c_board_info timberdale_tef6868_i2c_board_info = {
2010-02-20 01:41:54 +03:00
I2C_BOARD_INFO ( " tef6862 " , 0x60 )
} ;
2012-11-19 22:24:21 +04:00
static struct i2c_board_info timberdale_saa7706_i2c_board_info = {
2010-02-20 01:41:54 +03:00
I2C_BOARD_INFO ( " saa7706h " , 0x1C )
} ;
2012-11-19 22:24:21 +04:00
static struct timb_radio_platform_data
2010-02-20 01:41:54 +03:00
timberdale_radio_platform_data = {
. i2c_adapter = 0 ,
2011-06-10 18:48:48 +04:00
. tuner = & timberdale_tef6868_i2c_board_info ,
. dsp = & timberdale_saa7706_i2c_board_info
2010-02-20 01:41:54 +03:00
} ;
2012-11-19 22:25:09 +04:00
static const struct resource timberdale_video_resources [ ] = {
2010-11-08 16:45:48 +03:00
{
. start = LOGIWOFFSET ,
. end = LOGIWEND ,
. flags = IORESOURCE_MEM ,
} ,
/*
note that the " frame buffer " is located in DMA area
starting at 0x1200000
*/
} ;
2012-11-19 22:24:21 +04:00
static struct timb_dma_platform_data timb_dma_platform_data = {
2010-03-25 21:44:23 +03:00
. nr_channels = 10 ,
. channels = {
{
/* UART RX */
. rx = true ,
. descriptors = 2 ,
. descriptor_elements = 1
} ,
{
/* UART TX */
. rx = false ,
. descriptors = 2 ,
. descriptor_elements = 1
} ,
{
/* MLB RX */
. rx = true ,
. descriptors = 2 ,
. descriptor_elements = 1
} ,
{
/* MLB TX */
. rx = false ,
. descriptors = 2 ,
. descriptor_elements = 1
} ,
{
/* Video RX */
. rx = true ,
. bytes_per_line = 1440 ,
. descriptors = 2 ,
. descriptor_elements = 16
} ,
{
/* Video framedrop */
} ,
{
/* SDHCI RX */
. rx = true ,
} ,
{
/* SDHCI TX */
} ,
{
/* ETH RX */
. rx = true ,
. descriptors = 2 ,
. descriptor_elements = 1
} ,
{
/* ETH TX */
. rx = false ,
. descriptors = 2 ,
. descriptor_elements = 1
} ,
}
} ;
2012-11-19 22:25:09 +04:00
static const struct resource timberdale_dma_resources [ ] = {
2010-02-04 14:18:52 +03:00
{
. start = DMAOFFSET ,
. end = DMAEND ,
. flags = IORESOURCE_MEM ,
} ,
{
. start = IRQ_TIMBERDALE_DMA ,
. end = IRQ_TIMBERDALE_DMA ,
. flags = IORESOURCE_IRQ ,
} ,
} ;
2013-11-18 17:33:06 +04:00
static const struct mfd_cell timberdale_cells_bar0_cfg0 [ ] = {
2010-03-25 21:44:23 +03:00
{
. name = " timb-dma " ,
. num_resources = ARRAY_SIZE ( timberdale_dma_resources ) ,
. resources = timberdale_dma_resources ,
2011-04-08 03:23:57 +04:00
. platform_data = & timb_dma_platform_data ,
. pdata_size = sizeof ( timb_dma_platform_data ) ,
2010-03-25 21:44:23 +03:00
} ,
2010-02-04 14:18:52 +03:00
{
. name = " timb-uart " ,
. num_resources = ARRAY_SIZE ( timberdale_uart_resources ) ,
. resources = timberdale_uart_resources ,
} ,
2010-03-16 12:43:28 +03:00
{
. name = " xiic-i2c " ,
. num_resources = ARRAY_SIZE ( timberdale_xiic_resources ) ,
. resources = timberdale_xiic_resources ,
2011-04-08 03:23:57 +04:00
. platform_data = & timberdale_xiic_platform_data ,
. pdata_size = sizeof ( timberdale_xiic_platform_data ) ,
2010-03-16 12:43:28 +03:00
} ,
2010-02-04 14:18:52 +03:00
{
. name = " timb-gpio " ,
. num_resources = ARRAY_SIZE ( timberdale_gpio_resources ) ,
. resources = timberdale_gpio_resources ,
2011-04-08 03:23:57 +04:00
. platform_data = & timberdale_gpio_platform_data ,
. pdata_size = sizeof ( timberdale_gpio_platform_data ) ,
2010-02-04 14:18:52 +03:00
} ,
2010-11-08 16:45:48 +03:00
{
. name = " timb-video " ,
. num_resources = ARRAY_SIZE ( timberdale_video_resources ) ,
. resources = timberdale_video_resources ,
2011-04-08 03:23:57 +04:00
. platform_data = & timberdale_video_platform_data ,
. pdata_size = sizeof ( timberdale_video_platform_data ) ,
2010-11-08 16:45:48 +03:00
} ,
2010-02-20 01:41:54 +03:00
{
. name = " timb-radio " ,
. num_resources = ARRAY_SIZE ( timberdale_radio_resources ) ,
. resources = timberdale_radio_resources ,
2011-04-08 03:23:57 +04:00
. platform_data = & timberdale_radio_platform_data ,
. pdata_size = sizeof ( timberdale_radio_platform_data ) ,
2010-02-20 01:41:54 +03:00
} ,
2010-02-04 14:18:52 +03:00
{
. name = " xilinx_spi " ,
. num_resources = ARRAY_SIZE ( timberdale_spi_resources ) ,
. resources = timberdale_spi_resources ,
2011-04-08 03:23:57 +04:00
. platform_data = & timberdale_xspi_platform_data ,
. pdata_size = sizeof ( timberdale_xspi_platform_data ) ,
2010-02-04 14:18:52 +03:00
} ,
{
. name = " ks8842 " ,
. num_resources = ARRAY_SIZE ( timberdale_eth_resources ) ,
. resources = timberdale_eth_resources ,
2011-04-08 03:23:57 +04:00
. platform_data = & timberdale_ks8842_platform_data ,
. pdata_size = sizeof ( timberdale_ks8842_platform_data ) ,
2010-02-04 14:18:52 +03:00
} ,
2010-03-25 21:44:23 +03:00
} ;
2013-11-18 17:33:06 +04:00
static const struct mfd_cell timberdale_cells_bar0_cfg1 [ ] = {
2010-02-04 14:18:52 +03:00
{
. name = " timb-dma " ,
. num_resources = ARRAY_SIZE ( timberdale_dma_resources ) ,
. resources = timberdale_dma_resources ,
2011-04-08 03:23:57 +04:00
. platform_data = & timb_dma_platform_data ,
. pdata_size = sizeof ( timb_dma_platform_data ) ,
2010-02-04 14:18:52 +03:00
} ,
{
. name = " timb-uart " ,
. num_resources = ARRAY_SIZE ( timberdale_uart_resources ) ,
. resources = timberdale_uart_resources ,
} ,
{
. name = " uartlite " ,
. num_resources = ARRAY_SIZE ( timberdale_uartlite_resources ) ,
. resources = timberdale_uartlite_resources ,
} ,
2010-03-16 12:43:28 +03:00
{
. name = " xiic-i2c " ,
. num_resources = ARRAY_SIZE ( timberdale_xiic_resources ) ,
. resources = timberdale_xiic_resources ,
2011-04-08 03:23:57 +04:00
. platform_data = & timberdale_xiic_platform_data ,
. pdata_size = sizeof ( timberdale_xiic_platform_data ) ,
2010-03-16 12:43:28 +03:00
} ,
2010-02-04 14:18:52 +03:00
{
. name = " timb-gpio " ,
. num_resources = ARRAY_SIZE ( timberdale_gpio_resources ) ,
. resources = timberdale_gpio_resources ,
2011-04-08 03:23:57 +04:00
. platform_data = & timberdale_gpio_platform_data ,
. pdata_size = sizeof ( timberdale_gpio_platform_data ) ,
2010-02-04 14:18:52 +03:00
} ,
{
. name = " timb-mlogicore " ,
. num_resources = ARRAY_SIZE ( timberdale_mlogicore_resources ) ,
. resources = timberdale_mlogicore_resources ,
} ,
2010-11-08 16:45:48 +03:00
{
. name = " timb-video " ,
. num_resources = ARRAY_SIZE ( timberdale_video_resources ) ,
. resources = timberdale_video_resources ,
2011-04-08 03:23:57 +04:00
. platform_data = & timberdale_video_platform_data ,
. pdata_size = sizeof ( timberdale_video_platform_data ) ,
2010-11-08 16:45:48 +03:00
} ,
2010-02-20 01:41:54 +03:00
{
. name = " timb-radio " ,
. num_resources = ARRAY_SIZE ( timberdale_radio_resources ) ,
. resources = timberdale_radio_resources ,
2011-04-08 03:23:57 +04:00
. platform_data = & timberdale_radio_platform_data ,
. pdata_size = sizeof ( timberdale_radio_platform_data ) ,
2010-02-20 01:41:54 +03:00
} ,
2010-02-04 14:18:52 +03:00
{
. name = " xilinx_spi " ,
. num_resources = ARRAY_SIZE ( timberdale_spi_resources ) ,
. resources = timberdale_spi_resources ,
2011-04-08 03:23:57 +04:00
. platform_data = & timberdale_xspi_platform_data ,
. pdata_size = sizeof ( timberdale_xspi_platform_data ) ,
2010-02-04 14:18:52 +03:00
} ,
{
. name = " ks8842 " ,
. num_resources = ARRAY_SIZE ( timberdale_eth_resources ) ,
. resources = timberdale_eth_resources ,
2011-04-08 03:23:57 +04:00
. platform_data = & timberdale_ks8842_platform_data ,
. pdata_size = sizeof ( timberdale_ks8842_platform_data ) ,
2010-02-04 14:18:52 +03:00
} ,
2010-03-25 21:44:23 +03:00
} ;
2013-11-18 17:33:06 +04:00
static const struct mfd_cell timberdale_cells_bar0_cfg2 [ ] = {
2010-02-04 14:18:52 +03:00
{
. name = " timb-dma " ,
. num_resources = ARRAY_SIZE ( timberdale_dma_resources ) ,
. resources = timberdale_dma_resources ,
2011-04-08 03:23:57 +04:00
. platform_data = & timb_dma_platform_data ,
. pdata_size = sizeof ( timb_dma_platform_data ) ,
2010-02-04 14:18:52 +03:00
} ,
{
. name = " timb-uart " ,
. num_resources = ARRAY_SIZE ( timberdale_uart_resources ) ,
. resources = timberdale_uart_resources ,
} ,
2010-03-16 12:43:28 +03:00
{
. name = " xiic-i2c " ,
. num_resources = ARRAY_SIZE ( timberdale_xiic_resources ) ,
. resources = timberdale_xiic_resources ,
2011-04-08 03:23:57 +04:00
. platform_data = & timberdale_xiic_platform_data ,
. pdata_size = sizeof ( timberdale_xiic_platform_data ) ,
2010-03-16 12:43:28 +03:00
} ,
2010-02-04 14:18:52 +03:00
{
. name = " timb-gpio " ,
. num_resources = ARRAY_SIZE ( timberdale_gpio_resources ) ,
. resources = timberdale_gpio_resources ,
2011-04-08 03:23:57 +04:00
. platform_data = & timberdale_gpio_platform_data ,
. pdata_size = sizeof ( timberdale_gpio_platform_data ) ,
2010-02-04 14:18:52 +03:00
} ,
2010-11-08 16:45:48 +03:00
{
. name = " timb-video " ,
. num_resources = ARRAY_SIZE ( timberdale_video_resources ) ,
. resources = timberdale_video_resources ,
2011-04-08 03:23:57 +04:00
. platform_data = & timberdale_video_platform_data ,
. pdata_size = sizeof ( timberdale_video_platform_data ) ,
2010-11-08 16:45:48 +03:00
} ,
2010-02-20 01:41:54 +03:00
{
. name = " timb-radio " ,
. num_resources = ARRAY_SIZE ( timberdale_radio_resources ) ,
. resources = timberdale_radio_resources ,
2011-04-08 03:23:57 +04:00
. platform_data = & timberdale_radio_platform_data ,
. pdata_size = sizeof ( timberdale_radio_platform_data ) ,
2010-02-20 01:41:54 +03:00
} ,
2010-02-04 14:18:52 +03:00
{
. name = " xilinx_spi " ,
. num_resources = ARRAY_SIZE ( timberdale_spi_resources ) ,
. resources = timberdale_spi_resources ,
2011-04-08 03:23:57 +04:00
. platform_data = & timberdale_xspi_platform_data ,
. pdata_size = sizeof ( timberdale_xspi_platform_data ) ,
2010-02-04 14:18:52 +03:00
} ,
2010-03-25 21:44:23 +03:00
} ;
2013-11-18 17:33:06 +04:00
static const struct mfd_cell timberdale_cells_bar0_cfg3 [ ] = {
2010-02-04 14:18:52 +03:00
{
. name = " timb-dma " ,
. num_resources = ARRAY_SIZE ( timberdale_dma_resources ) ,
. resources = timberdale_dma_resources ,
2011-04-08 03:23:57 +04:00
. platform_data = & timb_dma_platform_data ,
. pdata_size = sizeof ( timb_dma_platform_data ) ,
2010-02-04 14:18:52 +03:00
} ,
{
. name = " timb-uart " ,
. num_resources = ARRAY_SIZE ( timberdale_uart_resources ) ,
. resources = timberdale_uart_resources ,
} ,
{
. name = " ocores-i2c " ,
. num_resources = ARRAY_SIZE ( timberdale_ocores_resources ) ,
. resources = timberdale_ocores_resources ,
2011-04-08 03:23:57 +04:00
. platform_data = & timberdale_ocores_platform_data ,
. pdata_size = sizeof ( timberdale_ocores_platform_data ) ,
2010-02-04 14:18:52 +03:00
} ,
{
. name = " timb-gpio " ,
. num_resources = ARRAY_SIZE ( timberdale_gpio_resources ) ,
. resources = timberdale_gpio_resources ,
2011-04-08 03:23:57 +04:00
. platform_data = & timberdale_gpio_platform_data ,
. pdata_size = sizeof ( timberdale_gpio_platform_data ) ,
2010-02-04 14:18:52 +03:00
} ,
2010-11-08 16:45:48 +03:00
{
. name = " timb-video " ,
. num_resources = ARRAY_SIZE ( timberdale_video_resources ) ,
. resources = timberdale_video_resources ,
2011-04-08 03:23:57 +04:00
. platform_data = & timberdale_video_platform_data ,
. pdata_size = sizeof ( timberdale_video_platform_data ) ,
2010-11-08 16:45:48 +03:00
} ,
2010-02-20 01:41:54 +03:00
{
. name = " timb-radio " ,
. num_resources = ARRAY_SIZE ( timberdale_radio_resources ) ,
. resources = timberdale_radio_resources ,
2011-04-08 03:23:57 +04:00
. platform_data = & timberdale_radio_platform_data ,
. pdata_size = sizeof ( timberdale_radio_platform_data ) ,
2010-02-20 01:41:54 +03:00
} ,
2010-02-04 14:18:52 +03:00
{
. name = " xilinx_spi " ,
. num_resources = ARRAY_SIZE ( timberdale_spi_resources ) ,
. resources = timberdale_spi_resources ,
2011-04-08 03:23:57 +04:00
. platform_data = & timberdale_xspi_platform_data ,
. pdata_size = sizeof ( timberdale_xspi_platform_data ) ,
2010-02-04 14:18:52 +03:00
} ,
{
. name = " ks8842 " ,
. num_resources = ARRAY_SIZE ( timberdale_eth_resources ) ,
. resources = timberdale_eth_resources ,
2011-04-08 03:23:57 +04:00
. platform_data = & timberdale_ks8842_platform_data ,
. pdata_size = sizeof ( timberdale_ks8842_platform_data ) ,
2010-02-04 14:18:52 +03:00
} ,
} ;
2012-11-19 22:25:09 +04:00
static const struct resource timberdale_sdhc_resources [ ] = {
2010-02-04 14:18:52 +03:00
/* located in bar 1 and bar 2 */
{
. start = SDHC0OFFSET ,
. end = SDHC0END ,
. flags = IORESOURCE_MEM ,
} ,
{
. start = IRQ_TIMBERDALE_SDHC ,
. end = IRQ_TIMBERDALE_SDHC ,
. flags = IORESOURCE_IRQ ,
} ,
} ;
2013-11-18 17:33:06 +04:00
static const struct mfd_cell timberdale_cells_bar1 [ ] = {
2010-02-04 14:18:52 +03:00
{
. name = " sdhci " ,
. num_resources = ARRAY_SIZE ( timberdale_sdhc_resources ) ,
. resources = timberdale_sdhc_resources ,
} ,
} ;
2013-11-18 17:33:06 +04:00
static const struct mfd_cell timberdale_cells_bar2 [ ] = {
2010-02-04 14:18:52 +03:00
{
. name = " sdhci " ,
. num_resources = ARRAY_SIZE ( timberdale_sdhc_resources ) ,
. resources = timberdale_sdhc_resources ,
} ,
} ;
static ssize_t show_fw_ver ( struct device * dev , struct device_attribute * attr ,
char * buf )
{
2019-07-23 14:51:03 +03:00
struct timberdale_device * priv = dev_get_drvdata ( dev ) ;
2010-02-04 14:18:52 +03:00
return sprintf ( buf , " %d.%d.%d \n " , priv - > fw . major , priv - > fw . minor ,
priv - > fw . config ) ;
}
static DEVICE_ATTR ( fw_ver , S_IRUGO , show_fw_ver , NULL ) ;
/*--------------------------------------------------------------------------*/
2012-11-19 22:23:04 +04:00
static int timb_probe ( struct pci_dev * dev ,
2010-02-04 14:18:52 +03:00
const struct pci_device_id * id )
{
struct timberdale_device * priv ;
int err , i ;
resource_size_t mapbase ;
struct msix_entry * msix_entries = NULL ;
u8 ip_setup ;
priv = kzalloc ( sizeof ( * priv ) , GFP_KERNEL ) ;
if ( ! priv )
return - ENOMEM ;
pci_set_drvdata ( dev , priv ) ;
err = pci_enable_device ( dev ) ;
if ( err )
goto err_enable ;
mapbase = pci_resource_start ( dev , 0 ) ;
if ( ! mapbase ) {
dev_err ( & dev - > dev , " No resource \n " ) ;
goto err_start ;
}
/* create a resource for the PCI master register */
priv - > ctl_mapbase = mapbase + CHIPCTLOFFSET ;
if ( ! request_mem_region ( priv - > ctl_mapbase , CHIPCTLSIZE , " timb-ctl " ) ) {
dev_err ( & dev - > dev , " Failed to request ctl mem \n " ) ;
2013-09-13 06:23:57 +04:00
goto err_start ;
2010-02-04 14:18:52 +03:00
}
priv - > ctl_membase = ioremap ( priv - > ctl_mapbase , CHIPCTLSIZE ) ;
if ( ! priv - > ctl_membase ) {
dev_err ( & dev - > dev , " ioremap failed for ctl mem \n " ) ;
goto err_ioremap ;
}
/* read the HW config */
priv - > fw . major = ioread32 ( priv - > ctl_membase + TIMB_REV_MAJOR ) ;
priv - > fw . minor = ioread32 ( priv - > ctl_membase + TIMB_REV_MINOR ) ;
priv - > fw . config = ioread32 ( priv - > ctl_membase + TIMB_HW_CONFIG ) ;
if ( priv - > fw . major > TIMB_SUPPORTED_MAJOR ) {
dev_err ( & dev - > dev , " The driver supports an older "
" version of the FPGA, please update the driver to "
" support %d.%d \n " , priv - > fw . major , priv - > fw . minor ) ;
2011-08-10 12:47:16 +04:00
goto err_config ;
2010-02-04 14:18:52 +03:00
}
if ( priv - > fw . major < TIMB_SUPPORTED_MAJOR | |
priv - > fw . minor < TIMB_REQUIRED_MINOR ) {
dev_err ( & dev - > dev , " The FPGA image is too old (%d.%d), "
" please upgrade the FPGA to at least: %d.%d \n " ,
priv - > fw . major , priv - > fw . minor ,
TIMB_SUPPORTED_MAJOR , TIMB_REQUIRED_MINOR ) ;
2011-08-10 12:47:16 +04:00
goto err_config ;
2010-02-04 14:18:52 +03:00
}
treewide: kzalloc() -> kcalloc()
The kzalloc() function has a 2-factor argument form, kcalloc(). This
patch replaces cases of:
kzalloc(a * b, gfp)
with:
kcalloc(a * b, gfp)
as well as handling cases of:
kzalloc(a * b * c, gfp)
with:
kzalloc(array3_size(a, b, c), gfp)
as it's slightly less ugly than:
kzalloc_array(array_size(a, b), c, gfp)
This does, however, attempt to ignore constant size factors like:
kzalloc(4 * 1024, gfp)
though any constants defined via macros get caught up in the conversion.
Any factors with a sizeof() of "unsigned char", "char", and "u8" were
dropped, since they're redundant.
The Coccinelle script used for this was:
// Fix redundant parens around sizeof().
@@
type TYPE;
expression THING, E;
@@
(
kzalloc(
- (sizeof(TYPE)) * E
+ sizeof(TYPE) * E
, ...)
|
kzalloc(
- (sizeof(THING)) * E
+ sizeof(THING) * E
, ...)
)
// Drop single-byte sizes and redundant parens.
@@
expression COUNT;
typedef u8;
typedef __u8;
@@
(
kzalloc(
- sizeof(u8) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(__u8) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(char) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(unsigned char) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(u8) * COUNT
+ COUNT
, ...)
|
kzalloc(
- sizeof(__u8) * COUNT
+ COUNT
, ...)
|
kzalloc(
- sizeof(char) * COUNT
+ COUNT
, ...)
|
kzalloc(
- sizeof(unsigned char) * COUNT
+ COUNT
, ...)
)
// 2-factor product with sizeof(type/expression) and identifier or constant.
@@
type TYPE;
expression THING;
identifier COUNT_ID;
constant COUNT_CONST;
@@
(
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * (COUNT_ID)
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * COUNT_ID
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * (COUNT_CONST)
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * COUNT_CONST
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * (COUNT_ID)
+ COUNT_ID, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * COUNT_ID
+ COUNT_ID, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * (COUNT_CONST)
+ COUNT_CONST, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * COUNT_CONST
+ COUNT_CONST, sizeof(THING)
, ...)
)
// 2-factor product, only identifiers.
@@
identifier SIZE, COUNT;
@@
- kzalloc
+ kcalloc
(
- SIZE * COUNT
+ COUNT, SIZE
, ...)
// 3-factor product with 1 sizeof(type) or sizeof(expression), with
// redundant parens removed.
@@
expression THING;
identifier STRIDE, COUNT;
type TYPE;
@@
(
kzalloc(
- sizeof(TYPE) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(TYPE) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(TYPE) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(TYPE) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(THING) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
kzalloc(
- sizeof(THING) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
kzalloc(
- sizeof(THING) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
kzalloc(
- sizeof(THING) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
)
// 3-factor product with 2 sizeof(variable), with redundant parens removed.
@@
expression THING1, THING2;
identifier COUNT;
type TYPE1, TYPE2;
@@
(
kzalloc(
- sizeof(TYPE1) * sizeof(TYPE2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
kzalloc(
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
kzalloc(
- sizeof(THING1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
kzalloc(
- sizeof(THING1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
kzalloc(
- sizeof(TYPE1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
|
kzalloc(
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
)
// 3-factor product, only identifiers, with redundant parens removed.
@@
identifier STRIDE, SIZE, COUNT;
@@
(
kzalloc(
- (COUNT) * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- (COUNT) * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- (COUNT) * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- (COUNT) * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
)
// Any remaining multi-factor products, first at least 3-factor products,
// when they're not all constants...
@@
expression E1, E2, E3;
constant C1, C2, C3;
@@
(
kzalloc(C1 * C2 * C3, ...)
|
kzalloc(
- (E1) * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
|
kzalloc(
- (E1) * (E2) * E3
+ array3_size(E1, E2, E3)
, ...)
|
kzalloc(
- (E1) * (E2) * (E3)
+ array3_size(E1, E2, E3)
, ...)
|
kzalloc(
- E1 * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
)
// And then all remaining 2 factors products when they're not all constants,
// keeping sizeof() as the second factor argument.
@@
expression THING, E1, E2;
type TYPE;
constant C1, C2, C3;
@@
(
kzalloc(sizeof(THING) * C2, ...)
|
kzalloc(sizeof(TYPE) * C2, ...)
|
kzalloc(C1 * C2 * C3, ...)
|
kzalloc(C1 * C2, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * (E2)
+ E2, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * E2
+ E2, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * (E2)
+ E2, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * E2
+ E2, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- (E1) * E2
+ E1, E2
, ...)
|
- kzalloc
+ kcalloc
(
- (E1) * (E2)
+ E1, E2
, ...)
|
- kzalloc
+ kcalloc
(
- E1 * E2
+ E1, E2
, ...)
)
Signed-off-by: Kees Cook <keescook@chromium.org>
2018-06-13 00:03:40 +03:00
msix_entries = kcalloc ( TIMBERDALE_NR_IRQS , sizeof ( * msix_entries ) ,
GFP_KERNEL ) ;
2010-02-04 14:18:52 +03:00
if ( ! msix_entries )
2011-08-10 12:47:16 +04:00
goto err_config ;
2010-02-04 14:18:52 +03:00
for ( i = 0 ; i < TIMBERDALE_NR_IRQS ; i + + )
msix_entries [ i ] . entry = i ;
2014-02-21 20:58:09 +04:00
err = pci_enable_msix_exact ( dev , msix_entries , TIMBERDALE_NR_IRQS ) ;
2010-02-04 14:18:52 +03:00
if ( err ) {
dev_err ( & dev - > dev ,
" MSI-X init failed: %d, expected entries: %d \n " ,
err , TIMBERDALE_NR_IRQS ) ;
goto err_msix ;
}
err = device_create_file ( & dev - > dev , & dev_attr_fw_ver ) ;
if ( err )
goto err_create_file ;
/* Reset all FPGA PLB peripherals */
iowrite32 ( 0x1 , priv - > ctl_membase + TIMB_SW_RST ) ;
/* update IRQ offsets in I2C board info */
for ( i = 0 ; i < ARRAY_SIZE ( timberdale_i2c_board_info ) ; i + + )
timberdale_i2c_board_info [ i ] . irq =
msix_entries [ timberdale_i2c_board_info [ i ] . irq ] . vector ;
/* Update the SPI configuration depending on the HW (8 or 16 bit) */
if ( priv - > fw . config & TIMB_HW_CONFIG_SPI_8BIT ) {
timberdale_xspi_platform_data . bits_per_word = 8 ;
timberdale_xspi_platform_data . devices =
timberdale_spi_8bit_board_info ;
timberdale_xspi_platform_data . num_devices =
ARRAY_SIZE ( timberdale_spi_8bit_board_info ) ;
} else {
timberdale_xspi_platform_data . bits_per_word = 16 ;
timberdale_xspi_platform_data . devices =
timberdale_spi_16bit_board_info ;
timberdale_xspi_platform_data . num_devices =
ARRAY_SIZE ( timberdale_spi_16bit_board_info ) ;
}
ip_setup = priv - > fw . config & TIMB_HW_VER_MASK ;
switch ( ip_setup ) {
case TIMB_HW_VER0 :
err = mfd_add_devices ( & dev - > dev , - 1 ,
timberdale_cells_bar0_cfg0 ,
ARRAY_SIZE ( timberdale_cells_bar0_cfg0 ) ,
2012-09-11 11:16:36 +04:00
& dev - > resource [ 0 ] , msix_entries [ 0 ] . vector , NULL ) ;
2010-02-04 14:18:52 +03:00
break ;
case TIMB_HW_VER1 :
err = mfd_add_devices ( & dev - > dev , - 1 ,
timberdale_cells_bar0_cfg1 ,
ARRAY_SIZE ( timberdale_cells_bar0_cfg1 ) ,
2012-09-11 11:16:36 +04:00
& dev - > resource [ 0 ] , msix_entries [ 0 ] . vector , NULL ) ;
2010-02-04 14:18:52 +03:00
break ;
case TIMB_HW_VER2 :
err = mfd_add_devices ( & dev - > dev , - 1 ,
timberdale_cells_bar0_cfg2 ,
ARRAY_SIZE ( timberdale_cells_bar0_cfg2 ) ,
2012-09-11 11:16:36 +04:00
& dev - > resource [ 0 ] , msix_entries [ 0 ] . vector , NULL ) ;
2010-02-04 14:18:52 +03:00
break ;
case TIMB_HW_VER3 :
err = mfd_add_devices ( & dev - > dev , - 1 ,
timberdale_cells_bar0_cfg3 ,
ARRAY_SIZE ( timberdale_cells_bar0_cfg3 ) ,
2012-09-11 11:16:36 +04:00
& dev - > resource [ 0 ] , msix_entries [ 0 ] . vector , NULL ) ;
2010-02-04 14:18:52 +03:00
break ;
default :
2018-05-26 17:57:13 +03:00
dev_err ( & dev - > dev , " Unknown IP setup: %d.%d.%d \n " ,
2010-02-04 14:18:52 +03:00
priv - > fw . major , priv - > fw . minor , ip_setup ) ;
err = - ENODEV ;
goto err_mfd ;
}
if ( err ) {
dev_err ( & dev - > dev , " mfd_add_devices failed: %d \n " , err ) ;
goto err_mfd ;
}
err = mfd_add_devices ( & dev - > dev , 0 ,
timberdale_cells_bar1 , ARRAY_SIZE ( timberdale_cells_bar1 ) ,
2012-09-11 11:16:36 +04:00
& dev - > resource [ 1 ] , msix_entries [ 0 ] . vector , NULL ) ;
2010-02-04 14:18:52 +03:00
if ( err ) {
dev_err ( & dev - > dev , " mfd_add_devices failed: %d \n " , err ) ;
goto err_mfd2 ;
}
/* only version 0 and 3 have the iNand routed to SDHCI */
if ( ( ( priv - > fw . config & TIMB_HW_VER_MASK ) = = TIMB_HW_VER0 ) | |
( ( priv - > fw . config & TIMB_HW_VER_MASK ) = = TIMB_HW_VER3 ) ) {
err = mfd_add_devices ( & dev - > dev , 1 , timberdale_cells_bar2 ,
ARRAY_SIZE ( timberdale_cells_bar2 ) ,
2012-09-11 11:16:36 +04:00
& dev - > resource [ 2 ] , msix_entries [ 0 ] . vector , NULL ) ;
2010-02-04 14:18:52 +03:00
if ( err ) {
dev_err ( & dev - > dev , " mfd_add_devices failed: %d \n " , err ) ;
goto err_mfd2 ;
}
}
kfree ( msix_entries ) ;
dev_info ( & dev - > dev ,
" Found Timberdale Card. Rev: %d.%d, HW config: 0x%02x \n " ,
priv - > fw . major , priv - > fw . minor , priv - > fw . config ) ;
return 0 ;
err_mfd2 :
mfd_remove_devices ( & dev - > dev ) ;
err_mfd :
device_remove_file ( & dev - > dev , & dev_attr_fw_ver ) ;
err_create_file :
pci_disable_msix ( dev ) ;
err_msix :
2011-08-10 12:47:16 +04:00
kfree ( msix_entries ) ;
err_config :
2010-02-04 14:18:52 +03:00
iounmap ( priv - > ctl_membase ) ;
err_ioremap :
release_mem_region ( priv - > ctl_mapbase , CHIPCTLSIZE ) ;
err_start :
pci_disable_device ( dev ) ;
err_enable :
kfree ( priv ) ;
return - ENODEV ;
}
2012-11-19 22:26:01 +04:00
static void timb_remove ( struct pci_dev * dev )
2010-02-04 14:18:52 +03:00
{
struct timberdale_device * priv = pci_get_drvdata ( dev ) ;
mfd_remove_devices ( & dev - > dev ) ;
device_remove_file ( & dev - > dev , & dev_attr_fw_ver ) ;
iounmap ( priv - > ctl_membase ) ;
release_mem_region ( priv - > ctl_mapbase , CHIPCTLSIZE ) ;
pci_disable_msix ( dev ) ;
pci_disable_device ( dev ) ;
kfree ( priv ) ;
}
2013-12-03 03:15:39 +04:00
static const struct pci_device_id timberdale_pci_tbl [ ] = {
2010-02-04 14:18:52 +03:00
{ PCI_DEVICE ( PCI_VENDOR_ID_TIMB , PCI_DEVICE_ID_TIMB ) } ,
{ 0 }
} ;
MODULE_DEVICE_TABLE ( pci , timberdale_pci_tbl ) ;
static struct pci_driver timberdale_pci_driver = {
. name = DRIVER_NAME ,
. id_table = timberdale_pci_tbl ,
. probe = timb_probe ,
2012-11-19 22:20:24 +04:00
. remove = timb_remove ,
2010-02-04 14:18:52 +03:00
} ;
2013-08-23 14:11:05 +04:00
module_pci_driver ( timberdale_pci_driver ) ;
2010-02-04 14:18:52 +03:00
MODULE_AUTHOR ( " Mocean Laboratories <info@mocean-labs.com> " ) ;
MODULE_VERSION ( DRV_VERSION ) ;
MODULE_LICENSE ( " GPL v2 " ) ;