Commit Graph

23 Commits

Author SHA1 Message Date
Andy Shevchenko 1c2df96538 spi: dw-pci: remove unused pdev member from struct dw_spi_pci
The pdev member is not used anywhere, thus remove it. Moreover struct
dw_spi_pci becomes an equivalent of struct dw_spi and therefore remove entire
struct dw_spi_pci.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-19 20:32:01 +01:00
Andy Shevchenko 307ed83c8c spi: dw-pci: correct number of chip selects
The commit d58cf5ff65 brought a second controller to the list of supported
devices and changed a number of the chip selects. Besides the previous number
was wrong anyway the mentioned patch makes it wrong again meanwhile has a
proper numbers in the commit message. Indeed, SPI1 has 5 bits and SPI2 has 2
bits, but it does not mean to have power of two of this bits as a possible
number of the chip selects. So, this patch fixes it eventually.

Fixes: d58cf5ff65 (spi: dw-pci: describe Intel MID controllers better)
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
2015-02-24 16:59:32 +09:00
Andy Shevchenko d9c14743a3 spi: dw-mid: get a proper clock frequency for SPI2
The clock information is being kept in the custom register on Intel MID
platforms. Each controller has its own dedicated custom register for that.
Thus, to get a proper frequency we have to read value from the specific offset
to the register block. This patch makes this happen.

Fixes: d58cf5ff65 (spi: dw-pci: describe Intel MID controllers better)
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-01-27 12:04:29 +00:00
Andy Shevchenko d58cf5ff65 spi: dw-pci: describe Intel MID controllers better
There are more that one SPI controller on the Intel MID boards. This patch
describes the status and IDs of them. From now on we also have to care about
bus number that must be unique per host.

According to the specification the SPI1 has 5 bits for chip selects and SPI2
only 2 bits. The patch makes it depend to PCI ID.

The first controller (SPI1) is DMA capable, meanwhile SPI2 can share same
channels (via software switch) such functionality is not in the scope of this
patch. Thus, attempt to init DMA for SPI2 will always fail for now.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-01-07 18:01:06 +00:00
Mark Brown 7020d76971 Merge remote-tracking branches 'spi/topic/davinci', 'spi/topic/doc', 'spi/topic/dw' and 'spi/topic/fsl' into spi-next 2014-10-03 16:33:39 +01:00
Andy Shevchenko 5dc23c4421 spi: dw-pci: remove FSF address and update copyright
The FSF address is subject to change, thus remove it from the file. While here,
update a copyright line.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-01 11:29:03 +01:00
Andy Shevchenko c95791b6a5 spi: dw-pci: provide platform specific data via driver_data
Instead of checking for device and vendor IDs inside probe function let's
provide a helper function via driver_data.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-01 11:29:03 +01:00
Andy Shevchenko 35f2d41364 spi: dw-pci: convert to use dev_pm_ops
Convert system PM callbacks to use dev_pm_ops. In addition remove the PCI calls
related to a power state since the bus code cares about this already.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-01 11:29:02 +01:00
Andy Shevchenko ceb86de9d6 spi: dw-pci: apply pci_bar and re-use pci_name
Nevertheless pci_bar is 0 let's explicitly use it when map IO regions. While
here, use pci_name instead of dev_name.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-01 11:29:02 +01:00
Andy Shevchenko fcf0af445b spi: dw-pci: move info message at the end of probe
Let's print info message when controller is found and properly initialized.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-01 11:29:02 +01:00
Andy Shevchenko c9d5d6fe16 spi: dw-pci: fix bug when regs left uninitialized
The commit 04f421e7 "spi: dw: use managed resources" changes drivers to use
managed functions, but seems wasn't properly tested in PCI case. The regs field
of struct dw_spi left uninitialized. Thus, kernel crashes when tries to access
to the SPI controller registers. This patch fixes the issue.

Fixes: 04f421e7 (spi: dw: use managed resources)
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Cc: stable@vger.kernel.org
2014-08-27 15:45:04 +01:00
Mark Brown 907e26b6f5 Merge remote-tracking branches 'spi/topic/fsl-espi', 'spi/topic/gpio', 'spi/topic/hspi', 'spi/topic/mpc512x', 'spi/topic/msiof', 'spi/topic/nuc900', 'spi/topic/oc-tiny', 'spi/topic/omap', 'spi/topic/orion' and 'spi/topic/pci' into spi-linus 2014-01-23 13:07:09 +00:00
Wei Yongjun 136c8bf374 spi: dw-pci: remove free for resources allocated with devm_*
It's not necessary to free resources allocated with devm_*
and free them may lead to double free.

Fixes: 04f421e7b0 ('spi: dw: use managed resources')
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-07 15:47:18 +00:00
Baruch Siach fa4934a02a spi: dw-pci: fix typo
Commit 04f421e7b0 (spi: dw: use managed resources) introduced a typo in
struct field reference. Fix it.

Fixes build failure:

drivers/spi/spi-dw-pci.c: In function 'spi_pci_probe':
drivers/spi/spi-dw-pci.c:50:29: error: 'dev' undeclared (first use in this function)
  dwpci = devm_kzalloc(&pdev-dev, sizeof(struct dw_spi_pci), GFP_KERNEL);
                             ^

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-06 12:11:28 +00:00
Baruch Siach 04f421e7b0 spi: dw: use managed resources
Migrate mmio code and core driver to managed resources to reduce boilerplate
error handling code. Also, handle clk_enable() failure while at it, and drop
unused dw_spi iolen field.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-31 12:30:18 +00:00
Jingoo Han 9a21e4770a spi: remove DEFINE_PCI_DEVICE_TABLE macro
Don't use DEFINE_PCI_DEVICE_TABLE macro, because this macro
is not preferred.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-03 18:03:26 +00:00
Jingoo Han e0045ebf3b spi: dw-pci: Use dev_info() instead of printk()
Change raw printk() call to dev_info() to provide a better message
to userspace so it can properly identify the device.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-14 18:21:00 +01:00
Jingoo Han 7cce62f3aa spi: dw-pci: remove unnecessary pci_set_drvdata()
The driver core clears the driver data to NULL after device_release
or on probe failure. Thus, it is not needed to manually clear the
device driver data to NULL.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:19:14 +01:00
Grant Likely fd4a319bc9 spi: Remove HOTPLUG section attributes
CONFIG_HOTPLUG is going away as an option.  As result the __dev*
markings will be going away.

Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst,
and __devexit.

Bill Pemberton has done most of the legwork on this series. I've used
his script to purge the attributes from the drivers/gpio tree.

Reported-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2012-12-07 17:06:43 +00:00
Axel Lin 8ebb35fd7a spi: use module_pci_driver
This patch converts the drivers in drivers/spi/* to use module_pci_driver()
macro which makes the code smaller and a bit simpler.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2012-04-10 14:11:34 -06:00
Axel Lin e290cf276b spi: Convert to DEFINE_PCI_DEVICE_TABLE
Convert static struct pci_device_id *[] to static DEFINE_PCI_DEVICE_TABLE
tables.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2012-03-09 15:33:15 -07:00
Paul Gortmaker d7614de422 spi: Add module.h to implicit users in drivers/spi
We are clipping down the presence of module.h, since it was
everywhere.  If you really need it, you better call it out,
as per this changeset.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-10-31 19:32:17 -04:00
Grant Likely ca632f5566 spi: reorganize drivers
Sort the SPI makefile and enforce the naming convention spi_*.c for
spi drivers.

This change also rolls the contents of atmel_spi.h into the .c file
since there is only one user of that particular include file.

v2: - Use 'spi-' prefix instead of 'spi_' to match what seems to be
      be the predominant pattern for subsystem prefixes.
    - Clean up filenames in Kconfig and header comment blocks

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
2011-06-06 01:16:30 -06:00