linux-mips
[Top] [All Lists]

Re: [PATCH 4/7] MIPS: ath79: add a common PCI registration function

To: Gabor Juhos <juhosg@openwrt.org>
Subject: Re: [PATCH 4/7] MIPS: ath79: add a common PCI registration function
From: René Bolldorf <xsecute@googlemail.com>
Date: Fri, 18 Nov 2011 19:32:05 +0100
Cc: Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=uurAEUQRX9Pkm05KDbDhsw0QwzssIKbfZ3kK7NZHokE=; b=kSkT1fKjY3HWblVQScT/ktYer1IF0Pltc8JQAY0oXjPKxxsqB8axZI2OAKNdX/ecgB lF624gjC25TdY9lHw6pe0p/Q9Zuj/OwjftS/SaQAKkQwQbmYDP6bxkKquJ/dY83FqKCy tOQWCmdevEOxy7v+x4p1iMyJ5ue9YVjUWHaKA=
In-reply-to: <1321629720-29035-4-git-send-email-juhosg@openwrt.org>
References: <1321629720-29035-1-git-send-email-juhosg@openwrt.org> <1321629720-29035-4-git-send-email-juhosg@openwrt.org>
Sender: linux-mips-bounce@linux-mips.org
On Fri, Nov 18, 2011 at 4:21 PM, Gabor Juhos <juhosg@openwrt.org> wrote:
> The current code unconditionally registers the AR724X
> specific PCI controller, even if the kernel is running
> on a different SoC.
>
This is not true, take a look in the ath79 Kconfig file...

> Add a common function for PCI controller registration,
> and only register the AR724X PCI controller if the kernel
> is running on an AR724X SoC.
>
> Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
> ---
>  arch/mips/ath79/mach-ubnt-xm.c |    1 +
>  arch/mips/ath79/pci.c          |   14 ++++++++++++++
>  arch/mips/ath79/pci.h          |    6 ++++++
>  arch/mips/pci/pci-ath724x.c    |    2 --
>  4 files changed, 21 insertions(+), 2 deletions(-)
>
> diff --git a/arch/mips/ath79/mach-ubnt-xm.c b/arch/mips/ath79/mach-ubnt-xm.c
> index 5853bd7..1d44cc2 100644
> --- a/arch/mips/ath79/mach-ubnt-xm.c
> +++ b/arch/mips/ath79/mach-ubnt-xm.c
> @@ -111,6 +111,7 @@ static void __init ubnt_xm_init(void)
>        ath724x_pci_add_data(ubnt_xm_pci_data, ARRAY_SIZE(ubnt_xm_pci_data));
>  #endif /* CONFIG_PCI */
>
> +       ath79_register_pci();
>  }
>
>  MIPS_MACHINE(ATH79_MACH_UBNT_XM,
> diff --git a/arch/mips/ath79/pci.c b/arch/mips/ath79/pci.c
> index 4957428..a2dae75 100644
> --- a/arch/mips/ath79/pci.c
> +++ b/arch/mips/ath79/pci.c
> @@ -9,6 +9,8 @@
>  */
>
>  #include <linux/pci.h>
> +#include <asm/mach-ath79/ath79.h>
> +#include <asm/mach-ath79/pci.h>
>  #include "pci.h"
>
>  static struct ath724x_pci_data *pci_data;
> @@ -44,3 +46,15 @@ int pcibios_plat_dev_init(struct pci_dev *dev)
>
>        return PCIBIOS_SUCCESSFUL;
>  }
> +
> +int ath79_register_pci(void)
> +{
> +       int ret;
> +
> +       if (soc_is_ar724x())
> +               ret = ath724x_pcibios_init();
> +       else
> +               ret = -ENODEV;
> +
> +       return ret;
> +}
> diff --git a/arch/mips/ath79/pci.h b/arch/mips/ath79/pci.h
> index 454885f..4653ca8 100644
> --- a/arch/mips/ath79/pci.h
> +++ b/arch/mips/ath79/pci.h
> @@ -18,4 +18,10 @@ struct ath724x_pci_data {
>
>  void ath724x_pci_add_data(struct ath724x_pci_data *data, int size);
>
> +#ifdef CONFIG_PCI
> +int ath79_register_pci(void);
> +#else
> +static inline int ath79_register_pci(void) {};
> +#endif
> +
>  #endif /* __ASM_MACH_ATH79_PCI_ATH724X_H */
> diff --git a/arch/mips/pci/pci-ath724x.c b/arch/mips/pci/pci-ath724x.c
> index be01b7f..ebefc16 100644
> --- a/arch/mips/pci/pci-ath724x.c
> +++ b/arch/mips/pci/pci-ath724x.c
> @@ -137,5 +137,3 @@ int __init ath724x_pcibios_init(void)
>
>        return PCIBIOS_SUCCESSFUL;
>  }
> -
> -arch_initcall(ath724x_pcibios_init);
> --
> 1.7.2.1
>
>

<Prev in Thread] Current Thread [Next in Thread>