summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-bcm-qspi.h
diff options
context:
space:
mode:
authorKamal Dasu <kdasu.kdev@gmail.com>2016-08-24 18:04:23 -0400
committerMark Brown <broonie@kernel.org>2016-09-14 13:03:32 -0400
commitfa236a7ef24048bafaeed13f68df35a819794758 (patch)
treec3ecedbf4d13022f847aa5ef6866b7f4ee6a2650 /drivers/spi/spi-bcm-qspi.h
parent5fc78f4c842aadb5bbe9d7033930e5b3afdffda6 (diff)
spi: bcm-qspi: Add Broadcom MSPI driver
Master SPI driver for Broadcom settop, iProc SoCs. The driver is used for devices that use SPI protocol on BRCMSTB, NSP, NS2 SoCs. SoC platform driver call exported porbe(), remove() and suspend/resume pm_ops implemented in this common driver. Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com> Signed-off-by: Yendapally Reddy Dhananjaya Reddy Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-bcm-qspi.h')
-rw-r--r--drivers/spi/spi-bcm-qspi.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/drivers/spi/spi-bcm-qspi.h b/drivers/spi/spi-bcm-qspi.h
new file mode 100644
index 000000000000..8d4d385c444c
--- /dev/null
+++ b/drivers/spi/spi-bcm-qspi.h
@@ -0,0 +1,63 @@
1/*
2 * Copyright 2016 Broadcom
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License, version 2, as
6 * published by the Free Software Foundation (the "GPL").
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License version 2 (GPLv2) for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * version 2 (GPLv2) along with this source code.
15 */
16
17#ifndef __SPI_BCM_QSPI_H__
18#define __SPI_BCM_QSPI_H__
19
20#include <linux/types.h>
21#include <linux/io.h>
22
23/* MSPI Interrupt masks */
24#define INTR_MSPI_HALTED_MASK BIT(6)
25#define INTR_MSPI_DONE_MASK BIT(5)
26
27#define MSPI_INTERRUPTS_ALL \
28 (INTR_MSPI_DONE_MASK | \
29 INTR_MSPI_HALTED_MASK)
30
31struct platform_device;
32struct dev_pm_ops;
33
34struct bcm_qspi_soc_intc;
35
36/* Read controller register*/
37static inline u32 bcm_qspi_readl(bool be, void __iomem *addr)
38{
39 if (be)
40 return ioread32be(addr);
41 else
42 return readl_relaxed(addr);
43}
44
45/* Write controller register*/
46static inline void bcm_qspi_writel(bool be,
47 unsigned int data, void __iomem *addr)
48{
49 if (be)
50 iowrite32be(data, addr);
51 else
52 writel_relaxed(data, addr);
53}
54
55/* The common driver functions to be called by the SoC platform driver */
56int bcm_qspi_probe(struct platform_device *pdev,
57 struct bcm_qspi_soc_intc *soc_intc);
58int bcm_qspi_remove(struct platform_device *pdev);
59
60/* pm_ops used by the SoC platform driver called on PM suspend/resume */
61extern const struct dev_pm_ops bcm_qspi_pm_ops;
62
63#endif /* __SPI_BCM_QSPI_H__ */