From: Tony Breeds <tony@bakeyournoodle•com>
To: lucaskt@linux•vnet.ibm.com
Cc: Kleber Sacilotto de Souza <klebers@linux•vnet.ibm.com>,
Brian King <brking@linux•vnet.ibm.com>,
dri-devel@lists•freedesktop.org,
Alex Deucher <alexander.deucher@amd•com>,
Jerome Glisse <jglisse@redhat•com>,
Thadeu Lima de Souza Cascardo <cascardo@linux•vnet.ibm.com>,
Bjorn Helgaas <bhelgaas@google•com>,
linuxppc-dev@lists•ozlabs.org
Subject: Re: [PATCHv4 1/2] ppc64: perform proper max_bus_speed detection
Date: Thu, 25 Apr 2013 09:48:38 +1000 [thread overview]
Message-ID: <20130424234838.GA1971@thor.bakeyournoodle.com> (raw)
In-Reply-To: <1366844090-5492-2-git-send-email-lucaskt@linux.vnet.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 3174 bytes --]
On Wed, Apr 24, 2013 at 07:54:49PM -0300, lucaskt@linux•vnet.ibm.com wrote:
> From: Lucas Kannebley Tavares <lucaskt@linux•vnet.ibm.com>
>
> On pseries machines the detection for max_bus_speed should be done
> through an OpenFirmware property. This patch adds a function to perform
> this detection and a hook to perform dynamic adding of the function only for
> pseries. This is done by overwriting the weak
> pcibios_root_bridge_prepare function which is called by pci_create_root_bus().
>
> Signed-off-by: Lucas Kannebley Tavares <lucaskt@linux•vnet.ibm.com>
> ---
> arch/powerpc/include/asm/machdep.h | 2 ++
> arch/powerpc/kernel/pci-common.c | 8 +++++
> arch/powerpc/platforms/pseries/pci.c | 51 ++++++++++++++++++++++++++++++++
> arch/powerpc/platforms/pseries/pseries.h | 4 +++
> arch/powerpc/platforms/pseries/setup.c | 2 ++
> 5 files changed, 67 insertions(+)
>
> diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
> index 3d6b410..8f558bf 100644
> --- a/arch/powerpc/include/asm/machdep.h
> +++ b/arch/powerpc/include/asm/machdep.h
> @@ -107,6 +107,8 @@ struct machdep_calls {
> void (*pcibios_fixup)(void);
> int (*pci_probe_mode)(struct pci_bus *);
> void (*pci_irq_fixup)(struct pci_dev *dev);
> + int (*pcibios_root_bridge_prepare)(struct pci_host_bridge
> + *bridge);
>
> /* To setup PHBs when using automatic OF platform driver for PCI */
> int (*pci_setup_phb)(struct pci_controller *host);
> diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
> index fa12ae4..80986cf 100644
> --- a/arch/powerpc/kernel/pci-common.c
> +++ b/arch/powerpc/kernel/pci-common.c
> @@ -844,6 +844,14 @@ int pci_proc_domain(struct pci_bus *bus)
> return 1;
> }
>
> +int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
> +{
> + if (ppc_md.pcibios_root_bridge_prepare)
> + return ppc_md.pcibios_root_bridge_prepare(bridge);
> +
> + return 0;
> +}
> +
> /* This header fixup will do the resource fixup for all devices as they are
> * probed, but not for bridge ranges
> */
> diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c
> index 0b580f4..7f9c956 100644
> --- a/arch/powerpc/platforms/pseries/pci.c
> +++ b/arch/powerpc/platforms/pseries/pci.c
> @@ -108,3 +108,54 @@ static void fixup_winbond_82c105(struct pci_dev* dev)
> }
> DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105,
> fixup_winbond_82c105);
> +
> +int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
> +{
> + struct device_node *dn, *pdn;
> + struct pci_bus *bus;
> + const uint32_t *pcie_link_speed_stats;
> +
> + bus = bridge->bus;
> +
> + dn = pcibios_get_phb_of_node(bus);
> + if (!dn)
> + return 0;
> +
> + for (pdn = dn; pdn != NULL; pdn = pdn->parent) {
> + pcie_link_speed_stats = (const uint32_t *) of_get_property(dn,
> + "ibm,pcie-link-speed-stats", NULL);
> + if (pcie_link_speed_stats)
> + break;
> + }
Please use the helpers in include/linux/of.h rather than open coding
this.
Yours Tony
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2013-04-24 23:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-24 22:54 [PATCHv4 0/2] Speed Cap fixes for ppc64 lucaskt
2013-04-24 22:54 ` [PATCHv4 1/2] ppc64: perform proper max_bus_speed detection lucaskt
2013-04-24 23:48 ` Tony Breeds [this message]
2013-04-25 17:34 ` Lucas Kannebley Tavares
2013-05-02 15:21 ` Kleber Sacilotto de Souza
2013-05-03 6:40 ` Tony Breeds
2013-05-03 11:55 ` Kleber Sacilotto de Souza
2013-04-24 22:54 ` [PATCHv4 2/2] radeon: use max_bus_speed to activate gen2 speeds lucaskt
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=20130424234838.GA1971@thor.bakeyournoodle.com \
--to=tony@bakeyournoodle$(echo .)com \
--cc=alexander.deucher@amd$(echo .)com \
--cc=bhelgaas@google$(echo .)com \
--cc=brking@linux$(echo .)vnet.ibm.com \
--cc=cascardo@linux$(echo .)vnet.ibm.com \
--cc=dri-devel@lists$(echo .)freedesktop.org \
--cc=jglisse@redhat$(echo .)com \
--cc=klebers@linux$(echo .)vnet.ibm.com \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
--cc=lucaskt@linux$(echo .)vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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