]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - drivers/spi/spi-bcm-qspi.h
spi: bcm-qspi: Add Broadcom MSPI driver
[mirror_ubuntu-zesty-kernel.git] / drivers / spi / spi-bcm-qspi.h
CommitLineData
fa236a7e
KD
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__ */