LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code
From: Grant Likely @ 2007-12-02  6:17 UTC (permalink / raw)
  To: linuxppc-dev, benh, vitb, galak, olof, jwboyer
In-Reply-To: <20071202061033.21193.64818.stgit@trillian.secretlab.ca>

On 12/1/07, Grant Likely <grant.likely@secretlab.ca> wrote:
> From: Grant Likely <grant.likely@secretlab.ca>
>
> This patch makes the platform code use the new machine-specific initcall
> hooks.  This has the advantage of not needing to explicitly test
> machine_is() at the top of every initcall function.

Warning: I have *not* exhaustively tested this; just spot checked in a
few places.  I'll be more thorough once I know everyone is okay with
it in principle.

Cheers,
g.

>
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---
>
>  arch/powerpc/platforms/40x/kilauea.c         |    5 +----
>  arch/powerpc/platforms/40x/virtex.c          |    5 +----
>  arch/powerpc/platforms/40x/walnut.c          |    5 +----
>  arch/powerpc/platforms/44x/bamboo.c          |    5 +----
>  arch/powerpc/platforms/44x/ebony.c           |    5 +----
>  arch/powerpc/platforms/44x/sequoia.c         |    5 +----
>  arch/powerpc/platforms/82xx/mpc8272_ads.c    |    5 +----
>  arch/powerpc/platforms/82xx/pq2fads.c        |    5 +----
>  arch/powerpc/platforms/83xx/mpc832x_mds.c    |    5 +----
>  arch/powerpc/platforms/83xx/mpc832x_rdb.c    |   11 ++---------
>  arch/powerpc/platforms/83xx/mpc836x_mds.c    |    5 +----
>  arch/powerpc/platforms/85xx/mpc85xx_ads.c    |    5 +----
>  arch/powerpc/platforms/85xx/mpc85xx_cds.c    |    6 +-----
>  arch/powerpc/platforms/85xx/mpc85xx_mds.c    |    5 +----
>  arch/powerpc/platforms/8xx/ep88xc.c          |    5 ++---
>  arch/powerpc/platforms/8xx/mpc885ads_setup.c |    5 ++---
>  arch/powerpc/platforms/cell/io-workarounds.c |    5 +----
>  arch/powerpc/platforms/cell/iommu.c          |    5 +----
>  arch/powerpc/platforms/cell/pmu.c            |    5 +----
>  arch/powerpc/platforms/cell/setup.c          |    5 +----
>  arch/powerpc/platforms/celleb/iommu.c        |    6 +-----
>  arch/powerpc/platforms/celleb/setup.c        |    5 +----
>  arch/powerpc/platforms/embedded6xx/ls_uart.c |    5 +----
>  arch/powerpc/platforms/pasemi/idle.c         |    5 +----
>  arch/powerpc/platforms/pasemi/setup.c        |   10 ++--------
>  arch/powerpc/platforms/powermac/low_i2c.c    |    7 ++-----
>  arch/powerpc/platforms/powermac/pfunc_base.c |    3 +--
>  arch/powerpc/platforms/powermac/pic.c        |    3 +--
>  arch/powerpc/platforms/powermac/setup.c      |   12 ++----------
>  29 files changed, 35 insertions(+), 128 deletions(-)
>
> diff --git a/arch/powerpc/platforms/40x/kilauea.c b/arch/powerpc/platforms/40x/kilauea.c
> index 1bffdbd..0853db7 100644
> --- a/arch/powerpc/platforms/40x/kilauea.c
> +++ b/arch/powerpc/platforms/40x/kilauea.c
> @@ -29,14 +29,11 @@ static struct of_device_id kilauea_of_bus[] = {
>
>  static int __init kilauea_device_probe(void)
>  {
> -       if (!machine_is(kilauea))
> -               return 0;
> -
>         of_platform_bus_probe(NULL, kilauea_of_bus, NULL);
>
>         return 0;
>  }
> -device_initcall(kilauea_device_probe);
> +machine_device_initcall(kilauea, kilauea_device_probe);
>
>  static int __init kilauea_probe(void)
>  {
> diff --git a/arch/powerpc/platforms/40x/virtex.c b/arch/powerpc/platforms/40x/virtex.c
> index 14bbc32..43fcc8e 100644
> --- a/arch/powerpc/platforms/40x/virtex.c
> +++ b/arch/powerpc/platforms/40x/virtex.c
> @@ -17,14 +17,11 @@
>
>  static int __init virtex_device_probe(void)
>  {
> -       if (!machine_is(virtex))
> -               return 0;
> -
>         of_platform_bus_probe(NULL, NULL, NULL);
>
>         return 0;
>  }
> -device_initcall(virtex_device_probe);
> +machine_device_initcall(virtex, virtex_device_probe);
>
>  static int __init virtex_probe(void)
>  {
> diff --git a/arch/powerpc/platforms/40x/walnut.c b/arch/powerpc/platforms/40x/walnut.c
> index ff6db24..91a5247 100644
> --- a/arch/powerpc/platforms/40x/walnut.c
> +++ b/arch/powerpc/platforms/40x/walnut.c
> @@ -34,15 +34,12 @@ static struct of_device_id walnut_of_bus[] = {
>
>  static int __init walnut_device_probe(void)
>  {
> -       if (!machine_is(walnut))
> -               return 0;
> -
>         /* FIXME: do bus probe here */
>         of_platform_bus_probe(NULL, walnut_of_bus, NULL);
>
>         return 0;
>  }
> -device_initcall(walnut_device_probe);
> +machine_device_initcall(walnut, walnut_device_probe);
>
>  static int __init walnut_probe(void)
>  {
> diff --git a/arch/powerpc/platforms/44x/bamboo.c b/arch/powerpc/platforms/44x/bamboo.c
> index be23f11..5253996 100644
> --- a/arch/powerpc/platforms/44x/bamboo.c
> +++ b/arch/powerpc/platforms/44x/bamboo.c
> @@ -32,14 +32,11 @@ static struct of_device_id bamboo_of_bus[] = {
>
>  static int __init bamboo_device_probe(void)
>  {
> -       if (!machine_is(bamboo))
> -               return 0;
> -
>         of_platform_bus_probe(NULL, bamboo_of_bus, NULL);
>
>         return 0;
>  }
> -device_initcall(bamboo_device_probe);
> +machine_device_initcall(bamboo, bamboo_device_probe);
>
>  static int __init bamboo_probe(void)
>  {
> diff --git a/arch/powerpc/platforms/44x/ebony.c b/arch/powerpc/platforms/44x/ebony.c
> index 6cd3476..b783c6e 100644
> --- a/arch/powerpc/platforms/44x/ebony.c
> +++ b/arch/powerpc/platforms/44x/ebony.c
> @@ -36,14 +36,11 @@ static struct of_device_id ebony_of_bus[] = {
>
>  static int __init ebony_device_probe(void)
>  {
> -       if (!machine_is(ebony))
> -               return 0;
> -
>         of_platform_bus_probe(NULL, ebony_of_bus, NULL);
>
>         return 0;
>  }
> -device_initcall(ebony_device_probe);
> +machine_device_initcall(ebony, ebony_device_probe);
>
>  /*
>   * Called very early, MMU is off, device-tree isn't unflattened
> diff --git a/arch/powerpc/platforms/44x/sequoia.c b/arch/powerpc/platforms/44x/sequoia.c
> index 21a9dd1..e5be0c7 100644
> --- a/arch/powerpc/platforms/44x/sequoia.c
> +++ b/arch/powerpc/platforms/44x/sequoia.c
> @@ -32,14 +32,11 @@ static struct of_device_id sequoia_of_bus[] = {
>
>  static int __init sequoia_device_probe(void)
>  {
> -       if (!machine_is(sequoia))
> -               return 0;
> -
>         of_platform_bus_probe(NULL, sequoia_of_bus, NULL);
>
>         return 0;
>  }
> -device_initcall(sequoia_device_probe);
> +machine_device_initcall(sequoia, sequoia_device_probe);
>
>  static int __init sequoia_probe(void)
>  {
> diff --git a/arch/powerpc/platforms/82xx/mpc8272_ads.c b/arch/powerpc/platforms/82xx/mpc8272_ads.c
> index fd83440..3fce6b3 100644
> --- a/arch/powerpc/platforms/82xx/mpc8272_ads.c
> +++ b/arch/powerpc/platforms/82xx/mpc8272_ads.c
> @@ -165,14 +165,11 @@ static struct of_device_id __initdata of_bus_ids[] = {
>
>  static int __init declare_of_platform_devices(void)
>  {
> -       if (!machine_is(mpc8272_ads))
> -               return 0;
> -
>         /* Publish the QE devices */
>         of_platform_bus_probe(NULL, of_bus_ids, NULL);
>         return 0;
>  }
> -device_initcall(declare_of_platform_devices);
> +machine_device_initcall(mpc8272_ads, declare_of_platform_devices);
>
>  /*
>   * Called very early, device-tree isn't unflattened
> diff --git a/arch/powerpc/platforms/82xx/pq2fads.c b/arch/powerpc/platforms/82xx/pq2fads.c
> index 4f457a9..c5430b3 100644
> --- a/arch/powerpc/platforms/82xx/pq2fads.c
> +++ b/arch/powerpc/platforms/82xx/pq2fads.c
> @@ -176,14 +176,11 @@ static struct of_device_id __initdata of_bus_ids[] = {
>
>  static int __init declare_of_platform_devices(void)
>  {
> -       if (!machine_is(pq2fads))
> -               return 0;
> -
>         /* Publish the QE devices */
>         of_platform_bus_probe(NULL, of_bus_ids, NULL);
>         return 0;
>  }
> -device_initcall(declare_of_platform_devices);
> +machine_device_initcall(pq2fads, declare_of_platform_devices);
>
>  define_machine(pq2fads)
>  {
> diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c
> index 39ee7a1..6b9d72a 100644
> --- a/arch/powerpc/platforms/83xx/mpc832x_mds.c
> +++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c
> @@ -110,15 +110,12 @@ static struct of_device_id mpc832x_ids[] = {
>
>  static int __init mpc832x_declare_of_platform_devices(void)
>  {
> -       if (!machine_is(mpc832x_mds))
> -               return 0;
> -
>         /* Publish the QE devices */
>         of_platform_bus_probe(NULL, mpc832x_ids, NULL);
>
>         return 0;
>  }
> -device_initcall(mpc832x_declare_of_platform_devices);
> +machine_device_initcall(mpc832x_mds, mpc832x_declare_of_platform_devices);
>
>  static void __init mpc832x_sys_init_IRQ(void)
>  {
> diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
> index d4bd040..67a282f 100644
> --- a/arch/powerpc/platforms/83xx/mpc832x_rdb.c
> +++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
> @@ -63,9 +63,6 @@ static struct spi_board_info mpc832x_spi_boardinfo = {
>
>  static int __init mpc832x_spi_init(void)
>  {
> -       if (!machine_is(mpc832x_rdb))
> -               return 0;
> -
>         par_io_config_pin(3,  0, 3, 0, 1, 0); /* SPI1 MOSI, I/O */
>         par_io_config_pin(3,  1, 3, 0, 1, 0); /* SPI1 MISO, I/O */
>         par_io_config_pin(3,  2, 3, 0, 1, 0); /* SPI1 CLK,  I/O */
> @@ -79,8 +76,7 @@ static int __init mpc832x_spi_init(void)
>                             mpc83xx_spi_activate_cs,
>                             mpc83xx_spi_deactivate_cs);
>  }
> -
> -device_initcall(mpc832x_spi_init);
> +machine_device_initcall(mpc832x_rdb, mpc832x_spi_init);
>
>  /* ************************************************************************
>   *
> @@ -123,15 +119,12 @@ static struct of_device_id mpc832x_ids[] = {
>
>  static int __init mpc832x_declare_of_platform_devices(void)
>  {
> -       if (!machine_is(mpc832x_rdb))
> -               return 0;
> -
>         /* Publish the QE devices */
>         of_platform_bus_probe(NULL, mpc832x_ids, NULL);
>
>         return 0;
>  }
> -device_initcall(mpc832x_declare_of_platform_devices);
> +machine_device_initcall(mpc832x_rdb, mpc832x_declare_of_platform_devices);
>
>  void __init mpc832x_rdb_init_IRQ(void)
>  {
> diff --git a/arch/powerpc/platforms/83xx/mpc836x_mds.c b/arch/powerpc/platforms/83xx/mpc836x_mds.c
> index e40012f..9f37718 100644
> --- a/arch/powerpc/platforms/83xx/mpc836x_mds.c
> +++ b/arch/powerpc/platforms/83xx/mpc836x_mds.c
> @@ -141,15 +141,12 @@ static struct of_device_id mpc836x_ids[] = {
>
>  static int __init mpc836x_declare_of_platform_devices(void)
>  {
> -       if (!machine_is(mpc836x_mds))
> -               return 0;
> -
>         /* Publish the QE devices */
>         of_platform_bus_probe(NULL, mpc836x_ids, NULL);
>
>         return 0;
>  }
> -device_initcall(mpc836x_declare_of_platform_devices);
> +machine_device_initcall(mpc836x_mds, mpc836x_declare_of_platform_devices);
>
>  static void __init mpc836x_mds_init_IRQ(void)
>  {
> diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
> index bccdc25..a3fa1b0 100644
> --- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c
> +++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
> @@ -233,13 +233,10 @@ static struct of_device_id __initdata of_bus_ids[] = {
>
>  static int __init declare_of_platform_devices(void)
>  {
> -       if (!machine_is(mpc85xx_ads))
> -               return 0;
> -
>         of_platform_bus_probe(NULL, of_bus_ids, NULL);
>         return 0;
>  }
> -device_initcall(declare_of_platform_devices);
> +machine_device_initcall(mpc85xx_ads, declare_of_platform_devices);
>
>  /*
>   * Called very early, device-tree isn't unflattened
> diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
> index 4d063ee..8b1de78 100644
> --- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c
> +++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
> @@ -222,9 +222,6 @@ static int mpc85xx_cds_8259_attach(void)
>         struct device_node *cascade_node = NULL;
>         int cascade_irq;
>
> -       if (!machine_is(mpc85xx_cds))
> -               return 0;
> -
>         /* Initialize the i8259 controller */
>         for_each_node_by_type(np, "interrupt-controller")
>                 if (of_device_is_compatible(np, "chrp,iic")) {
> @@ -262,8 +259,7 @@ static int mpc85xx_cds_8259_attach(void)
>
>         return 0;
>  }
> -
> -device_initcall(mpc85xx_cds_8259_attach);
> +machine_device_initcall(mpc85xx_cds, mpc85xx_cds_8259_attach);
>
>  #endif /* CONFIG_PPC_I8259 */
>
> diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
> index 61b3eed..5f68c99 100644
> --- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
> +++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
> @@ -144,15 +144,12 @@ static struct of_device_id mpc85xx_ids[] = {
>
>  static int __init mpc85xx_publish_devices(void)
>  {
> -       if (!machine_is(mpc85xx_mds))
> -               return 0;
> -
>         /* Publish the QE devices */
>         of_platform_bus_probe(NULL,mpc85xx_ids,NULL);
>
>         return 0;
>  }
> -device_initcall(mpc85xx_publish_devices);
> +machine_device_initcall(mpc85xx_mds, mpc85xx_publish_devices);
>
>  static void __init mpc85xx_mds_pic_init(void)
>  {
> diff --git a/arch/powerpc/platforms/8xx/ep88xc.c b/arch/powerpc/platforms/8xx/ep88xc.c
> index c518b6c..88afa35 100644
> --- a/arch/powerpc/platforms/8xx/ep88xc.c
> +++ b/arch/powerpc/platforms/8xx/ep88xc.c
> @@ -155,12 +155,11 @@ static struct of_device_id __initdata of_bus_ids[] = {
>  static int __init declare_of_platform_devices(void)
>  {
>         /* Publish the QE devices */
> -       if (machine_is(ep88xc))
> -               of_platform_bus_probe(NULL, of_bus_ids, NULL);
> +       of_platform_bus_probe(NULL, of_bus_ids, NULL);
>
>         return 0;
>  }
> -device_initcall(declare_of_platform_devices);
> +machine_device_initcall(ep88xc, declare_of_platform_devices);
>
>  define_machine(ep88xc) {
>         .name = "Embedded Planet EP88xC",
> diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
> index 2cf1b6a..6ef8e9e 100644
> --- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c
> +++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
> @@ -264,12 +264,11 @@ static struct of_device_id __initdata of_bus_ids[] = {
>  static int __init declare_of_platform_devices(void)
>  {
>         /* Publish the QE devices */
> -       if (machine_is(mpc885_ads))
> -               of_platform_bus_probe(NULL, of_bus_ids, NULL);
> +       of_platform_bus_probe(NULL, of_bus_ids, NULL);
>
>         return 0;
>  }
> -device_initcall(declare_of_platform_devices);
> +machine_device_initcall(mpc885_ads, declare_of_platform_devices);
>
>  define_machine(mpc885_ads) {
>         .name                   = "Freescale MPC885 ADS",
> diff --git a/arch/powerpc/platforms/cell/io-workarounds.c b/arch/powerpc/platforms/cell/io-workarounds.c
> index 9d7c2ef..e3ae39c 100644
> --- a/arch/powerpc/platforms/cell/io-workarounds.c
> +++ b/arch/powerpc/platforms/cell/io-workarounds.c
> @@ -309,9 +309,6 @@ static int __init spider_pci_workaround_init(void)
>  {
>         struct pci_controller *phb;
>
> -       if (!machine_is(cell))
> -               return 0;
> -
>         /* Find spider bridges. We assume they have been all probed
>          * in setup_arch(). If that was to change, we would need to
>          * update this code to cope with dynamically added busses
> @@ -343,4 +340,4 @@ static int __init spider_pci_workaround_init(void)
>
>         return 0;
>  }
> -arch_initcall(spider_pci_workaround_init);
> +machine_arch_initcall(cell, spider_pci_workaround_init);
> diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
> index faabc3f..648077f 100644
> --- a/arch/powerpc/platforms/cell/iommu.c
> +++ b/arch/powerpc/platforms/cell/iommu.c
> @@ -699,9 +699,6 @@ static int __init cell_iommu_init(void)
>  {
>         struct device_node *np;
>
> -       if (!machine_is(cell))
> -               return -ENODEV;
> -
>         /* If IOMMU is disabled or we have little enough RAM to not need
>          * to enable it, we setup a direct mapping.
>          *
> @@ -744,5 +741,5 @@ static int __init cell_iommu_init(void)
>
>         return 0;
>  }
> -arch_initcall(cell_iommu_init);
> +machine_arch_initcall(cell, cell_iommu_init);
>
> diff --git a/arch/powerpc/platforms/cell/pmu.c b/arch/powerpc/platforms/cell/pmu.c
> index 1ed3036..cb0cdab 100644
> --- a/arch/powerpc/platforms/cell/pmu.c
> +++ b/arch/powerpc/platforms/cell/pmu.c
> @@ -381,9 +381,6 @@ static int __init cbe_init_pm_irq(void)
>         unsigned int irq;
>         int rc, node;
>
> -       if (!machine_is(cell))
> -               return 0;
> -
>         for_each_node(node) {
>                 irq = irq_create_mapping(NULL, IIC_IRQ_IOEX_PMI |
>                                                (node << IIC_IRQ_NODE_SHIFT));
> @@ -404,7 +401,7 @@ static int __init cbe_init_pm_irq(void)
>
>         return 0;
>  }
> -arch_initcall(cbe_init_pm_irq);
> +machine_arch_initcall(cell, cbe_init_pm_irq);
>
>  void cbe_sync_irq(int node)
>  {
> diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
> index 98e7ef8..8390d2d 100644
> --- a/arch/powerpc/platforms/cell/setup.c
> +++ b/arch/powerpc/platforms/cell/setup.c
> @@ -85,9 +85,6 @@ static int __init cell_publish_devices(void)
>  {
>         int node;
>
> -       if (!machine_is(cell))
> -               return 0;
> -
>         /* Publish OF platform devices for southbridge IOs */
>         of_platform_bus_probe(NULL, NULL, NULL);
>
> @@ -101,7 +98,7 @@ static int __init cell_publish_devices(void)
>         }
>         return 0;
>  }
> -device_initcall(cell_publish_devices);
> +machine_device_initcall(cell, cell_publish_devices);
>
>  static void cell_mpic_cascade(unsigned int irq, struct irq_desc *desc)
>  {
> diff --git a/arch/powerpc/platforms/celleb/iommu.c b/arch/powerpc/platforms/celleb/iommu.c
> index 755d869..c9884f4 100644
> --- a/arch/powerpc/platforms/celleb/iommu.c
> +++ b/arch/powerpc/platforms/celleb/iommu.c
> @@ -91,14 +91,10 @@ static struct notifier_block celleb_of_bus_notifier = {
>
>  static int __init celleb_init_iommu(void)
>  {
> -       if (!machine_is(celleb))
> -               return -ENODEV;
> -
>         celleb_init_direct_mapping();
>         set_pci_dma_ops(&dma_direct_ops);
>         bus_register_notifier(&of_platform_bus_type, &celleb_of_bus_notifier);
>
>         return 0;
>  }
> -
> -arch_initcall(celleb_init_iommu);
> +machine_arch_initcall(celleb, celleb_init_iommu);
> diff --git a/arch/powerpc/platforms/celleb/setup.c b/arch/powerpc/platforms/celleb/setup.c
> index ddfb35a..aa18f95 100644
> --- a/arch/powerpc/platforms/celleb/setup.c
> +++ b/arch/powerpc/platforms/celleb/setup.c
> @@ -127,9 +127,6 @@ static struct of_device_id celleb_bus_ids[] __initdata = {
>
>  static int __init celleb_publish_devices(void)
>  {
> -       if (!machine_is(celleb))
> -               return 0;
> -
>         /* Publish OF platform devices for southbridge IOs */
>         of_platform_bus_probe(NULL, celleb_bus_ids, NULL);
>
> @@ -137,7 +134,7 @@ static int __init celleb_publish_devices(void)
>
>         return 0;
>  }
> -device_initcall(celleb_publish_devices);
> +machine_device_initcall(celleb, celleb_publish_devices);
>
>  define_machine(celleb) {
>         .name                   = "Cell Reference Set",
> diff --git a/arch/powerpc/platforms/embedded6xx/ls_uart.c b/arch/powerpc/platforms/embedded6xx/ls_uart.c
> index c99264c..9d891bd 100644
> --- a/arch/powerpc/platforms/embedded6xx/ls_uart.c
> +++ b/arch/powerpc/platforms/embedded6xx/ls_uart.c
> @@ -117,9 +117,6 @@ static int __init ls_uarts_init(void)
>         phys_addr_t phys_addr;
>         int len;
>
> -       if (!machine_is(linkstation))
> -               return 0;
> -
>         avr = of_find_node_by_path("/soc10x/serial@80004500");
>         if (!avr)
>                 return -EINVAL;
> @@ -142,4 +139,4 @@ static int __init ls_uarts_init(void)
>         return 0;
>  }
>
> -late_initcall(ls_uarts_init);
> +machine_late_initcall(linkstation, ls_uarts_init);
> diff --git a/arch/powerpc/platforms/pasemi/idle.c b/arch/powerpc/platforms/pasemi/idle.c
> index d8e1fcc..43911d8 100644
> --- a/arch/powerpc/platforms/pasemi/idle.c
> +++ b/arch/powerpc/platforms/pasemi/idle.c
> @@ -74,9 +74,6 @@ static int pasemi_system_reset_exception(struct pt_regs *regs)
>
>  static int __init pasemi_idle_init(void)
>  {
> -       if (!machine_is(pasemi))
> -               return -ENODEV;
> -
>  #ifndef CONFIG_PPC_PASEMI_CPUFREQ
>         printk(KERN_WARNING "No cpufreq driver, powersavings modes disabled\n");
>         current_mode = 0;
> @@ -88,7 +85,7 @@ static int __init pasemi_idle_init(void)
>
>         return 0;
>  }
> -late_initcall(pasemi_idle_init);
> +machine_late_initcall(pasemi, pasemi_idle_init);
>
>  static int __init idle_param(char *p)
>  {
> diff --git a/arch/powerpc/platforms/pasemi/setup.c b/arch/powerpc/platforms/pasemi/setup.c
> index 3d62060..59c8371 100644
> --- a/arch/powerpc/platforms/pasemi/setup.c
> +++ b/arch/powerpc/platforms/pasemi/setup.c
> @@ -126,9 +126,6 @@ static int __init pas_setup_mce_regs(void)
>         struct pci_dev *dev;
>         int reg;
>
> -       if (!machine_is(pasemi))
> -               return -ENODEV;
> -
>         /* Remap various SoC status registers for use by the MCE handler */
>
>         reg = 0;
> @@ -172,7 +169,7 @@ static int __init pas_setup_mce_regs(void)
>
>         return 0;
>  }
> -device_initcall(pas_setup_mce_regs);
> +machine_device_initcall(pasemi, pas_setup_mce_regs);
>
>  static __init void pas_init_IRQ(void)
>  {
> @@ -369,9 +366,6 @@ static struct of_device_id pasemi_bus_ids[] = {
>
>  static int __init pasemi_publish_devices(void)
>  {
> -       if (!machine_is(pasemi))
> -               return 0;
> -
>         pasemi_pcmcia_init();
>
>         /* Publish OF platform devices for SDC and other non-PCI devices */
> @@ -379,7 +373,7 @@ static int __init pasemi_publish_devices(void)
>
>         return 0;
>  }
> -device_initcall(pasemi_publish_devices);
> +machine_device_initcall(pasemi, pasemi_publish_devices);
>
>
>  /*
> diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c
> index da2007e..9c9299c 100644
> --- a/arch/powerpc/platforms/powermac/low_i2c.c
> +++ b/arch/powerpc/platforms/powermac/low_i2c.c
> @@ -1462,9 +1462,6 @@ int __init pmac_i2c_init(void)
>                 return 0;
>         i2c_inited = 1;
>
> -       if (!machine_is(powermac))
> -               return 0;
> -
>         /* Probe keywest-i2c busses */
>         kw_i2c_probe();
>
> @@ -1483,7 +1480,7 @@ int __init pmac_i2c_init(void)
>
>         return 0;
>  }
> -arch_initcall(pmac_i2c_init);
> +machine_arch_initcall(powermac, pmac_i2c_init);
>
>  /* Since pmac_i2c_init can be called too early for the platform device
>   * registration, we need to do it at a later time. In our case, subsys
> @@ -1515,4 +1512,4 @@ static int __init pmac_i2c_create_platform_devices(void)
>
>         return 0;
>  }
> -subsys_initcall(pmac_i2c_create_platform_devices);
> +machine_subsys_initcall(powermac, pmac_i2c_create_platform_devices);
> diff --git a/arch/powerpc/platforms/powermac/pfunc_base.c b/arch/powerpc/platforms/powermac/pfunc_base.c
> index 45d54b9..db20de5 100644
> --- a/arch/powerpc/platforms/powermac/pfunc_base.c
> +++ b/arch/powerpc/platforms/powermac/pfunc_base.c
> @@ -363,8 +363,7 @@ int __init pmac_pfunc_base_install(void)
>
>         return 0;
>  }
> -
> -arch_initcall(pmac_pfunc_base_install);
> +machine_arch_initcall(powermac, pmac_pfunc_base_install);
>
>  #ifdef CONFIG_PM
>
> diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c
> index 999f5e1..cd72164 100644
> --- a/arch/powerpc/platforms/powermac/pic.c
> +++ b/arch/powerpc/platforms/powermac/pic.c
> @@ -690,6 +690,5 @@ static int __init init_pmacpic_sysfs(void)
>         sysdev_driver_register(&pmacpic_sysclass, &driver_pmacpic);
>         return 0;
>  }
> -
> -subsys_initcall(init_pmacpic_sysfs);
> +machine_subsys_initcall(powermac, init_pmacpic_sysfs);
>
> diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
> index 02c5330..0421189 100644
> --- a/arch/powerpc/platforms/powermac/setup.c
> +++ b/arch/powerpc/platforms/powermac/setup.c
> @@ -398,17 +398,13 @@ static int initializing = 1;
>
>  static int pmac_late_init(void)
>  {
> -       if (!machine_is(powermac))
> -               return -ENODEV;
> -
>         initializing = 0;
>         /* this is udbg (which is __init) and we can later use it during
>          * cpu hotplug (in smp_core99_kick_cpu) */
>         ppc_md.progress = NULL;
>         return 0;
>  }
> -
> -late_initcall(pmac_late_init);
> +machine_late_initcall(powermac, pmac_late_init);
>
>  /*
>   * This is __init_refok because we check for "initializing" before
> @@ -535,9 +531,6 @@ static int __init pmac_declare_of_platform_devices(void)
>         if (machine_is(chrp))
>                 return -1;
>
> -       if (!machine_is(powermac))
> -               return 0;
> -
>         np = of_find_node_by_name(NULL, "valkyrie");
>         if (np)
>                 of_platform_device_create(np, "valkyrie", NULL);
> @@ -552,8 +545,7 @@ static int __init pmac_declare_of_platform_devices(void)
>
>         return 0;
>  }
> -
> -device_initcall(pmac_declare_of_platform_devices);
> +machine_device_initcall(powermac, pmac_declare_of_platform_devices);
>
>  /*
>   * Called very early, MMU is off, device-tree isn't unflattened
>
>


-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

^ permalink raw reply

* [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code
From: Grant Likely @ 2007-12-02  6:10 UTC (permalink / raw)
  To: linuxppc-dev, benh, vitb, galak, olof, jwboyer
In-Reply-To: <20071202061028.21193.39309.stgit@trillian.secretlab.ca>

From: Grant Likely <grant.likely@secretlab.ca>

This patch makes the platform code use the new machine-specific initcall
hooks.  This has the advantage of not needing to explicitly test
machine_is() at the top of every initcall function.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/powerpc/platforms/40x/kilauea.c         |    5 +----
 arch/powerpc/platforms/40x/virtex.c          |    5 +----
 arch/powerpc/platforms/40x/walnut.c          |    5 +----
 arch/powerpc/platforms/44x/bamboo.c          |    5 +----
 arch/powerpc/platforms/44x/ebony.c           |    5 +----
 arch/powerpc/platforms/44x/sequoia.c         |    5 +----
 arch/powerpc/platforms/82xx/mpc8272_ads.c    |    5 +----
 arch/powerpc/platforms/82xx/pq2fads.c        |    5 +----
 arch/powerpc/platforms/83xx/mpc832x_mds.c    |    5 +----
 arch/powerpc/platforms/83xx/mpc832x_rdb.c    |   11 ++---------
 arch/powerpc/platforms/83xx/mpc836x_mds.c    |    5 +----
 arch/powerpc/platforms/85xx/mpc85xx_ads.c    |    5 +----
 arch/powerpc/platforms/85xx/mpc85xx_cds.c    |    6 +-----
 arch/powerpc/platforms/85xx/mpc85xx_mds.c    |    5 +----
 arch/powerpc/platforms/8xx/ep88xc.c          |    5 ++---
 arch/powerpc/platforms/8xx/mpc885ads_setup.c |    5 ++---
 arch/powerpc/platforms/cell/io-workarounds.c |    5 +----
 arch/powerpc/platforms/cell/iommu.c          |    5 +----
 arch/powerpc/platforms/cell/pmu.c            |    5 +----
 arch/powerpc/platforms/cell/setup.c          |    5 +----
 arch/powerpc/platforms/celleb/iommu.c        |    6 +-----
 arch/powerpc/platforms/celleb/setup.c        |    5 +----
 arch/powerpc/platforms/embedded6xx/ls_uart.c |    5 +----
 arch/powerpc/platforms/pasemi/idle.c         |    5 +----
 arch/powerpc/platforms/pasemi/setup.c        |   10 ++--------
 arch/powerpc/platforms/powermac/low_i2c.c    |    7 ++-----
 arch/powerpc/platforms/powermac/pfunc_base.c |    3 +--
 arch/powerpc/platforms/powermac/pic.c        |    3 +--
 arch/powerpc/platforms/powermac/setup.c      |   12 ++----------
 29 files changed, 35 insertions(+), 128 deletions(-)

diff --git a/arch/powerpc/platforms/40x/kilauea.c b/arch/powerpc/platforms/40x/kilauea.c
index 1bffdbd..0853db7 100644
--- a/arch/powerpc/platforms/40x/kilauea.c
+++ b/arch/powerpc/platforms/40x/kilauea.c
@@ -29,14 +29,11 @@ static struct of_device_id kilauea_of_bus[] = {
 
 static int __init kilauea_device_probe(void)
 {
-	if (!machine_is(kilauea))
-		return 0;
-
 	of_platform_bus_probe(NULL, kilauea_of_bus, NULL);
 
 	return 0;
 }
-device_initcall(kilauea_device_probe);
+machine_device_initcall(kilauea, kilauea_device_probe);
 
 static int __init kilauea_probe(void)
 {
diff --git a/arch/powerpc/platforms/40x/virtex.c b/arch/powerpc/platforms/40x/virtex.c
index 14bbc32..43fcc8e 100644
--- a/arch/powerpc/platforms/40x/virtex.c
+++ b/arch/powerpc/platforms/40x/virtex.c
@@ -17,14 +17,11 @@
 
 static int __init virtex_device_probe(void)
 {
-	if (!machine_is(virtex))
-		return 0;
-
 	of_platform_bus_probe(NULL, NULL, NULL);
 
 	return 0;
 }
-device_initcall(virtex_device_probe);
+machine_device_initcall(virtex, virtex_device_probe);
 
 static int __init virtex_probe(void)
 {
diff --git a/arch/powerpc/platforms/40x/walnut.c b/arch/powerpc/platforms/40x/walnut.c
index ff6db24..91a5247 100644
--- a/arch/powerpc/platforms/40x/walnut.c
+++ b/arch/powerpc/platforms/40x/walnut.c
@@ -34,15 +34,12 @@ static struct of_device_id walnut_of_bus[] = {
 
 static int __init walnut_device_probe(void)
 {
-	if (!machine_is(walnut))
-		return 0;
-
 	/* FIXME: do bus probe here */
 	of_platform_bus_probe(NULL, walnut_of_bus, NULL);
 
 	return 0;
 }
-device_initcall(walnut_device_probe);
+machine_device_initcall(walnut, walnut_device_probe);
 
 static int __init walnut_probe(void)
 {
diff --git a/arch/powerpc/platforms/44x/bamboo.c b/arch/powerpc/platforms/44x/bamboo.c
index be23f11..5253996 100644
--- a/arch/powerpc/platforms/44x/bamboo.c
+++ b/arch/powerpc/platforms/44x/bamboo.c
@@ -32,14 +32,11 @@ static struct of_device_id bamboo_of_bus[] = {
 
 static int __init bamboo_device_probe(void)
 {
-	if (!machine_is(bamboo))
-		return 0;
-
 	of_platform_bus_probe(NULL, bamboo_of_bus, NULL);
 
 	return 0;
 }
-device_initcall(bamboo_device_probe);
+machine_device_initcall(bamboo, bamboo_device_probe);
 
 static int __init bamboo_probe(void)
 {
diff --git a/arch/powerpc/platforms/44x/ebony.c b/arch/powerpc/platforms/44x/ebony.c
index 6cd3476..b783c6e 100644
--- a/arch/powerpc/platforms/44x/ebony.c
+++ b/arch/powerpc/platforms/44x/ebony.c
@@ -36,14 +36,11 @@ static struct of_device_id ebony_of_bus[] = {
 
 static int __init ebony_device_probe(void)
 {
-	if (!machine_is(ebony))
-		return 0;
-
 	of_platform_bus_probe(NULL, ebony_of_bus, NULL);
 
 	return 0;
 }
-device_initcall(ebony_device_probe);
+machine_device_initcall(ebony, ebony_device_probe);
 
 /*
  * Called very early, MMU is off, device-tree isn't unflattened
diff --git a/arch/powerpc/platforms/44x/sequoia.c b/arch/powerpc/platforms/44x/sequoia.c
index 21a9dd1..e5be0c7 100644
--- a/arch/powerpc/platforms/44x/sequoia.c
+++ b/arch/powerpc/platforms/44x/sequoia.c
@@ -32,14 +32,11 @@ static struct of_device_id sequoia_of_bus[] = {
 
 static int __init sequoia_device_probe(void)
 {
-	if (!machine_is(sequoia))
-		return 0;
-
 	of_platform_bus_probe(NULL, sequoia_of_bus, NULL);
 
 	return 0;
 }
-device_initcall(sequoia_device_probe);
+machine_device_initcall(sequoia, sequoia_device_probe);
 
 static int __init sequoia_probe(void)
 {
diff --git a/arch/powerpc/platforms/82xx/mpc8272_ads.c b/arch/powerpc/platforms/82xx/mpc8272_ads.c
index fd83440..3fce6b3 100644
--- a/arch/powerpc/platforms/82xx/mpc8272_ads.c
+++ b/arch/powerpc/platforms/82xx/mpc8272_ads.c
@@ -165,14 +165,11 @@ static struct of_device_id __initdata of_bus_ids[] = {
 
 static int __init declare_of_platform_devices(void)
 {
-	if (!machine_is(mpc8272_ads))
-		return 0;
-
 	/* Publish the QE devices */
 	of_platform_bus_probe(NULL, of_bus_ids, NULL);
 	return 0;
 }
-device_initcall(declare_of_platform_devices);
+machine_device_initcall(mpc8272_ads, declare_of_platform_devices);
 
 /*
  * Called very early, device-tree isn't unflattened
diff --git a/arch/powerpc/platforms/82xx/pq2fads.c b/arch/powerpc/platforms/82xx/pq2fads.c
index 4f457a9..c5430b3 100644
--- a/arch/powerpc/platforms/82xx/pq2fads.c
+++ b/arch/powerpc/platforms/82xx/pq2fads.c
@@ -176,14 +176,11 @@ static struct of_device_id __initdata of_bus_ids[] = {
 
 static int __init declare_of_platform_devices(void)
 {
-	if (!machine_is(pq2fads))
-		return 0;
-
 	/* Publish the QE devices */
 	of_platform_bus_probe(NULL, of_bus_ids, NULL);
 	return 0;
 }
-device_initcall(declare_of_platform_devices);
+machine_device_initcall(pq2fads, declare_of_platform_devices);
 
 define_machine(pq2fads)
 {
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c
index 39ee7a1..6b9d72a 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c
@@ -110,15 +110,12 @@ static struct of_device_id mpc832x_ids[] = {
 
 static int __init mpc832x_declare_of_platform_devices(void)
 {
-	if (!machine_is(mpc832x_mds))
-		return 0;
-
 	/* Publish the QE devices */
 	of_platform_bus_probe(NULL, mpc832x_ids, NULL);
 
 	return 0;
 }
-device_initcall(mpc832x_declare_of_platform_devices);
+machine_device_initcall(mpc832x_mds, mpc832x_declare_of_platform_devices);
 
 static void __init mpc832x_sys_init_IRQ(void)
 {
diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
index d4bd040..67a282f 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
@@ -63,9 +63,6 @@ static struct spi_board_info mpc832x_spi_boardinfo = {
 
 static int __init mpc832x_spi_init(void)
 {
-	if (!machine_is(mpc832x_rdb))
-		return 0;
-
 	par_io_config_pin(3,  0, 3, 0, 1, 0); /* SPI1 MOSI, I/O */
 	par_io_config_pin(3,  1, 3, 0, 1, 0); /* SPI1 MISO, I/O */
 	par_io_config_pin(3,  2, 3, 0, 1, 0); /* SPI1 CLK,  I/O */
@@ -79,8 +76,7 @@ static int __init mpc832x_spi_init(void)
 			    mpc83xx_spi_activate_cs,
 			    mpc83xx_spi_deactivate_cs);
 }
-
-device_initcall(mpc832x_spi_init);
+machine_device_initcall(mpc832x_rdb, mpc832x_spi_init);
 
 /* ************************************************************************
  *
@@ -123,15 +119,12 @@ static struct of_device_id mpc832x_ids[] = {
 
 static int __init mpc832x_declare_of_platform_devices(void)
 {
-	if (!machine_is(mpc832x_rdb))
-		return 0;
-
 	/* Publish the QE devices */
 	of_platform_bus_probe(NULL, mpc832x_ids, NULL);
 
 	return 0;
 }
-device_initcall(mpc832x_declare_of_platform_devices);
+machine_device_initcall(mpc832x_rdb, mpc832x_declare_of_platform_devices);
 
 void __init mpc832x_rdb_init_IRQ(void)
 {
diff --git a/arch/powerpc/platforms/83xx/mpc836x_mds.c b/arch/powerpc/platforms/83xx/mpc836x_mds.c
index e40012f..9f37718 100644
--- a/arch/powerpc/platforms/83xx/mpc836x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc836x_mds.c
@@ -141,15 +141,12 @@ static struct of_device_id mpc836x_ids[] = {
 
 static int __init mpc836x_declare_of_platform_devices(void)
 {
-	if (!machine_is(mpc836x_mds))
-		return 0;
-
 	/* Publish the QE devices */
 	of_platform_bus_probe(NULL, mpc836x_ids, NULL);
 
 	return 0;
 }
-device_initcall(mpc836x_declare_of_platform_devices);
+machine_device_initcall(mpc836x_mds, mpc836x_declare_of_platform_devices);
 
 static void __init mpc836x_mds_init_IRQ(void)
 {
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
index bccdc25..a3fa1b0 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
@@ -233,13 +233,10 @@ static struct of_device_id __initdata of_bus_ids[] = {
 
 static int __init declare_of_platform_devices(void)
 {
-	if (!machine_is(mpc85xx_ads))
-		return 0;
-
 	of_platform_bus_probe(NULL, of_bus_ids, NULL);
 	return 0;
 }
-device_initcall(declare_of_platform_devices);
+machine_device_initcall(mpc85xx_ads, declare_of_platform_devices);
 
 /*
  * Called very early, device-tree isn't unflattened
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
index 4d063ee..8b1de78 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
@@ -222,9 +222,6 @@ static int mpc85xx_cds_8259_attach(void)
 	struct device_node *cascade_node = NULL;
 	int cascade_irq;
 
-	if (!machine_is(mpc85xx_cds))
-		return 0;
-
 	/* Initialize the i8259 controller */
 	for_each_node_by_type(np, "interrupt-controller")
 		if (of_device_is_compatible(np, "chrp,iic")) {
@@ -262,8 +259,7 @@ static int mpc85xx_cds_8259_attach(void)
 
 	return 0;
 }
-
-device_initcall(mpc85xx_cds_8259_attach);
+machine_device_initcall(mpc85xx_cds, mpc85xx_cds_8259_attach);
 
 #endif /* CONFIG_PPC_I8259 */
 
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index 61b3eed..5f68c99 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -144,15 +144,12 @@ static struct of_device_id mpc85xx_ids[] = {
 
 static int __init mpc85xx_publish_devices(void)
 {
-	if (!machine_is(mpc85xx_mds))
-		return 0;
-
 	/* Publish the QE devices */
 	of_platform_bus_probe(NULL,mpc85xx_ids,NULL);
 
 	return 0;
 }
-device_initcall(mpc85xx_publish_devices);
+machine_device_initcall(mpc85xx_mds, mpc85xx_publish_devices);
 
 static void __init mpc85xx_mds_pic_init(void)
 {
diff --git a/arch/powerpc/platforms/8xx/ep88xc.c b/arch/powerpc/platforms/8xx/ep88xc.c
index c518b6c..88afa35 100644
--- a/arch/powerpc/platforms/8xx/ep88xc.c
+++ b/arch/powerpc/platforms/8xx/ep88xc.c
@@ -155,12 +155,11 @@ static struct of_device_id __initdata of_bus_ids[] = {
 static int __init declare_of_platform_devices(void)
 {
 	/* Publish the QE devices */
-	if (machine_is(ep88xc))
-		of_platform_bus_probe(NULL, of_bus_ids, NULL);
+	of_platform_bus_probe(NULL, of_bus_ids, NULL);
 
 	return 0;
 }
-device_initcall(declare_of_platform_devices);
+machine_device_initcall(ep88xc, declare_of_platform_devices);
 
 define_machine(ep88xc) {
 	.name = "Embedded Planet EP88xC",
diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
index 2cf1b6a..6ef8e9e 100644
--- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c
+++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
@@ -264,12 +264,11 @@ static struct of_device_id __initdata of_bus_ids[] = {
 static int __init declare_of_platform_devices(void)
 {
 	/* Publish the QE devices */
-	if (machine_is(mpc885_ads))
-		of_platform_bus_probe(NULL, of_bus_ids, NULL);
+	of_platform_bus_probe(NULL, of_bus_ids, NULL);
 
 	return 0;
 }
-device_initcall(declare_of_platform_devices);
+machine_device_initcall(mpc885_ads, declare_of_platform_devices);
 
 define_machine(mpc885_ads) {
 	.name			= "Freescale MPC885 ADS",
diff --git a/arch/powerpc/platforms/cell/io-workarounds.c b/arch/powerpc/platforms/cell/io-workarounds.c
index 9d7c2ef..e3ae39c 100644
--- a/arch/powerpc/platforms/cell/io-workarounds.c
+++ b/arch/powerpc/platforms/cell/io-workarounds.c
@@ -309,9 +309,6 @@ static int __init spider_pci_workaround_init(void)
 {
 	struct pci_controller *phb;
 
-	if (!machine_is(cell))
-		return 0;
-
 	/* Find spider bridges. We assume they have been all probed
 	 * in setup_arch(). If that was to change, we would need to
 	 * update this code to cope with dynamically added busses
@@ -343,4 +340,4 @@ static int __init spider_pci_workaround_init(void)
 
 	return 0;
 }
-arch_initcall(spider_pci_workaround_init);
+machine_arch_initcall(cell, spider_pci_workaround_init);
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index faabc3f..648077f 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -699,9 +699,6 @@ static int __init cell_iommu_init(void)
 {
 	struct device_node *np;
 
-	if (!machine_is(cell))
-		return -ENODEV;
-
 	/* If IOMMU is disabled or we have little enough RAM to not need
 	 * to enable it, we setup a direct mapping.
 	 *
@@ -744,5 +741,5 @@ static int __init cell_iommu_init(void)
 
 	return 0;
 }
-arch_initcall(cell_iommu_init);
+machine_arch_initcall(cell, cell_iommu_init);
 
diff --git a/arch/powerpc/platforms/cell/pmu.c b/arch/powerpc/platforms/cell/pmu.c
index 1ed3036..cb0cdab 100644
--- a/arch/powerpc/platforms/cell/pmu.c
+++ b/arch/powerpc/platforms/cell/pmu.c
@@ -381,9 +381,6 @@ static int __init cbe_init_pm_irq(void)
 	unsigned int irq;
 	int rc, node;
 
-	if (!machine_is(cell))
-		return 0;
-
 	for_each_node(node) {
 		irq = irq_create_mapping(NULL, IIC_IRQ_IOEX_PMI |
 					       (node << IIC_IRQ_NODE_SHIFT));
@@ -404,7 +401,7 @@ static int __init cbe_init_pm_irq(void)
 
 	return 0;
 }
-arch_initcall(cbe_init_pm_irq);
+machine_arch_initcall(cell, cbe_init_pm_irq);
 
 void cbe_sync_irq(int node)
 {
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
index 98e7ef8..8390d2d 100644
--- a/arch/powerpc/platforms/cell/setup.c
+++ b/arch/powerpc/platforms/cell/setup.c
@@ -85,9 +85,6 @@ static int __init cell_publish_devices(void)
 {
 	int node;
 
-	if (!machine_is(cell))
-		return 0;
-
 	/* Publish OF platform devices for southbridge IOs */
 	of_platform_bus_probe(NULL, NULL, NULL);
 
@@ -101,7 +98,7 @@ static int __init cell_publish_devices(void)
 	}
 	return 0;
 }
-device_initcall(cell_publish_devices);
+machine_device_initcall(cell, cell_publish_devices);
 
 static void cell_mpic_cascade(unsigned int irq, struct irq_desc *desc)
 {
diff --git a/arch/powerpc/platforms/celleb/iommu.c b/arch/powerpc/platforms/celleb/iommu.c
index 755d869..c9884f4 100644
--- a/arch/powerpc/platforms/celleb/iommu.c
+++ b/arch/powerpc/platforms/celleb/iommu.c
@@ -91,14 +91,10 @@ static struct notifier_block celleb_of_bus_notifier = {
 
 static int __init celleb_init_iommu(void)
 {
-	if (!machine_is(celleb))
-		return -ENODEV;
-
 	celleb_init_direct_mapping();
 	set_pci_dma_ops(&dma_direct_ops);
 	bus_register_notifier(&of_platform_bus_type, &celleb_of_bus_notifier);
 
 	return 0;
 }
-
-arch_initcall(celleb_init_iommu);
+machine_arch_initcall(celleb, celleb_init_iommu);
diff --git a/arch/powerpc/platforms/celleb/setup.c b/arch/powerpc/platforms/celleb/setup.c
index ddfb35a..aa18f95 100644
--- a/arch/powerpc/platforms/celleb/setup.c
+++ b/arch/powerpc/platforms/celleb/setup.c
@@ -127,9 +127,6 @@ static struct of_device_id celleb_bus_ids[] __initdata = {
 
 static int __init celleb_publish_devices(void)
 {
-	if (!machine_is(celleb))
-		return 0;
-
 	/* Publish OF platform devices for southbridge IOs */
 	of_platform_bus_probe(NULL, celleb_bus_ids, NULL);
 
@@ -137,7 +134,7 @@ static int __init celleb_publish_devices(void)
 
 	return 0;
 }
-device_initcall(celleb_publish_devices);
+machine_device_initcall(celleb, celleb_publish_devices);
 
 define_machine(celleb) {
 	.name			= "Cell Reference Set",
diff --git a/arch/powerpc/platforms/embedded6xx/ls_uart.c b/arch/powerpc/platforms/embedded6xx/ls_uart.c
index c99264c..9d891bd 100644
--- a/arch/powerpc/platforms/embedded6xx/ls_uart.c
+++ b/arch/powerpc/platforms/embedded6xx/ls_uart.c
@@ -117,9 +117,6 @@ static int __init ls_uarts_init(void)
 	phys_addr_t phys_addr;
 	int len;
 
-	if (!machine_is(linkstation))
-		return 0;
-
 	avr = of_find_node_by_path("/soc10x/serial@80004500");
 	if (!avr)
 		return -EINVAL;
@@ -142,4 +139,4 @@ static int __init ls_uarts_init(void)
 	return 0;
 }
 
-late_initcall(ls_uarts_init);
+machine_late_initcall(linkstation, ls_uarts_init);
diff --git a/arch/powerpc/platforms/pasemi/idle.c b/arch/powerpc/platforms/pasemi/idle.c
index d8e1fcc..43911d8 100644
--- a/arch/powerpc/platforms/pasemi/idle.c
+++ b/arch/powerpc/platforms/pasemi/idle.c
@@ -74,9 +74,6 @@ static int pasemi_system_reset_exception(struct pt_regs *regs)
 
 static int __init pasemi_idle_init(void)
 {
-	if (!machine_is(pasemi))
-		return -ENODEV;
-
 #ifndef CONFIG_PPC_PASEMI_CPUFREQ
 	printk(KERN_WARNING "No cpufreq driver, powersavings modes disabled\n");
 	current_mode = 0;
@@ -88,7 +85,7 @@ static int __init pasemi_idle_init(void)
 
 	return 0;
 }
-late_initcall(pasemi_idle_init);
+machine_late_initcall(pasemi, pasemi_idle_init);
 
 static int __init idle_param(char *p)
 {
diff --git a/arch/powerpc/platforms/pasemi/setup.c b/arch/powerpc/platforms/pasemi/setup.c
index 3d62060..59c8371 100644
--- a/arch/powerpc/platforms/pasemi/setup.c
+++ b/arch/powerpc/platforms/pasemi/setup.c
@@ -126,9 +126,6 @@ static int __init pas_setup_mce_regs(void)
 	struct pci_dev *dev;
 	int reg;
 
-	if (!machine_is(pasemi))
-		return -ENODEV;
-
 	/* Remap various SoC status registers for use by the MCE handler */
 
 	reg = 0;
@@ -172,7 +169,7 @@ static int __init pas_setup_mce_regs(void)
 
 	return 0;
 }
-device_initcall(pas_setup_mce_regs);
+machine_device_initcall(pasemi, pas_setup_mce_regs);
 
 static __init void pas_init_IRQ(void)
 {
@@ -369,9 +366,6 @@ static struct of_device_id pasemi_bus_ids[] = {
 
 static int __init pasemi_publish_devices(void)
 {
-	if (!machine_is(pasemi))
-		return 0;
-
 	pasemi_pcmcia_init();
 
 	/* Publish OF platform devices for SDC and other non-PCI devices */
@@ -379,7 +373,7 @@ static int __init pasemi_publish_devices(void)
 
 	return 0;
 }
-device_initcall(pasemi_publish_devices);
+machine_device_initcall(pasemi, pasemi_publish_devices);
 
 
 /*
diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c
index da2007e..9c9299c 100644
--- a/arch/powerpc/platforms/powermac/low_i2c.c
+++ b/arch/powerpc/platforms/powermac/low_i2c.c
@@ -1462,9 +1462,6 @@ int __init pmac_i2c_init(void)
 		return 0;
 	i2c_inited = 1;
 
-	if (!machine_is(powermac))
-		return 0;
-
 	/* Probe keywest-i2c busses */
 	kw_i2c_probe();
 
@@ -1483,7 +1480,7 @@ int __init pmac_i2c_init(void)
 
 	return 0;
 }
-arch_initcall(pmac_i2c_init);
+machine_arch_initcall(powermac, pmac_i2c_init);
 
 /* Since pmac_i2c_init can be called too early for the platform device
  * registration, we need to do it at a later time. In our case, subsys
@@ -1515,4 +1512,4 @@ static int __init pmac_i2c_create_platform_devices(void)
 
 	return 0;
 }
-subsys_initcall(pmac_i2c_create_platform_devices);
+machine_subsys_initcall(powermac, pmac_i2c_create_platform_devices);
diff --git a/arch/powerpc/platforms/powermac/pfunc_base.c b/arch/powerpc/platforms/powermac/pfunc_base.c
index 45d54b9..db20de5 100644
--- a/arch/powerpc/platforms/powermac/pfunc_base.c
+++ b/arch/powerpc/platforms/powermac/pfunc_base.c
@@ -363,8 +363,7 @@ int __init pmac_pfunc_base_install(void)
 
 	return 0;
 }
-
-arch_initcall(pmac_pfunc_base_install);
+machine_arch_initcall(powermac, pmac_pfunc_base_install);
 
 #ifdef CONFIG_PM
 
diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c
index 999f5e1..cd72164 100644
--- a/arch/powerpc/platforms/powermac/pic.c
+++ b/arch/powerpc/platforms/powermac/pic.c
@@ -690,6 +690,5 @@ static int __init init_pmacpic_sysfs(void)
 	sysdev_driver_register(&pmacpic_sysclass, &driver_pmacpic);
 	return 0;
 }
-
-subsys_initcall(init_pmacpic_sysfs);
+machine_subsys_initcall(powermac, init_pmacpic_sysfs);
 
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 02c5330..0421189 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -398,17 +398,13 @@ static int initializing = 1;
 
 static int pmac_late_init(void)
 {
-	if (!machine_is(powermac))
-		return -ENODEV;
-
 	initializing = 0;
 	/* this is udbg (which is __init) and we can later use it during
 	 * cpu hotplug (in smp_core99_kick_cpu) */
 	ppc_md.progress = NULL;
 	return 0;
 }
-
-late_initcall(pmac_late_init);
+machine_late_initcall(powermac, pmac_late_init);
 
 /*
  * This is __init_refok because we check for "initializing" before
@@ -535,9 +531,6 @@ static int __init pmac_declare_of_platform_devices(void)
 	if (machine_is(chrp))
 		return -1;
 
-	if (!machine_is(powermac))
-		return 0;
-
 	np = of_find_node_by_name(NULL, "valkyrie");
 	if (np)
 		of_platform_device_create(np, "valkyrie", NULL);
@@ -552,8 +545,7 @@ static int __init pmac_declare_of_platform_devices(void)
 
 	return 0;
 }
-
-device_initcall(pmac_declare_of_platform_devices);
+machine_device_initcall(powermac, pmac_declare_of_platform_devices);
 
 /*
  * Called very early, MMU is off, device-tree isn't unflattened

^ permalink raw reply related

* [PATCH v2 1/2] [POWERPC] Add machine initcall macros
From: Grant Likely @ 2007-12-02  6:10 UTC (permalink / raw)
  To: linuxppc-dev, benh, vitb, galak, olof, jwboyer

From: Grant Likely <grant.likely@secretlab.ca>

The machine initcall macros allow initcalls to be registered which
test machine_is() before executing the initcall.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 include/asm-powerpc/machdep.h |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h
index 6968f43..d5cd982 100644
--- a/include/asm-powerpc/machdep.h
+++ b/include/asm-powerpc/machdep.h
@@ -326,5 +326,28 @@ static inline void log_error(char *buf, unsigned int err_type, int fatal)
 		ppc_md.log_error(buf, err_type, fatal);
 }
 
+#define __define_machine_initcall(mach,level,fn,id) \
+	static int __init __machine_initcall_##mach##_##fn(void) { \
+		if (machine_is(mach)) return fn(); \
+		return 0; \
+	} \
+	__define_initcall(level,__machine_initcall_##mach##_##fn,id);
+
+#define machine_core_initcall(mach,fn)		__define_machine_initcall(mach,"1",fn,1)
+#define machine_core_initcall_sync(mach,fn)	__define_machine_initcall(mach,"1s",fn,1s)
+#define machine_postcore_initcall(mach,fn)	__define_machine_initcall(mach,"2",fn,2)
+#define machine_postcore_initcall_sync(mach,fn)	__define_machine_initcall(mach,"2s",fn,2s)
+#define machine_arch_initcall(mach,fn)		__define_machine_initcall(mach,"3",fn,3)
+#define machine_arch_initcall_sync(mach,fn)	__define_machine_initcall(mach,"3s",fn,3s)
+#define machine_subsys_initcall(mach,fn)	__define_machine_initcall(mach,"4",fn,4)
+#define machine_subsys_initcall_sync(mach,fn)	__define_machine_initcall(mach,"4s",fn,4s)
+#define machine_fs_initcall(mach,fn)		__define_machine_initcall(mach,"5",fn,5)
+#define machine_fs_initcall_sync(mach,fn)	__define_machine_initcall(mach,"5s",fn,5s)
+#define machine_rootfs_initcall(mach,fn)	__define_machine_initcall(mach,"rootfs",fn,rootfs)
+#define machine_device_initcall(mach,fn)	__define_machine_initcall(mach,"6",fn,6)
+#define machine_device_initcall_sync(mach,fn)	__define_machine_initcall(mach,"6s",fn,6s)
+#define machine_late_initcall(mach,fn)		__define_machine_initcall(mach,"7",fn,7)
+#define machine_late_initcall_sync(mach,fn)	__define_machine_initcall(mach,"7s",fn,7s)
+
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_MACHDEP_H */

^ permalink raw reply related

* [PATCH] Fix buglets in mpc5200 FEC code that are corrupting memory.
From: Grant Likely @ 2007-12-02  6:00 UTC (permalink / raw)
  To: linuxppc-dev, netdev, jonsmirl, jgarzik; +Cc: dwmw2, domen.puncer

From: Jon Smirl <jonsmirl@gmail.com>

This is the reason I couldn't get user space started or connect to my
nfs server. Patch is against current linus git.

mpc5200 fec driver is corrupting memory. This patch fixes two bugs
where the wrong skb buffer was being referenced.

Signed-off-by: Jon Smirl <jonsmirl@gmail.com>
Acked-by: Domen Puncer <domen.puncer@telargo.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

Jeff, this one hasn't been picked up for 2.6.24 yet and in needs to go in.

Thanks,
g.

 drivers/net/fec_mpc52xx.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index a8a0ee2..ddfcc0b 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -422,7 +422,7 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id)
 
 		rskb = bcom_retrieve_buffer(priv->rx_dmatsk, &status,
 				(struct bcom_bd **)&bd);
-		dma_unmap_single(&dev->dev, bd->skb_pa, skb->len, DMA_FROM_DEVICE);
+		dma_unmap_single(&dev->dev, bd->skb_pa, rskb->len, DMA_FROM_DEVICE);
 
 		/* Test for errors in received frame */
 		if (status & BCOM_FEC_RX_BD_ERRORS) {
@@ -467,7 +467,7 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id)
 			bcom_prepare_next_buffer(priv->rx_dmatsk);
 
 		bd->status = FEC_RX_BUFFER_SIZE;
-		bd->skb_pa = dma_map_single(&dev->dev, rskb->data,
+		bd->skb_pa = dma_map_single(&dev->dev, skb->data,
 				FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE);
 
 		bcom_submit_next_buffer(priv->rx_dmatsk, skb);

^ permalink raw reply related

* [PATCH] gianfar driver: eliminate compiler warnings and unnecessary macros
From: Grant Likely @ 2007-12-02  5:12 UTC (permalink / raw)
  To: linuxppc-dev, netdev, galak, jgarzik, afleming

From: Grant Likely <grant.likely@secretlab.ca>

This patch eliminates the warning of unused return values when the driver
registers it sysfs files.  Now the driver will print an error if it is
unable to register the sysfs files.

It also eliminates the macros used to wrap the DEVICE_ATTR macro and the
device_create_file function call.  The macros don't reduce the number of
lines of source code in the file and the name munging makes is so that
cscope and friends don't see the references to the functions.  It's better
to just call the kernel API directly.

While we're at it, the DEVICE_ATTR instances have been moved down to
be grouped with the functions they depend on.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 drivers/net/gianfar_sysfs.c |   50 ++++++++++++++++++++++---------------------
 1 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/drivers/net/gianfar_sysfs.c b/drivers/net/gianfar_sysfs.c
index aec9ab1..230878b 100644
--- a/drivers/net/gianfar_sysfs.c
+++ b/drivers/net/gianfar_sysfs.c
@@ -37,24 +37,6 @@
 
 #include "gianfar.h"
 
-#define GFAR_ATTR(_name) \
-static ssize_t gfar_show_##_name(struct device *dev, \
-	 struct device_attribute *attr, char *buf); \
-static ssize_t gfar_set_##_name(struct device *dev, \
-		struct device_attribute *attr, \
-		const char *buf, size_t count); \
-static DEVICE_ATTR(_name, 0644, gfar_show_##_name, gfar_set_##_name)
-
-#define GFAR_CREATE_FILE(_dev, _name) \
-	device_create_file(&_dev->dev, &dev_attr_##_name)
-
-GFAR_ATTR(bd_stash);
-GFAR_ATTR(rx_stash_size);
-GFAR_ATTR(rx_stash_index);
-GFAR_ATTR(fifo_threshold);
-GFAR_ATTR(fifo_starve);
-GFAR_ATTR(fifo_starve_off);
-
 static ssize_t gfar_show_bd_stash(struct device *dev,
 				  struct device_attribute *attr, char *buf)
 {
@@ -100,6 +82,8 @@ static ssize_t gfar_set_bd_stash(struct device *dev,
 	return count;
 }
 
+DEVICE_ATTR(bd_stash, 0644, gfar_show_bd_stash, gfar_set_bd_stash);
+
 static ssize_t gfar_show_rx_stash_size(struct device *dev,
 				       struct device_attribute *attr, char *buf)
 {
@@ -146,6 +130,9 @@ static ssize_t gfar_set_rx_stash_size(struct device *dev,
 	return count;
 }
 
+DEVICE_ATTR(rx_stash_size, 0644, gfar_show_rx_stash_size,
+	    gfar_set_rx_stash_size);
+
 /* Stashing will only be enabled when rx_stash_size != 0 */
 static ssize_t gfar_show_rx_stash_index(struct device *dev,
 					struct device_attribute *attr,
@@ -184,6 +171,9 @@ static ssize_t gfar_set_rx_stash_index(struct device *dev,
 	return count;
 }
 
+DEVICE_ATTR(rx_stash_index, 0644, gfar_show_rx_stash_index,
+	    gfar_set_rx_stash_index);
+
 static ssize_t gfar_show_fifo_threshold(struct device *dev,
 					struct device_attribute *attr,
 					char *buf)
@@ -219,6 +209,9 @@ static ssize_t gfar_set_fifo_threshold(struct device *dev,
 	return count;
 }
 
+DEVICE_ATTR(fifo_threshold, 0644, gfar_show_fifo_threshold,
+	    gfar_set_fifo_threshold);
+
 static ssize_t gfar_show_fifo_starve(struct device *dev,
 				     struct device_attribute *attr, char *buf)
 {
@@ -253,6 +246,8 @@ static ssize_t gfar_set_fifo_starve(struct device *dev,
 	return count;
 }
 
+DEVICE_ATTR(fifo_starve, 0644, gfar_show_fifo_starve, gfar_set_fifo_starve);
+
 static ssize_t gfar_show_fifo_starve_off(struct device *dev,
 					 struct device_attribute *attr,
 					 char *buf)
@@ -288,9 +283,13 @@ static ssize_t gfar_set_fifo_starve_off(struct device *dev,
 	return count;
 }
 
+DEVICE_ATTR(fifo_starve_off, 0644, gfar_show_fifo_starve_off,
+	    gfar_set_fifo_starve_off);
+
 void gfar_init_sysfs(struct net_device *dev)
 {
 	struct gfar_private *priv = netdev_priv(dev);
+	int rc;
 
 	/* Initialize the default values */
 	priv->rx_stash_size = DEFAULT_STASH_LENGTH;
@@ -301,11 +300,12 @@ void gfar_init_sysfs(struct net_device *dev)
 	priv->bd_stash_en = DEFAULT_BD_STASH;
 
 	/* Create our sysfs files */
-	GFAR_CREATE_FILE(dev, bd_stash);
-	GFAR_CREATE_FILE(dev, rx_stash_size);
-	GFAR_CREATE_FILE(dev, rx_stash_index);
-	GFAR_CREATE_FILE(dev, fifo_threshold);
-	GFAR_CREATE_FILE(dev, fifo_starve);
-	GFAR_CREATE_FILE(dev, fifo_starve_off);
-
+	rc = device_create_file(&dev->dev, &dev_attr_bd_stash);
+	rc |= device_create_file(&dev->dev, &dev_attr_rx_stash_size);
+	rc |= device_create_file(&dev->dev, &dev_attr_rx_stash_index);
+	rc |= device_create_file(&dev->dev, &dev_attr_fifo_threshold);
+	rc |= device_create_file(&dev->dev, &dev_attr_fifo_starve);
+	rc |= device_create_file(&dev->dev, &dev_attr_fifo_starve_off);
+	if (rc)
+		dev_err(&dev->dev, "Error creating gianfar sysfs files.\n");
 }

^ permalink raw reply related

* [PATCH] gianfar: fix compile warning
From: Grant Likely @ 2007-12-02  5:10 UTC (permalink / raw)
  To: linuxppc-dev, netdev, galak, jgarzik, afleming

From: Grant Likely <grant.likely@secretlab.ca>

Eliminate an uninitialized variable warning.  The code is correct, but
a pointer to the automatic variable 'addr' is passed to dma_alloc_coherent.
Since addr has never been initialized, and the compiler doesn't know
what dma_alloc_coherent will do with it, it complains.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

Jeff, this one should go in for 2.6.24

Cheers,
g.

 drivers/net/gianfar.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 38268d7..0431e9e 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -696,7 +696,7 @@ int startup_gfar(struct net_device *dev)
 {
 	struct txbd8 *txbdp;
 	struct rxbd8 *rxbdp;
-	dma_addr_t addr;
+	dma_addr_t addr = 0;
 	unsigned long vaddr;
 	int i;
 	struct gfar_private *priv = netdev_priv(dev);

^ permalink raw reply related

* Re: Linux 2.4 on ML310 with PowerPC405
From: Grant Likely @ 2007-12-02  4:30 UTC (permalink / raw)
  To: narendra sisodiya; +Cc: linuxppc-embedded
In-Reply-To: <e3fb97f30712010459y1e15f593i58381ba81487960a@mail.gmail.com>

On 12/1/07, narendra sisodiya <narendra.sisodiya@gmail.com> wrote:
> Hi all,
> I am trying to port Linux on ML310 virtex 2 pro,,
> I am unable to compile my properly,,,
> here i documented my procedure,,,
> http://placements.techfandu.org/index.php?title=Linux_kernel_on_ML310
>
> Please check out ,, where i am doing mistake

I'm sorry, but I don't understand where you are having your problems.
Specifically, what error are you getting when your kernel fails to
compile?

As for the kernel version, I do not recommend using linux 2.4 any
more.  You should consider using a 2.6 kernel instead.  I've got some
documentation on the 2.6 kernel for virtex devices here:

http://wiki.secretlab.ca/index.php/Linux_on_Xilinx_Virtex

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

^ permalink raw reply

* Re: [PATCH 2/3] [libata] pata_of_platform: OF-Platform PATA device driver
From: Olof Johansson @ 2007-12-02  3:59 UTC (permalink / raw)
  To: Anton Vorontsov; +Cc: linuxppc-dev, linux-ide
In-Reply-To: <20071127153908.GB14183@localhost.localdomain>

On Tue, Nov 27, 2007 at 06:39:08PM +0300, Anton Vorontsov wrote:

> +static struct of_device_id pata_of_platform_match[] = {
> +	{ .compatible = "pata-platform", },
> +};

On top of previous comment about the compatible string being
inappropriate:

You should add a MODULE_DEVICE_TABLE() entry for this. Dave Woodhouse
pointed out it's needed for autoloading modules (i.e. by the fedora
installer, etc).


-Olof

^ permalink raw reply

* Re: [PATCH 0/3] OF-platform PATA driver
From: Olof Johansson @ 2007-12-02  3:57 UTC (permalink / raw)
  To: Anton Vorontsov
  Cc: linux-ide, Paul Mundt, Arnd Bergmann, Jeff Garzik, linuxppc-dev
In-Reply-To: <20071201235810.GA2635@zarina>

On Sun, Dec 02, 2007 at 02:58:10AM +0300, Anton Vorontsov wrote:
> On Sat, Dec 01, 2007 at 05:54:49PM -0500, Jeff Garzik wrote:
> while (1) {
> 	send_patches();
> 
> 	if (ack_collected(PaulM) && ack_collected(PowerPC_people))
> 		break;
> 
> 	sleep(wait_for_comments_timeout); <-- currently here.

I still haven't seen you address the compatible comments (that
pata-platform is suboptimal). Or did I miss some respin of the patches?


-Olof

^ permalink raw reply

* Re: serial console autodetection not working on powermac
From: Benjamin Herrenschmidt @ 2007-12-02  1:11 UTC (permalink / raw)
  To: Olaf Hering; +Cc: linuxppc-dev
In-Reply-To: <20071201144021.GA13898@aepfle.de>


On Sat, 2007-12-01 at 15:40 +0100, Olaf Hering wrote:
> How is the serial console autodetection supposed to work with current
> kernels? arch/powerpc/kernel/legacy_serial.c is not compiled unless
> CONFIG_PPC_UDBG_16550 is selected.
> Even if I force this config option, legacy_serial_console remains -1 and
> the ch-a/ch-b check in check_legacy_serial_console() does not trigger.
> Can the ch-a/ch-b check in check_legacy_serial_console() trigger anyway?
> 
> The autodetection used to work in earlier kernels.
> 
> A compiletime check for CONFIG_SERIAL_PMACZILOG_TTYS is also required,
> to switch between ttyS and ttyPZ. Currently ttyS is hardcoded.

It might well have bitrotted. It should be taken out of that file
anyway. I'll have a look next week. Remind me if I forget :-)

Ben.

^ permalink raw reply

* Re: [PATCH 0/3] OF-platform PATA driver
From: Anton Vorontsov @ 2007-12-01 23:58 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Paul Mundt, linux-ide, Arnd Bergmann, linuxppc-dev
In-Reply-To: <4751E639.8090308@garzik.org>

On Sat, Dec 01, 2007 at 05:54:49PM -0500, Jeff Garzik wrote:
> Anton Vorontsov wrote:
> > Hi all,
> > 
> > Here is the second spin of the OF-platform PATA driver and
> > related patches.
> > 
> > Changes since RFC:
> > - nuked drivers/ata/pata_platform.h;
> > - powerpc bits: proper localbus node added.
> > 
> > 
> > Thanks for the previous review! This time I'm collecting acks,
> > don't be shy to give 'em generously. ;-)
> if (ack_collected(PaulM))
> 	push(ACK)
> else {
> 	/* do nothing */
> }

Yep, this is obvious.

Here is the algo I'm following:

while (1) {
	send_patches();

	if (ack_collected(PaulM) && ack_collected(PowerPC_people))
		break;

	sleep(wait_for_comments_timeout); <-- currently here.
}

-- 
Anton Vorontsov
email: cbou@mail.ru
backup email: ya-cbou@yandex.ru
irc://irc.freenode.net/bd2

^ permalink raw reply

* Re: [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHY layer functionality
From: Stephen Rothwell @ 2007-12-01 23:27 UTC (permalink / raw)
  To: cbou; +Cc: linuxppc-dev, netdev, Jeff Garzik, linux-kernel
In-Reply-To: <20071201213403.GA2350@zarina>

[-- Attachment #1: Type: text/plain, Size: 893 bytes --]

Just a little reminder ...

On Sun, 2 Dec 2007 00:34:03 +0300 Anton Vorontsov <cbou@mail.ru> wrote:
>
> static int __init of_add_fixed_phys(void)
> {
> 	struct device_node *np;
> 	const u32 *prop;
> 	struct fixed_phy_status status = {};
> 
> 	while ((np = of_find_node_by_name(NULL, "ethernet"))) {

	for_each_node_by_name(np, "ethernet") {
(this probably does what you want instead of finding just the first
ethernet over and over again. :-))

> 		data  = of_get_property(np, "fixed-link", NULL);
> 		if (!data)
> 			continue;
> 
> 		status.link = 1;
> 		status.duplex = data[1];
> 		status.speed  = data[2];
> 
> 		ret = fixed_phy_add(PHY_POLL, data[0], &status);
> 		if (ret)
> 			return ret;
		if (ret) {
			of_put_node(np);
			retun ret;
		}
> 	}

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH 0/3] OF-platform PATA driver
From: Jeff Garzik @ 2007-12-01 22:54 UTC (permalink / raw)
  To: avorontsov; +Cc: Arnd Bergmann, linux-ide, linuxppc-dev, Paul Mundt
In-Reply-To: <20071127153708.GA12490@localhost.localdomain>

Anton Vorontsov wrote:
> Hi all,
> 
> Here is the second spin of the OF-platform PATA driver and
> related patches.
> 
> Changes since RFC:
> - nuked drivers/ata/pata_platform.h;
> - powerpc bits: proper localbus node added.
> 
> 
> Thanks for the previous review! This time I'm collecting acks,
> don't be shy to give 'em generously. ;-)

if (ack_collected(PaulM))
	push(ACK)
else {
	/* do nothing */
}

^ permalink raw reply

* Re: ppcboot and powerpc branch question
From: Wolfgang Denk @ 2007-12-01 22:54 UTC (permalink / raw)
  To: Pagnotta, Chris; +Cc: linuxppc-embedded
In-Reply-To: <821B2170E9E7F04FA38DF7EC21DE48710BA65802@VCAEXCH01.hq.corp.viasat.com>

Dear Chris,

in message <821B2170E9E7F04FA38DF7EC21DE48710BA65802@VCAEXCH01.hq.corp.viasat.com> you wrote:
> 
> I am currently using your ELDK 4.1 Uclibc and have written various
> scripts that allow it to be used with buildroot makefiles. Are you going
> to releasing a newer version anytime soon?

Yes, we just showed ELDK 4.2 at the SPS/IPC/Drives trade show in
Nuremberg. OK, it's still beta since we wait for the final release of
Xenomai 2.4, but PPC and PPC64 beta is available for testers.

> -----Original Message-----
> From: linuxppc-embedded-bounces+chris.pagnotta=3Dviasat.com@ozlabs.org
> [mailto:linuxppc-embedded-bounces+chris.pagnotta=3Dviasat.com@ozlabs.org]=


Two remarks:
- Please don't top post / full quote. See
  http://www.netmeister.org/news/learn2quote.html
- Please post ELDK related requests on the ELDK mailing list, see
  http://lists.denx.de/mailman/listinfo/eldk

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
A good marriage would be between a blind wife and deaf husband.
                                               -- Michel de Montaigne

^ permalink raw reply

* Re: [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHY layer functionality
From: Vitaly Bordug @ 2007-12-01 22:22 UTC (permalink / raw)
  To: cbou; +Cc: linuxppc-dev, netdev, Jeff Garzik, linux-kernel
In-Reply-To: <20071201213403.GA2350@zarina>

On Sun, 2 Dec 2007 00:34:03 +0300
Anton Vorontsov wrote:

> > If i understand your code correctly, you seem to rely on the fact 
> > that fixed_phy_add() is called before the fixed MDIO bus is scanned
> > for devices.  
> 
> Yes, indeed. The other name of "fixed phys" are "platform phys"
> or "platform MDIO bus" on which virtual PHYs are placed.
> 
> That is, these phys supposed to be created by the platform setup
> code (arch/). The rationale here is: we do hardware emulation, thus
> to make drivers actually see that "hardware", we have to create it
> early.

well that was the intention but... The point is - as device is emulated, (nearly) everything is doable,
and the only tradeoff to consider, is how far will we go with that emulation. IOW, PHYlib could be tricked
to "do the right thing", and I thought about adding module flexibility...

But thinking more about it, it seems that BSP-code-phy-creation just sucks less and is clear enough yet flexible.
-- 
Sincerely, Vitaly

^ permalink raw reply

* Re: [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHY layer functionality
From: Vitaly Bordug @ 2007-12-01 22:16 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linuxppc-dev, linux-kernel, netdev
In-Reply-To: <4751D958.6060500@garzik.org>

On Sat, 01 Dec 2007 16:59:52 -0500
Jeff Garzik wrote:

> Vitaly Bordug wrote:
> > With that patch fixed.c now fully emulates MDIO bus, thus no need
> > to duplicate PHY layer functionality. That, in turn, drastically
> > simplifies the code, and drops down line count.
> > 
> > As an additional bonus, now there is no need to register MDIO bus
> > for each PHY, all emulated PHYs placed on the platform fixed MDIO
> > bus. There is also no more need to pre-allocate PHYs via .config
> > option, this is all now handled dynamically.
> > 
> > p.s. Don't even try to understand patch content! Better: apply patch
> > and look into resulting drivers/net/phy/fixed.c.
> > 
> > Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> > Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>
> 
> what's the context of this patchset?  2.6.25?
> 
Fine with it.

> it's late for 2.6.24-rc, IMO.
> 
> Do I have the latest version (sent Nov 26 @ 9:29am)?
yes, that's it.

-- 
Sincerely, Vitaly

^ permalink raw reply

* Re: [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHY layer functionality
From: Jeff Garzik @ 2007-12-01 21:59 UTC (permalink / raw)
  To: Vitaly Bordug; +Cc: linuxppc-dev, linux-kernel, netdev
In-Reply-To: <20071126142906.19642.45540.stgit@localhost.localdomain>

Vitaly Bordug wrote:
> With that patch fixed.c now fully emulates MDIO bus, thus no need
> to duplicate PHY layer functionality. That, in turn, drastically
> simplifies the code, and drops down line count.
> 
> As an additional bonus, now there is no need to register MDIO bus
> for each PHY, all emulated PHYs placed on the platform fixed MDIO bus.
> There is also no more need to pre-allocate PHYs via .config option,
> this is all now handled dynamically.
> 
> p.s. Don't even try to understand patch content! Better: apply patch
> and look into resulting drivers/net/phy/fixed.c.
> 
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>

what's the context of this patchset?  2.6.25?

it's late for 2.6.24-rc, IMO.

Do I have the latest version (sent Nov 26 @ 9:29am)?

	Jeff

^ permalink raw reply

* Re: [PATCH] [1/12] pasemi_mac: RX/TX ring management cleanup
From: Jeff Garzik @ 2007-12-01 21:54 UTC (permalink / raw)
  To: Olof Johansson; +Cc: linuxppc-dev, netdev
In-Reply-To: <20071129025428.GB17215@lixom.net>

Olof Johansson wrote:
> pasemi_mac: RX/TX ring management cleanup
> 
> Prepare a bit for supporting multiple TX queues by cleaning up some
> of the ring management and shuffle things around a bit.
> 
> Signed-off-by: Olof Johansson <olof@lixom.net>

applied 1-12

^ permalink raw reply

* Re: [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHY layer functionality
From: Anton Vorontsov @ 2007-12-01 21:34 UTC (permalink / raw)
  To: Jochen Friedrich; +Cc: netdev, linux-kernel, Jeff Garzik, linuxppc-dev
In-Reply-To: <47516646.9000803@scram.de>

On Sat, Dec 01, 2007 at 02:48:54PM +0100, Jochen Friedrich wrote:
> Hi Vitaly,
> 
> > With that patch fixed.c now fully emulates MDIO bus, thus no need
> > to duplicate PHY layer functionality. That, in turn, drastically
> > simplifies the code, and drops down line count.
> >
> > As an additional bonus, now there is no need to register MDIO bus
> > for each PHY, all emulated PHYs placed on the platform fixed MDIO bus.
> > There is also no more need to pre-allocate PHYs via .config option,
> > this is all now handled dynamically.
> >
> > p.s. Don't even try to understand patch content! Better: apply patch
> > and look into resulting drivers/net/phy/fixed.c.
> >   
> If i understand your code correctly, you seem to rely on the fact 
> that fixed_phy_add() is called before the fixed MDIO bus is scanned for 
> devices.

Yes, indeed. The other name of "fixed phys" are "platform phys"
or "platform MDIO bus" on which virtual PHYs are placed.

That is, these phys supposed to be created by the platform setup
code (arch/). The rationale here is: we do hardware emulation, thus
to make drivers actually see that "hardware", we have to create it
early.

> I tried to add fixed-phy support to fs_enet, but the fixed phy is not 
> found this way.
> 
> --- a/drivers/net/fs_enet/fs_enet-main.c
> +++ b/drivers/net/fs_enet/fs_enet-main.c
> @@ -36,6 +36,7 @@
>  #include <linux/fs.h>
>  #include <linux/platform_device.h>
>  #include <linux/phy.h>
> +#include <linux/phy_fixed.h>
>  
>  #include <linux/vmalloc.h>
>  #include <asm/pgtable.h>
> @@ -1174,8 +1175,24 @@ static int __devinit find_phy(struct device_node *np,
>         struct device_node *phynode, *mdionode;
>         struct resource res;
>         int ret = 0, len;
> +       const u32 *data;
> +       struct fixed_phy_status status = {};
> +
> +       data  = of_get_property(np, "fixed-link", NULL);
> +       if (data) {
> +               status.link = 1;
> +               status.duplex = data[1];
> +               status.speed  = data[2];
> +
> +               ret = fixed_phy_add(PHY_POLL, data[0], &status);
> +               if (ret)
> +                       return ret;
> +
> +               snprintf(fpi->bus_id, 16, PHY_ID_FMT, 0, *data);
> +               return 0;
> +       }
>  
> -       const u32 *data = of_get_property(np, "phy-handle", &len);
> +       data = of_get_property(np, "phy-handle", &len);
>         if (!data || len != 4)
>                 return -EINVAL;

^^ the correct solution is to implement arch_initcall function
which will create fixed PHYs, and then leave only
snprintf(fpi->bus_id, 16, PHY_ID_FMT, 0, *data); part in the
fs_enet's find_phy().

Try add something like this to the fsl_soc.c (compile untested):

- - - -
static int __init of_add_fixed_phys(void)
{
	struct device_node *np;
	const u32 *prop;
	struct fixed_phy_status status = {};

	while ((np = of_find_node_by_name(NULL, "ethernet"))) {
		data  = of_get_property(np, "fixed-link", NULL);
		if (!data)
			continue;

		status.link = 1;
		status.duplex = data[1];
		status.speed  = data[2];

		ret = fixed_phy_add(PHY_POLL, data[0], &status);
		if (ret)
			return ret;
	}

	return 0;
}
arch_initcall(of_add_fixed_phys);
- - - -

And remove fixed_phy_add() from the fs_enet. This should work
nicely and also should be ideologically correct. ;-)

> How is this supposed to work for modules or for the
> PPC_CPM_NEW_BINDING mode where the device tree is no longer scanned
> during fs_soc initialization but during device initialization?

We should mark fixed.c as bool. Fake/virtual/fixed/platform PHYs
creation is architecture code anyway, can't be =m.

-- 
Anton Vorontsov
email: cbou@mail.ru
backup email: ya-cbou@yandex.ru
irc://irc.freenode.net/bd2

^ permalink raw reply

* Re: [PATCH] Stop phy code from returning success to unknown ioctls.
From: Jeff Garzik @ 2007-12-01 21:36 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linuxppc-dev, Domen Puncer, netdev
In-Reply-To: <1196279794.30806.54.camel@pmac.infradead.org>

David Woodhouse wrote:
> This kind of sucks, and prevents the Fedora installer from using the
> device for network installs...
> 
> [root@efika phy]# iwconfig eth0                                                                                                                
> Warning: Driver for device eth0 has been compiled with an ancient version                                                                      
> of Wireless Extension, while this program support version 11 and later.                                                                        
> Some things may be broken...                                                                                                                   
>                                                                                                                                                
> eth0        ESSID:off/any  Nickname:""                                                                                                         
>           NWID:0  Channel:0  Access Point: 00:00:BF:81:14:E0                                                                                   
>           Bit Rate:-1.08206e+06 kb/s   Sensitivity=0/0                                                                                         
>           RTS thr:off   Fragment thr:off                                                                                                       
>           Encryption key:<too big>                                                                                                             
>           Power Management:off                                                                                                                 
>                                                                                                                                                
> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
> 
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index 9bc1177..7c9e6e3 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -406,6 +406,9 @@ int phy_mii_ioctl(struct phy_device *phydev,
>  				&& phydev->drv->config_init)
>  			phydev->drv->config_init(phydev);
>  		break;
> +
> +	default:
> +		return -ENOTTY;
>  	}
>  

applied

^ permalink raw reply

* Re: [PATCH] SET_NETDEV_DEV() in fec_mpc52xx.c
From: Jeff Garzik @ 2007-12-01 21:35 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linuxppc-dev, Domen Puncer, netdev
In-Reply-To: <1196273071.30806.46.camel@pmac.infradead.org>

David Woodhouse wrote:
> This helps to allow the Fedora installer to use the built-in Ethernet on
> the Efika for a network install.
> 
> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
> 
> --- a/drivers/net/fec_mpc52xx.c
> +++ b/drivers/net/fec_mpc52xx.c
> @@ -971,6 +971,8 @@ mpc52xx_fec_probe(struct of_device *op, const struct of_device_id *match)
>  
>  	mpc52xx_fec_reset_stats(ndev);
>  
> +	SET_NETDEV_DEV(ndev, &op->dev);
> +
>  	/* Register the new network device */
>  	rv = register_netdev(ndev);

applied

^ permalink raw reply

* Re: [PATCH 1/3][RESEND] phylib: add PHY interface modes for internal delay for tx and rx only
From: Jeff Garzik @ 2007-12-01 21:33 UTC (permalink / raw)
  To: Kim Phillips; +Cc: netdev, Li Yang, linuxppc-dev
In-Reply-To: <20071126161748.9671b828.kim.phillips@freescale.com>

Kim Phillips wrote:
> Allow phylib specification of cases where hardware needs to configure
> PHYs for Internal Delay only on either RX or TX (not both).
> 
> Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
> Tested-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> Acked-by: Li Yang <leoli@freescale.com>
> ---
>  include/linux/phy.h |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/phy.h b/include/linux/phy.h
> index f0742b6..e10763d 100644
> --- a/include/linux/phy.h
> +++ b/include/linux/phy.h
> @@ -58,6 +58,8 @@ typedef enum {
>  	PHY_INTERFACE_MODE_RMII,
>  	PHY_INTERFACE_MODE_RGMII,
>  	PHY_INTERFACE_MODE_RGMII_ID,
> +	PHY_INTERFACE_MODE_RGMII_RXID,
> +	PHY_INTERFACE_MODE_RGMII_TXID,
>  	PHY_INTERFACE_MODE_RTBI
>  } phy_interface_t;

applied 1-3

^ permalink raw reply

* Re: [RFC] [PATCH] pasemi: NMI support with MPIC
From: Olof Johansson @ 2007-12-01 21:21 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <1196541525.13230.144.camel@pasglop>

On Sun, Dec 02, 2007 at 07:38:45AM +1100, Benjamin Herrenschmidt wrote:
> 
> On Sat, 2007-12-01 at 12:28 -0600, Olof Johansson wrote:
> > Some PWRficient-based boards have a NMI button that's wired up to a GPIO
> > as interrupt source. By configuring the openpic accordingly, these get
> > delivered as a machine check with high priority, instead of as an external
> > interrupt.
> > 
> > The device tree contains a property "nmi-source" in the openpic node
> > for these systems, and it's the (hwirq) source for the input.
> > 
> > Also, for these interrupts, the IACK is read from another register than
> > the regular (MCACK), but they are EOI'd as usual. So implement said
> > function for the mpic driver.
> > 
> > Finally, move a couple of external function defines to include/ instead
> > of local under sysdev. Being able to mask/unmask and eoi directly saves
> > us from setting up a dummy irq handler that will never be called.
> 
> It's interesting how creative implementors are with MPICs :-)

:-)

> Looks allright to me but I haven't tested for regressions.

I've build tested all platforms, and I don't expect any runtime changes
for others since they're not executing the new paths.


Thanks,

-Olof

^ permalink raw reply

* Re: [RFC] [PATCH] pasemi: NMI support with MPIC
From: Benjamin Herrenschmidt @ 2007-12-01 20:38 UTC (permalink / raw)
  To: Olof Johansson; +Cc: linuxppc-dev
In-Reply-To: <20071201182841.GA25103@lixom.net>


On Sat, 2007-12-01 at 12:28 -0600, Olof Johansson wrote:
> Some PWRficient-based boards have a NMI button that's wired up to a GPIO
> as interrupt source. By configuring the openpic accordingly, these get
> delivered as a machine check with high priority, instead of as an external
> interrupt.
> 
> The device tree contains a property "nmi-source" in the openpic node
> for these systems, and it's the (hwirq) source for the input.
> 
> Also, for these interrupts, the IACK is read from another register than
> the regular (MCACK), but they are EOI'd as usual. So implement said
> function for the mpic driver.
> 
> Finally, move a couple of external function defines to include/ instead
> of local under sysdev. Being able to mask/unmask and eoi directly saves
> us from setting up a dummy irq handler that will never be called.

It's interesting how creative implementors are with MPICs :-)

Looks allright to me but I haven't tested for regressions.

Ben.

^ permalink raw reply

* Re: [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHY layer functionality
From: Vitaly Bordug @ 2007-12-01 19:07 UTC (permalink / raw)
  To: Jochen Friedrich; +Cc: linuxppc-dev, linux-kernel, Jeff Garzik, netdev
In-Reply-To: <47516646.9000803@scram.de>

On Sat, 01 Dec 2007 14:48:54 +0100
Jochen Friedrich wrote:

> Hi Vitaly,
> 
> > With that patch fixed.c now fully emulates MDIO bus, thus no need
> > to duplicate PHY layer functionality. That, in turn, drastically
> > simplifies the code, and drops down line count.
> >
> > As an additional bonus, now there is no need to register MDIO bus
> > for each PHY, all emulated PHYs placed on the platform fixed MDIO
> > bus. There is also no more need to pre-allocate PHYs via .config
> > option, this is all now handled dynamically.
> >
> > p.s. Don't even try to understand patch content! Better: apply patch
> > and look into resulting drivers/net/phy/fixed.c.
> >   
> If i understand your code correctly, you seem to rely on the fact 
> that fixed_phy_add() is called before the fixed MDIO bus is scanned
> for devices. How is this supposed to work for modules or for the 
> PPC_CPM_NEW_BINDING mode where the device tree is no longer scanned 
> during fs_soc initialization but during device initialization?
>
Well, this is kind of known issue - to work it around for now, place PHY lib after fs_enet in
Makefile. This way it works for me for _NEW_BINDING and mpc866ads.

> I tried to add fixed-phy support to fs_enet, but the fixed phy is not 
> found this way.
> 
The point is I have the code and it works now(for fs_enet etc.), but I need to find the way for the fixed phy pinning to work in either order with phylib. If you have ideas, please go ahead :)


> --- a/drivers/net/fs_enet/fs_enet-main.c
> +++ b/drivers/net/fs_enet/fs_enet-main.c
> @@ -36,6 +36,7 @@
>  #include <linux/fs.h>
>  #include <linux/platform_device.h>
>  #include <linux/phy.h>
> +#include <linux/phy_fixed.h>
>  
>  #include <linux/vmalloc.h>
>  #include <asm/pgtable.h>
> @@ -1174,8 +1175,24 @@ static int __devinit find_phy(struct
> device_node *np, struct device_node *phynode, *mdionode;
>         struct resource res;
>         int ret = 0, len;
> +       const u32 *data;
> +       struct fixed_phy_status status = {};
> +
> +       data  = of_get_property(np, "fixed-link", NULL);
> +       if (data) {
> +               status.link = 1;
> +               status.duplex = data[1];
> +               status.speed  = data[2];
> +
> +               ret = fixed_phy_add(PHY_POLL, data[0], &status);
> +               if (ret)
> +                       return ret;
> +
> +               snprintf(fpi->bus_id, 16, PHY_ID_FMT, 0, *data);
> +               return 0;
> +       }
>  
> -       const u32 *data = of_get_property(np, "phy-handle", &len);
> +       data = of_get_property(np, "phy-handle", &len);
>         if (!data || len != 4)
>                 return -EINVAL;
> 
> Thanks,
> Jochen


-- 
Sincerely, Vitaly

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox