All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov@mvista.com>
To: Hauke Mehrtens <hauke@hauke-m.de>
Cc: linville@tuxdriver.com, zajec5@gmail.com,
	b43-dev@lists.infradead.org, linux-mips@linux-mips.org,
	linux-wireless@vger.kernel.org, arend@broadcom.com, m@bues.ch
Subject: [PATCH 11/11] MIPS: BCM47XX: provide sprom to bcma bus
Date: Mon, 20 Feb 2012 15:08:55 +0400	[thread overview]
Message-ID: <4F4229C7.1070107@mvista.com> (raw)
In-Reply-To: <1329676345-15856-12-git-send-email-hauke@hauke-m.de>

Hello.

On 19-02-2012 22:32, Hauke Mehrtens wrote:

> On SoCs the sprom is often stored in nvram in the flashchip. This patch
> registers a sprom fallback callback handler in bcma and provides the
> sprom needed for this device.

> Signed-off-by: Hauke Mehrtens<hauke@hauke-m.de>
> ---
>   arch/mips/bcm47xx/setup.c |   39 +++++++++++++++++++++++++++++++++++----
>   1 files changed, 35 insertions(+), 4 deletions(-)

> diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
> index 6b0dacd..6f8b073 100644
> --- a/arch/mips/bcm47xx/setup.c
> +++ b/arch/mips/bcm47xx/setup.c
[...]
> @@ -159,10 +159,41 @@ static void __init bcm47xx_register_ssb(void)
>   #endif
>
>   #ifdef CONFIG_BCM47XX_BCMA
> +static int bcm47xx_get_sprom_bcma(struct bcma_bus *bus, struct ssb_sprom *out)
> +{
> +	char prefix[10];
> +	struct bcma_device *core;
> +
> +	if (bus->hosttype == BCMA_HOSTTYPE_PCI) {

    Why not *switch* statement? It seems more natural in this situation...

> +		snprintf(prefix, sizeof(prefix), "pci/%u/%u/",
> +			 bus->host_pci->bus->number + 1,
> +			 PCI_SLOT(bus->host_pci->devfn));
> +		bcm47xx_fill_sprom(out, prefix);
> +		return 0;
> +	} else if (bus->hosttype == BCMA_HOSTTYPE_SOC) {
> +		bcm47xx_fill_sprom_ethernet(out, NULL);
> +		core = bcma_find_core(bus, BCMA_CORE_80211);
> +		if (core) {
> +			snprintf(prefix, sizeof(prefix), "sb/%u/",
> +				 core->core_index);
> +			bcm47xx_fill_sprom(out, prefix);
> +		}
> +		return 0;
> +	} else {
> +		printk(KERN_WARNING "bcm47xx: unable to fill SPROM for given bustype.\n");
> +		return -EINVAL;
> +	}
> +}
> +
>   static void __init bcm47xx_register_bcma(void)
>   {
>   	int err;
>
> +	err = bcma_arch_register_fallback_sprom(&bcm47xx_get_sprom_bcma);
> +	if (err)
> +		printk(KERN_WARNING "bcm47xx: someone else already registered"

    pr_warn(). And don't break the message to help grepping.

> +			" a bcma SPROM callback handler (err %d)\n", err);
> +

WBR, Sergei

WARNING: multiple messages have this Message-ID (diff)
From: Sergei Shtylyov <sshtylyov@mvista.com>
To: Hauke Mehrtens <hauke@hauke-m.de>
Cc: linville@tuxdriver.com, zajec5@gmail.com,
	b43-dev@lists.infradead.org, linux-mips@linux-mips.org,
	linux-wireless@vger.kernel.org, arend@broadcom.com, m@bues.ch
Subject: Re: [PATCH 11/11] MIPS: BCM47XX: provide sprom to bcma bus
Date: Mon, 20 Feb 2012 15:08:55 +0400	[thread overview]
Message-ID: <4F4229C7.1070107@mvista.com> (raw)
In-Reply-To: <1329676345-15856-12-git-send-email-hauke@hauke-m.de>

Hello.

On 19-02-2012 22:32, Hauke Mehrtens wrote:

> On SoCs the sprom is often stored in nvram in the flashchip. This patch
> registers a sprom fallback callback handler in bcma and provides the
> sprom needed for this device.

> Signed-off-by: Hauke Mehrtens<hauke@hauke-m.de>
> ---
>   arch/mips/bcm47xx/setup.c |   39 +++++++++++++++++++++++++++++++++++----
>   1 files changed, 35 insertions(+), 4 deletions(-)

> diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
> index 6b0dacd..6f8b073 100644
> --- a/arch/mips/bcm47xx/setup.c
> +++ b/arch/mips/bcm47xx/setup.c
[...]
> @@ -159,10 +159,41 @@ static void __init bcm47xx_register_ssb(void)
>   #endif
>
>   #ifdef CONFIG_BCM47XX_BCMA
> +static int bcm47xx_get_sprom_bcma(struct bcma_bus *bus, struct ssb_sprom *out)
> +{
> +	char prefix[10];
> +	struct bcma_device *core;
> +
> +	if (bus->hosttype == BCMA_HOSTTYPE_PCI) {

    Why not *switch* statement? It seems more natural in this situation...

> +		snprintf(prefix, sizeof(prefix), "pci/%u/%u/",
> +			 bus->host_pci->bus->number + 1,
> +			 PCI_SLOT(bus->host_pci->devfn));
> +		bcm47xx_fill_sprom(out, prefix);
> +		return 0;
> +	} else if (bus->hosttype == BCMA_HOSTTYPE_SOC) {
> +		bcm47xx_fill_sprom_ethernet(out, NULL);
> +		core = bcma_find_core(bus, BCMA_CORE_80211);
> +		if (core) {
> +			snprintf(prefix, sizeof(prefix), "sb/%u/",
> +				 core->core_index);
> +			bcm47xx_fill_sprom(out, prefix);
> +		}
> +		return 0;
> +	} else {
> +		printk(KERN_WARNING "bcm47xx: unable to fill SPROM for given bustype.\n");
> +		return -EINVAL;
> +	}
> +}
> +
>   static void __init bcm47xx_register_bcma(void)
>   {
>   	int err;
>
> +	err = bcma_arch_register_fallback_sprom(&bcm47xx_get_sprom_bcma);
> +	if (err)
> +		printk(KERN_WARNING "bcm47xx: someone else already registered"

    pr_warn(). And don't break the message to help grepping.

> +			" a bcma SPROM callback handler (err %d)\n", err);
> +

WBR, Sergei

  reply	other threads:[~2012-02-20 11:08 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-19 18:32 [PATCH 00/11] ssb/bcma/BCM47XX: sprom fixes and extensions Hauke Mehrtens
2012-02-19 18:32 ` [PATCH 01/11] ssb: sprom fix some sizes / signedness Hauke Mehrtens
2012-02-23 18:14   ` Rafał Miłecki
2012-02-23 18:14     ` Rafał Miłecki
2012-02-23 21:27     ` Hauke Mehrtens
2012-02-23 21:27       ` Hauke Mehrtens
2012-02-19 18:32 ` [PATCH 02/11] ssb: remove 5GHz antenna gain from sprom Hauke Mehrtens
2012-02-19 19:14   ` Larry Finger
2012-02-19 19:14     ` Larry Finger
2012-02-19 19:17     ` Hauke Mehrtens
2012-02-19 19:17       ` Hauke Mehrtens
2012-02-19 18:32 ` [PATCH 03/11] ssb: fix per path sprom vars Hauke Mehrtens
2012-02-19 18:32 ` [PATCH 04/11] ssb: add ccode Hauke Mehrtens
2012-02-19 18:49   ` Michael Büsch
2012-02-19 18:49     ` Michael Büsch
2012-02-19 19:28     ` Hauke Mehrtens
2012-02-19 19:28       ` Hauke Mehrtens
2012-02-19 19:50       ` Michael Büsch
2012-02-19 19:50         ` Michael Büsch
2012-02-19 20:01         ` Hauke Mehrtens
2012-02-19 20:01           ` Hauke Mehrtens
2012-02-19 18:32 ` [PATCH 05/11] ssb: add some missing sprom attributes Hauke Mehrtens
2012-02-19 22:16   ` Gábor Stefanik
2012-02-19 22:16     ` Gábor Stefanik
2012-02-19 18:32 ` [PATCH 06/11] bcma: export bcma_find_core Hauke Mehrtens
2012-02-19 18:32 ` [PATCH 07/11] bcma: add support for sprom not found on the device Hauke Mehrtens
2012-02-19 18:32 ` [PATCH 08/11] MIPS: BCM47XX: return number of written bytes in nvram_getenv Hauke Mehrtens
2012-02-19 18:32 ` [PATCH 09/11] MIPS: BCM47XX: fix signature of nvram_parse_macaddr Hauke Mehrtens
2012-02-19 18:32 ` [PATCH 10/11] MIPS: BCM47XX: move and extend sprom parsing Hauke Mehrtens
2012-02-19 18:32 ` [PATCH 11/11] MIPS: BCM47XX: provide sprom to bcma bus Hauke Mehrtens
2012-02-20 11:08   ` Sergei Shtylyov [this message]
2012-02-20 11:08     ` Sergei Shtylyov
2012-02-21 19:37 ` [PATCH 00/11] ssb/bcma/BCM47XX: sprom fixes and extensions John W. Linville
2012-02-21 19:37   ` John W. Linville
2012-02-21 19:52   ` Hauke Mehrtens
2012-02-21 19:52     ` Hauke Mehrtens

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=4F4229C7.1070107@mvista.com \
    --to=sshtylyov@mvista.com \
    --cc=arend@broadcom.com \
    --cc=b43-dev@lists.infradead.org \
    --cc=hauke@hauke-m.de \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=m@bues.ch \
    --cc=zajec5@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.