Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: Jonas Gorski <jonas.gorski@gmail.com>
Cc: linux-mips@linux-mips.org, Maxime Bizon <mbizon@freebox.fr>,
	Florian Fainelli <florian@openwrt.org>,
	Kevin Cernekee <cernekee@gmail.com>
Subject: Re: [PATCH 1/8] MIPS: BCM63XX: move flash registration out of board_bcm963xx.c
Date: Wed, 13 Jun 2012 14:48:01 +0100	[thread overview]
Message-ID: <20120613134801.GA5516@linux-mips.org> (raw)
In-Reply-To: <1339489425-19037-2-git-send-email-jonas.gorski@gmail.com>

On Tue, Jun 12, 2012 at 10:23:38AM +0200, Jonas Gorski wrote:

> board_bcm963xx.c is already large enough.

And the grand cure for that sort of issue is FDT - we by now have built
big deserts of code just registering platform devices like this..  See
John Crispin's Lantiq work or David's Cavium code for FDT examples.

> +int __init bcm63xx_flash_register(void)
> +{
> +	u32 val;
> +
> +	/* read base address of boot chip select (0) */
> +	val = bcm_mpi_readl(MPI_CSBASE_REG(0));
> +	val &= MPI_CSBASE_BASE_MASK;
> +
> +	mtd_resources[0].start = val;
> +	mtd_resources[0].end = 0x1FFFFFFF;
> +
> +	return platform_device_register(&mtd_dev);
> +}
> diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h
> new file mode 100644
> index 0000000..8dcb541
> --- /dev/null
> +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h
> @@ -0,0 +1,6 @@
> +#ifndef __BCM63XX_FLASH_H
> +#define __BCM63XX_FLASH_H
> +
> +int __init bcm63xx_flash_register(void);

Don't use __init in declarations.  It doesn't make any difference to the
compiler but it may cause build errors if <linux/init.h> has not been
included before which this file doesn't.

> +#endif /* __BCM63XX_FLASH_H */

I suggest to make bcm63xx_flash_register an arch_initcall.  It already is
being called indirectly from an bcm63xx_flash_register() so this would
allow making the function static, get rid of bcm63xx_dev_flash.h which
only exists to silence checkpatch warnings and make board_register_devices
a little cleaner.

  Ralf

PS: Don't forget about FDT :-)  Eventually, not necessarily now.

  reply	other threads:[~2012-06-13 13:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-12  8:23 [PATCH 0/8] Add basic support for BCM6328 Jonas Gorski
2012-06-12  8:23 ` [PATCH 1/8] MIPS: BCM63XX: move flash registration out of board_bcm963xx.c Jonas Gorski
2012-06-13 13:48   ` Ralf Baechle [this message]
2012-06-13 13:51     ` Florian Fainelli
2012-06-13 13:59       ` Ralf Baechle
2012-06-13 14:10         ` John Crispin
2012-06-13 15:35       ` Ralf Baechle
2012-06-16 11:03         ` Jonas Gorski
2012-06-12  8:23 ` [PATCH 2/8] MIPS: BCM63XX: add flash type detection Jonas Gorski
2012-06-12  8:23 ` [PATCH 3/8] MIPS: BCM63XX: use the Chip ID register for identifying the SoC Jonas Gorski
2012-06-12  8:23 ` [PATCH 4/8] MIPS: BCM63XX: add basic BCM6328 CPU support Jonas Gorski
2012-06-12  8:23 ` [PATCH 5/8] MIPS: BCM63XX: Move the PCI initialization into its own function Jonas Gorski
2012-06-12  8:23 ` [PATCH 6/8] MIPS: BCM63XX: Add PCIe Support for BCM6328 Jonas Gorski
2012-06-12  8:23 ` [PATCH 7/8] MIPS: expose PCIe drivers for MIPS Jonas Gorski
2012-06-12  8:23 ` [PATCH 8/8] MIPS: BCM63XX: add 96328avng reference board Jonas Gorski
2012-06-12 11:26 ` [PATCH 0/8] Add basic support for BCM6328 Florian Fainelli

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=20120613134801.GA5516@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=cernekee@gmail.com \
    --cc=florian@openwrt.org \
    --cc=jonas.gorski@gmail.com \
    --cc=linux-mips@linux-mips.org \
    --cc=mbizon@freebox.fr \
    /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