From: Davide Ciminaghi <ciminaghi@gnudd.com>
To: linux-kernel@vger.kernel.org
Cc: rubini@gnudd.com, Giancarlo Asnaghi <giancarlo.asnaghi@st.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Ingo Molnar <mingo@redhat.com>,
Russell King <linux@arm.linux.org.uk>,
Thomas Gleixner <tglx@linutronix.de>,
devicetree@vger.kernel.org
Subject: [PATCH 23/26] AMBA: pci-amba bridge: export function creating pci-amba device names
Date: Wed, 7 Aug 2013 12:21:31 +0200 [thread overview]
Message-ID: <25c849c312f08d161b91a1c7b7ea56e1c7207789.1375867291.git.rubini@gnudd.com> (raw)
In-Reply-To: <cover.1375867291.git.rubini@gnudd.com>
pci_amba_get_dev_name() will be used by the sta2x11 common clock framework
to register clkdevs with the same name as the corresponding amba or
platform device.
Signed-off-by: Davide Ciminaghi <ciminaghi@gnudd.com>
Acked-by: Giancarlo Asnaghi <giancarlo.asnaghi@st.com>
---
drivers/amba/pci-amba.c | 14 ++++++++++++++
include/linux/pci-amba.h | 42 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+), 0 deletions(-)
create mode 100644 include/linux/pci-amba.h
diff --git a/drivers/amba/pci-amba.c b/drivers/amba/pci-amba.c
index f272d38..1beeefd 100644
--- a/drivers/amba/pci-amba.c
+++ b/drivers/amba/pci-amba.c
@@ -9,6 +9,7 @@
#include <linux/amba/bus.h>
#include <linux/pci.h>
#include <linux/pci_ids.h>
+#include <linux/pci-amba.h>
#include <linux/slab.h>
#include <linux/irq.h>
#include <linux/sizes.h>
@@ -25,6 +26,8 @@
*/
#define IMAP_ROW_LEN (1 + 1 + 1 + 1 + 1)
+static const struct pci_device_id pci_amba_table[];
+
static inline int resource_fits(struct resource *r1, struct resource *r2)
{
return (r1->start >= r2->start) && (r1->end <= r2->end);
@@ -63,6 +66,17 @@ static int get_dev_name(char **name, struct pci_dev *pdev, int index)
return 0;
}
+int pci_amba_get_dev_name(char **name, struct pci_dev *pdev, int index)
+{
+ /* Check whether the device is a pci-amba one */
+ if (!pci_match_id(pci_amba_table, pdev))
+ return -ENODEV;
+ if (!name)
+ return -EINVAL;
+ return get_dev_name(name, pdev, index);
+}
+EXPORT_SYMBOL(pci_amba_get_dev_name);
+
static int fixup_irq(struct device_node *node,
struct device_node *amba_bus,
struct pci_dev *pdev)
diff --git a/include/linux/pci-amba.h b/include/linux/pci-amba.h
new file mode 100644
index 0000000..913624e
--- /dev/null
+++ b/include/linux/pci-amba.h
@@ -0,0 +1,42 @@
+/*
+ * PCI-AMBA Helpers
+ *
+ * Copyright 2012 ST Microelectronics (Alessandro Rubini, Davide Ciminaghi)
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
+ * NON INFRINGEMENT. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+#ifndef _PCI_AMBA_H
+#define _PCI_AMBA_H
+
+#include <linux/of.h>
+
+/*
+ * pci_amba_get_dev_name: allocate and fill in a buffer with a suitable
+ * name for a pci-amba device.
+ *
+ * @name: pointer to a location where the address of the allocated buffer
+ * shall be stored.
+ * @pdev: pointer to the corresponding pci device.
+ * @index: index of device (in case of more than one amba/platform device
+ * per pci device).
+ *
+ */
+extern int pci_amba_get_dev_name(char **name, struct pci_dev *pdev, int index);
+
+#endif /* _PCI_AMBA_H */
--
1.7.7.2
next prev parent reply other threads:[~2013-08-07 10:21 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-07 10:16 [PATCH 00/26] STA2X11 devicetree support for amba/pci Alessandro Rubini
2013-08-07 10:16 ` [PATCH 01/26] x86: fix warning for sta2x11 Alessandro Rubini
2013-08-07 10:16 ` [PATCH 02/26] DMA: PL330: use prefix in reg names to build under x86 Alessandro Rubini
2013-08-07 10:16 ` [PATCH 03/26] mmc: Use the new <linux/sizes.h> Alessandro Rubini
2013-08-07 10:17 ` [PATCH 04/26] x86: add CONFIG_ARM_AMBA, selected by STA2X11 Alessandro Rubini
2013-08-07 10:17 ` [PATCH 05/26] drivers/amba: add support for a PCI bridge Alessandro Rubini
2013-08-07 10:17 ` [PATCH 06/26] x86 STA2X11: select devicetree related config items Davide Ciminaghi
2013-08-07 10:17 ` [PATCH 07/26] OF platform: export of_amba_device_create() Davide Ciminaghi
2013-08-07 10:17 ` [PATCH 08/26] OF platform, of_amba_device_create(): add parent resource to parameters Davide Ciminaghi
2013-08-07 10:17 ` [PATCH 09/26] kernel irqdomain: export irq_domain_disassociate() Davide Ciminaghi
2013-08-07 10:19 ` [PATCH 10/26] x86 devicetree: add irq domain for msi irqs Davide Ciminaghi
2013-08-07 10:19 ` [PATCH 11/26] x86 devicetree: add functions for handling setup/teardown of MSI irqs Davide Ciminaghi
2013-08-07 10:19 ` [PATCH 12/26] x86 kernel apic: notify MSI irqdomain(s) on etup/teardown of MSI IRQs Davide Ciminaghi
2013-08-07 10:19 ` [PATCH 13/26] drivers/amba/pci-amba.c: use devicetree for amba device creation Davide Ciminaghi
2013-08-07 10:19 ` [PATCH 14/26] gpio: remove sta2x11-gpio Davide Ciminaghi
2013-08-07 19:49 ` Linus Walleij
2013-08-07 10:20 ` [PATCH 15/26] x86 STA2X11: remove the sta2x11-mfd driver Davide Ciminaghi
2013-08-07 10:20 ` [PATCH 16/26] x86 STA2X11 platform: add sta2x11_platform_init() Davide Ciminaghi
2013-08-07 10:20 ` [PATCH 17/26] x86 STA2X11 platform: add sta2x11_instance_data helpers Davide Ciminaghi
2013-08-07 10:20 ` [PATCH 18/26] x86 STA2X11 platform: add a common probe function for platform devices Davide Ciminaghi
2013-08-07 10:20 ` [PATCH 19/26] x86 STA2X11 platform: create sta2x11-clock-regs device Davide Ciminaghi
2013-08-07 10:20 ` [PATCH 20/26] x86 STA2X11 platform: remove useless pr_info()'s Davide Ciminaghi
2013-08-07 10:21 ` [PATCH 21/26] AMBA: pci-amba bridge: improve code readability Davide Ciminaghi
2013-08-07 10:21 ` [PATCH 22/26] AMBA: pci-amba bridge: extend number of amba devs per pci device Davide Ciminaghi
2013-08-07 10:21 ` Davide Ciminaghi [this message]
2013-08-07 10:21 ` [PATCH 24/26] x86 STA2X11: add dts for Intel's Northville board Davide Ciminaghi
2013-08-07 10:21 ` [PATCH 25/26] drivers/clk: sta2x11 common clock framework implementation Davide Ciminaghi
2013-08-07 10:22 ` [PATCH 26/26] pinctrl: add support for sta2x11 (via pinctrl-nomadik) Davide Ciminaghi
2013-08-07 19:47 ` Linus Walleij
2013-08-07 20:43 ` Alessandro Rubini
2013-08-07 15:41 ` [PATCH 00/26] STA2X11 devicetree support for amba/pci H. Peter Anvin
2013-08-07 21:12 ` Alessandro Rubini
2013-08-07 21:15 ` H. Peter Anvin
2013-08-07 22:05 ` H. Peter Anvin
2013-08-07 22:12 ` H. Peter Anvin
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=25c849c312f08d161b91a1c7b7ea56e1c7207789.1375867291.git.rubini@gnudd.com \
--to=ciminaghi@gnudd.com \
--cc=devicetree@vger.kernel.org \
--cc=giancarlo.asnaghi@st.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=mingo@redhat.com \
--cc=rubini@gnudd.com \
--cc=tglx@linutronix.de \
--cc=x86@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
all inboxes | Powered by JetHome®