From: Jingoo Han <jg1.han@samsung.com>
To: 'linux-pci' <linux-pci@vger.kernel.org>,
'Bjorn Helgaas' <bhelgaas@google.com>
Cc: linux-arm-kernel@lists.infradead.org,
linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org,
'Liviu Dudau' <Liviu.Dudau@arm.com>,
'Arnd Bergmann' <arnd@arndb.de>,
'Kukjin Kim' <kgene.kim@samsung.com>,
'Jingoo Han' <jg1.han@samsung.com>
Subject: [RFC PATCH 1/2] PCI: designware: Add ARM64 PCI support
Date: Wed, 16 Apr 2014 13:42:56 +0900 [thread overview]
Message-ID: <000901cf592e$563bc8c0$02b35a40$%han@samsung.com> (raw)
In-Reply-To: <000801cf592e$30b7bff0$92273fd0$%han@samsung.com>
Add ARM64 PCI support for Synopsys designware PCIe, by using
pcie arm64 arch support and creating generic pcie bridge from
device tree.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
drivers/pci/host/pcie-designware.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
index 6d23d8c..fac0440 100644
--- a/drivers/pci/host/pcie-designware.c
+++ b/drivers/pci/host/pcie-designware.c
@@ -65,14 +65,27 @@
#define PCIE_ATU_FUNC(x) (((x) & 0x7) << 16)
#define PCIE_ATU_UPPER_TARGET 0x91C
+#ifdef CONFIG_ARM
static struct hw_pci dw_pci;
+#endif
static unsigned long global_io_offset;
+#ifdef CONFIG_ARM
static inline struct pcie_port *sys_to_pcie(struct pci_sys_data *sys)
{
return sys->private_data;
}
+#endif
+
+#ifdef CONFIG_ARM64
+static inline struct pcie_port *sys_to_pcie(struct pcie_port *pp)
+{
+ return pp;
+}
+
+static struct pci_ops dw_pcie_ops;
+#endif
int dw_pcie_cfg_read(void __iomem *addr, int where, int size, u32 *val)
{
@@ -381,7 +394,9 @@ static int dw_pcie_msi_map(struct irq_domain *domain, unsigned int irq,
{
irq_set_chip_and_handler(irq, &dw_msi_irq_chip, handle_simple_irq);
irq_set_chip_data(irq, domain->host_data);
+#ifdef CONFIG_ARM
set_irq_flags(irq, IRQF_VALID);
+#endif
return 0;
}
@@ -397,6 +412,10 @@ int __init dw_pcie_host_init(struct pcie_port *pp)
struct of_pci_range_parser parser;
u32 val;
int i;
+#ifdef CONFIG_ARM64
+ struct pci_host_bridge *bridge;
+ resource_size_t lastbus;
+#endif
if (of_pci_range_parser_init(&parser, np)) {
dev_err(pp->dev, "missing ranges property\n");
@@ -489,6 +508,7 @@ int __init dw_pcie_host_init(struct pcie_port *pp)
val |= PORT_LOGIC_SPEED_CHANGE;
dw_pcie_wr_own_conf(pp, PCIE_LINK_WIDTH_SPEED_CONTROL, 4, val);
+#ifdef CONFIG_ARM
dw_pci.nr_controllers = 1;
dw_pci.private_data = (void **)&pp;
@@ -497,6 +517,16 @@ int __init dw_pcie_host_init(struct pcie_port *pp)
#ifdef CONFIG_PCI_DOMAINS
dw_pci.domain++;
#endif
+#endif
+
+#ifdef CONFIG_ARM64
+ bridge = of_create_pci_host_bridge(pp->dev, &dw_pcie_ops, pp);
+ if (IS_ERR_OR_NULL(bridge))
+ return PTR_ERR(bridge);
+
+ lastbus = pci_rescan_bus(bridge->bus);
+ pci_bus_update_busn_res_end(bridge->bus, lastbus);
+#endif
return 0;
}
@@ -695,6 +725,7 @@ static struct pci_ops dw_pcie_ops = {
.write = dw_pcie_wr_conf,
};
+#ifdef CONFIG_ARM
static int dw_pcie_setup(int nr, struct pci_sys_data *sys)
{
struct pcie_port *pp;
@@ -758,6 +789,7 @@ static struct hw_pci dw_pci = {
.map_irq = dw_pcie_map_irq,
.add_bus = dw_pcie_add_bus,
};
+#endif /* CONFIG_ARM */
void dw_pcie_setup_rc(struct pcie_port *pp)
{
--
1.7.10.4
next prev parent reply other threads:[~2014-04-16 4:42 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-16 4:41 [RFC PATCH 0/2] Add support for Samsung GH7 PCIe controller Jingoo Han
2014-04-16 4:42 ` Jingoo Han [this message]
2014-04-16 16:57 ` [RFC PATCH 1/2] PCI: designware: Add ARM64 PCI support Liviu Dudau
2014-04-16 18:26 ` Arnd Bergmann
2014-04-21 1:54 ` Jingoo Han
2014-04-21 9:58 ` Jingoo Han
2014-04-22 13:01 ` Liviu Dudau
2014-04-22 15:39 ` Rob Herring
2014-04-22 12:59 ` Liviu Dudau
2014-04-22 12:54 ` Liviu Dudau
2014-04-16 4:43 ` [RFC PATCH 2/2] PCI: exynos: Add PCIe support for Samsung GH7 SoC Jingoo Han
2014-04-22 14:11 ` Arnd Bergmann
2014-04-23 9:19 ` Kukjin Kim
2014-04-23 11:03 ` Arnd Bergmann
2014-04-23 14:23 ` Liviu Dudau
2014-04-23 16:20 ` Arnd Bergmann
2014-04-24 4:53 ` Kukjin Kim
2014-04-24 9:49 ` Arnd Bergmann
2014-04-23 13:00 ` Liviu Dudau
2014-04-24 12:25 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='000901cf592e$563bc8c0$02b35a40$%han@samsung.com' \
--to=jg1.han@samsung.com \
--cc=Liviu.Dudau@arm.com \
--cc=arnd@arndb.de \
--cc=bhelgaas@google.com \
--cc=kgene.kim@samsung.com \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).