Merge remote branch 'origin' into secretlab/next-devicetree
authorGrant Likely <grant.likely@secretlab.ca>
Sat, 22 May 2010 06:36:56 +0000 (00:36 -0600)
committerGrant Likely <grant.likely@secretlab.ca>
Sat, 22 May 2010 06:36:56 +0000 (00:36 -0600)
Merging in current state of Linus' tree to deal with merge conflicts and
build failures in vio.c after merge.

Conflicts:
drivers/i2c/busses/i2c-cpm.c
drivers/i2c/busses/i2c-mpc.c
drivers/net/gianfar.c

Also fixed up one line in arch/powerpc/kernel/vio.c to use the
correct node pointer.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
52 files changed:
1  2 
arch/powerpc/kernel/vio.c
arch/sparc/kernel/time_32.c
drivers/ata/pata_macio.c
drivers/ata/pata_mpc52xx.c
drivers/crypto/talitos.c
drivers/dma/fsldma.c
drivers/dma/ppc4xx/adma.c
drivers/gpio/pca953x.c
drivers/i2c/busses/i2c-cpm.c
drivers/i2c/busses/i2c-ibm_iic.c
drivers/i2c/busses/i2c-mpc.c
drivers/i2c/i2c-core.c
drivers/macintosh/smu.c
drivers/mtd/maps/physmap_of.c
drivers/mtd/nand/fsl_elbc_nand.c
drivers/mtd/nand/fsl_upm.c
drivers/mtd/nand/pasemi_nand.c
drivers/mtd/nand/socrates_nand.c
drivers/net/can/mscan/mpc5xxx_can.c
drivers/net/can/sja1000/sja1000_of_platform.c
drivers/net/ehea/ehea_main.c
drivers/net/fec_mpc52xx.c
drivers/net/fs_enet/fs_enet-main.c
drivers/net/fs_enet/mac-fcc.c
drivers/net/fs_enet/mac-fec.c
drivers/net/fs_enet/mac-scc.c
drivers/net/fsl_pq_mdio.c
drivers/net/gianfar.c
drivers/net/greth.c
drivers/net/ibm_newemac/core.c
drivers/net/ll_temac_main.c
drivers/net/myri_sbus.c
drivers/net/niu.c
drivers/net/sunbmac.c
drivers/net/sunhme.c
drivers/net/sunlance.c
drivers/net/sunqe.c
drivers/net/ucc_geth.c
drivers/net/xilinx_emaclite.c
drivers/of/of_mdio.c
drivers/sbus/char/flash.c
drivers/scsi/ibmvscsi/ibmvfc.c
drivers/scsi/ibmvscsi/ibmvscsi.c
drivers/serial/mpc52xx_uart.c
drivers/serial/pmac_zilog.c
drivers/serial/sunzilog.c
drivers/serial/uartlite.c
drivers/spi/spi_mpc8xxx.c
drivers/usb/host/fhci-hcd.c
drivers/usb/host/isp1760-if.c
include/linux/device.h
include/linux/i2c.h

index 4cdd0f6df8bfcb7e6ff7319ffd6487ee10c0b335,9ce7b62dc3a4f07e76daa301b2df12f52f524a05..00b9436f76525c501ecd8bcfab1abef5911a42d4
@@@ -645,8 -645,10 +645,10 @@@ void vio_cmo_set_dev_desired(struct vio
                        found = 1;
                        break;
                }
-       if (!found)
+       if (!found) {
+               spin_unlock_irqrestore(&vio_cmo.lock, flags);
                return;
+       }
  
        /* Increase/decrease in desired device entitlement */
        if (desired >= viodev->cmo.desired) {
@@@ -705,7 -707,7 +707,7 @@@ static int vio_cmo_bus_probe(struct vio
         * Check to see that device has a DMA window and configure
         * entitlement for the device.
         */
 -      if (of_get_property(viodev->dev.archdata.of_node,
 +      if (of_get_property(viodev->dev.of_node,
                            "ibm,my-dma-window", NULL)) {
                /* Check that the driver is CMO enabled and get desired DMA */
                if (!viodrv->get_desired_dma) {
@@@ -958,9 -960,12 +960,12 @@@ viodev_cmo_rd_attr(allocated)
  
  static ssize_t name_show(struct device *, struct device_attribute *, char *);
  static ssize_t devspec_show(struct device *, struct device_attribute *, char *);
+ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
+                            char *buf);
  static struct device_attribute vio_cmo_dev_attrs[] = {
        __ATTR_RO(name),
        __ATTR_RO(devspec),
+       __ATTR_RO(modalias),
        __ATTR(cmo_desired,       S_IWUSR|S_IRUSR|S_IWGRP|S_IRGRP|S_IROTH,
               viodev_cmo_desired_show, viodev_cmo_desired_set),
        __ATTR(cmo_entitled,      S_IRUGO, viodev_cmo_entitled_show,      NULL),
@@@ -1049,7 -1054,7 +1054,7 @@@ static struct iommu_table *vio_build_io
        if (firmware_has_feature(FW_FEATURE_ISERIES))
                return vio_build_iommu_table_iseries(dev);
  
 -      dma_window = of_get_property(dev->dev.archdata.of_node,
 +      dma_window = of_get_property(dev->dev.of_node,
                                  "ibm,my-dma-window", NULL);
        if (!dma_window)
                return NULL;
        if (tbl == NULL)
                return NULL;
  
 -      of_parse_dma_window(dev->dev.archdata.of_node, dma_window,
 +      of_parse_dma_window(dev->dev.of_node, dma_window,
                            &tbl->it_index, &offset, &size);
  
        /* TCE table size - measured in tce entries */
@@@ -1086,7 -1091,7 +1091,7 @@@ static const struct vio_device_id *vio_
  {
        while (ids->type[0] != '\0') {
                if ((strncmp(dev->type, ids->type, strlen(ids->type)) == 0) &&
 -                  of_device_is_compatible(dev->dev.archdata.of_node,
 +                  of_device_is_compatible(dev->dev.of_node,
                                         ids->compat))
                        return ids;
                ids++;
@@@ -1179,7 -1184,7 +1184,7 @@@ EXPORT_SYMBOL(vio_unregister_driver)
  static void __devinit vio_dev_release(struct device *dev)
  {
        /* XXX should free TCE table */
 -      of_node_put(dev->archdata.of_node);
 +      of_node_put(dev->of_node);
        kfree(to_vio_dev(dev));
  }
  
@@@ -1230,7 -1235,7 +1235,7 @@@ struct vio_dev *vio_register_device_nod
                if (unit_address != NULL)
                        viodev->unit_address = *unit_address;
        }
 -      viodev->dev.archdata.of_node = of_node_get(of_node);
 +      viodev->dev.of_node = of_node_get(of_node);
  
        if (firmware_has_feature(FW_FEATURE_CMO))
                vio_cmo_set_dma_ops(viodev);
@@@ -1315,14 -1320,32 +1320,32 @@@ static ssize_t name_show(struct device 
  static ssize_t devspec_show(struct device *dev,
                struct device_attribute *attr, char *buf)
  {
 -      struct device_node *of_node = dev->archdata.of_node;
 +      struct device_node *of_node = dev->of_node;
  
        return sprintf(buf, "%s\n", of_node ? of_node->full_name : "none");
  }
  
 -      dn = dev->archdata.of_node;
+ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
+                            char *buf)
+ {
+       const struct vio_dev *vio_dev = to_vio_dev(dev);
+       struct device_node *dn;
+       const char *cp;
++      dn = dev->of_node;
+       if (!dn)
+               return -ENODEV;
+       cp = of_get_property(dn, "compatible", NULL);
+       if (!cp)
+               return -ENODEV;
+       return sprintf(buf, "vio:T%sS%s\n", vio_dev->type, cp);
+ }
  static struct device_attribute vio_dev_attrs[] = {
        __ATTR_RO(name),
        __ATTR_RO(devspec),
+       __ATTR_RO(modalias),
        __ATTR_NULL
  };
  
@@@ -1347,7 -1370,7 +1370,7 @@@ static int vio_hotplug(struct device *d
        struct device_node *dn;
        const char *cp;
  
 -      dn = dev->archdata.of_node;
 +      dn = dev->of_node;
        if (!dn)
                return -ENODEV;
        cp = of_get_property(dn, "compatible", NULL);
@@@ -1365,6 -1388,7 +1388,7 @@@ static struct bus_type vio_bus_type = 
        .match = vio_bus_match,
        .probe = vio_bus_probe,
        .remove = vio_bus_remove,
+       .pm = GENERIC_SUBSYS_PM_OPS,
  };
  
  /**
  */
  const void *vio_get_attribute(struct vio_dev *vdev, char *which, int *length)
  {
 -      return of_get_property(vdev->dev.archdata.of_node, which, length);
 +      return of_get_property(vdev->dev.of_node, which, length);
  }
  EXPORT_SYMBOL(vio_get_attribute);
  
index 217ba275cabf7b8cde532c7fa2c82ce36d0393d0,4453003032b57a8a6cab91f87eb03eabd8c26e67..e404b063be2cbc1d141c899c2e91f1ad79463989
@@@ -78,6 -78,11 +78,11 @@@ __volatile__ unsigned int *master_l10_c
  
  u32 (*do_arch_gettimeoffset)(void);
  
+ int update_persistent_clock(struct timespec now)
+ {
+       return set_rtc_mmss(now.tv_sec);
+ }
  /*
   * timer_interrupt() needs to keep up the real-time clock,
   * as well as call the "do_timer()" routine every clocktick
@@@ -87,9 -92,6 +92,6 @@@
  
  static irqreturn_t timer_interrupt(int dummy, void *dev_id)
  {
-       /* last time the cmos clock got updated */
-       static long last_rtc_update;
  #ifndef CONFIG_SMP
        profile_tick(CPU_PROFILING);
  #endif
  
        do_timer(1);
  
-       /* Determine when to update the Mostek clock. */
-       if (ntp_synced() &&
-           xtime.tv_sec > last_rtc_update + 660 &&
-           (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 &&
-           (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) {
-         if (set_rtc_mmss(xtime.tv_sec) == 0)
-           last_rtc_update = xtime.tv_sec;
-         else
-           last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */
-       }
        write_sequnlock(&xtime_lock);
  
  #ifndef CONFIG_SMP
@@@ -152,7 -144,7 +144,7 @@@ static struct platform_device m48t59_rt
  
  static int __devinit clock_probe(struct of_device *op, const struct of_device_id *match)
  {
 -      struct device_node *dp = op->node;
 +      struct device_node *dp = op->dev.of_node;
        const char *model = of_get_property(dp, "model", NULL);
  
        if (!model)
@@@ -185,11 -177,10 +177,11 @@@ static struct of_device_id __initdata c
  };
  
  static struct of_platform_driver clock_driver = {
 -      .match_table    = clock_match,
        .probe          = clock_probe,
 -      .driver         = {
 -              .name   = "rtc",
 +      .driver = {
 +              .name = "rtc",
 +              .owner = THIS_MODULE,
 +              .of_match_table = clock_match,
        },
  };
  
diff --combined drivers/ata/pata_macio.c
index c74f13bc987611918b9147d22370a547e5aaa01b,25df50f51c046d44c9a3f0579eb247b0029228d1..b5b48e703cb7ade708c26cdb759337a44bb68a29
@@@ -720,6 -720,8 +720,8 @@@ static int pata_macio_port_start(struc
        if (priv->dma_table_cpu == NULL) {
                dev_err(priv->dev, "Unable to allocate DMA command list\n");
                ap->ioaddr.bmdma_addr = NULL;
+               ap->mwdma_mask = 0;
+               ap->udma_mask = 0;
        }
        return 0;
  }
@@@ -917,7 -919,7 +919,7 @@@ static struct scsi_host_template pata_m
  };
  
  static struct ata_port_operations pata_macio_ops = {
-       .inherits               = &ata_sff_port_ops,
+       .inherits               = &ata_bmdma_port_ops,
  
        .freeze                 = pata_macio_freeze,
        .set_piomode            = pata_macio_set_timings,
        .cable_detect           = pata_macio_cable_detect,
        .sff_dev_select         = pata_macio_dev_select,
        .qc_prep                = pata_macio_qc_prep,
-       .mode_filter            = ata_bmdma_mode_filter,
        .bmdma_setup            = pata_macio_bmdma_setup,
        .bmdma_start            = pata_macio_bmdma_start,
        .bmdma_stop             = pata_macio_bmdma_stop,
@@@ -1139,7 -1140,7 +1140,7 @@@ static int __devinit pata_macio_attach(
                        "Failed to allocate private memory\n");
                return -ENOMEM;
        }
 -      priv->node = of_node_get(mdev->ofdev.node);
 +      priv->node = of_node_get(mdev->ofdev.dev.of_node);
        priv->mdev = mdev;
        priv->dev = &mdev->ofdev.dev;
  
index 88e6b6008bd6291a9802819f471984cc8c0c666b,96b11b604ae018331f21425495ec84227ff82619..36afe2c1c74730e0d194b54d09f9b9eb0223dd3f
@@@ -64,13 -64,13 +64,13 @@@ struct mpc52xx_ata_priv 
  
  
  /* ATAPI-4 PIO specs (in ns) */
- static const int ataspec_t0[5]    = {600, 383, 240, 180, 120};
- static const int ataspec_t1[5]    = { 70,  50,  30,  30,  25};
- static const int ataspec_t2_8[5]  = {290, 290, 290,  80,  70};
- static const int ataspec_t2_16[5] = {165, 125, 100,  80,  70};
- static const int ataspec_t2i[5]   = {  0,   0,   0,  70,  25};
- static const int ataspec_t4[5]    = { 30,  20,  15,  10,  10};
- static const int ataspec_ta[5]    = { 35,  35,  35,  35,  35};
+ static const u16 ataspec_t0[5]                = {600, 383, 240, 180, 120};
+ static const u16 ataspec_t1[5]                = { 70,  50,  30,  30,  25};
+ static const u16 ataspec_t2_8[5]      = {290, 290, 290,  80,  70};
+ static const u16 ataspec_t2_16[5]     = {165, 125, 100,  80,  70};
+ static const u16 ataspec_t2i[5]               = {  0,   0,   0,  70,  25};
+ static const u16 ataspec_t4[5]                = { 30,  20,  15,  10,  10};
+ static const u16 ataspec_ta[5]                = { 35,  35,  35,  35,  35};
  
  #define CALC_CLKCYC(c,v) ((((v)+(c)-1)/(c)))
  
  
  /* ATAPI-4 MDMA specs (in clocks) */
  struct mdmaspec {
-       u32 t0M;
-       u32 td;
-       u32 th;
-       u32 tj;
-       u32 tkw;
-       u32 tm;
-       u32 tn;
+       u8 t0M;
+       u8 td;
+       u8 th;
+       u8 tj;
+       u8 tkw;
+       u8 tm;
+       u8 tn;
  };
  
  static const struct mdmaspec mdmaspec66[3] = {
@@@ -101,23 -101,23 +101,23 @@@ static const struct mdmaspec mdmaspec13
  
  /* ATAPI-4 UDMA specs (in clocks) */
  struct udmaspec {
-       u32 tcyc;
-       u32 t2cyc;
-       u32 tds;
-       u32 tdh;
-       u32 tdvs;
-       u32 tdvh;
-       u32 tfs;
-       u32 tli;
-       u32 tmli;
-       u32 taz;
-       u32 tzah;
-       u32 tenv;
-       u32 tsr;
-       u32 trfs;
-       u32 trp;
-       u32 tack;
-       u32 tss;
+       u8 tcyc;
+       u8 t2cyc;
+       u8 tds;
+       u8 tdh;
+       u8 tdvs;
+       u8 tdvh;
+       u8 tfs;
+       u8 tli;
+       u8 tmli;
+       u8 taz;
+       u8 tzah;
+       u8 tenv;
+       u8 tsr;
+       u8 trfs;
+       u8 trp;
+       u8 tack;
+       u8 tss;
  };
  
  static const struct udmaspec udmaspec66[6] = {
@@@ -270,7 -270,7 +270,7 @@@ mpc52xx_ata_compute_pio_timings(struct 
  {
        struct mpc52xx_ata_timings *timing = &priv->timings[dev];
        unsigned int ipb_period = priv->ipb_period;
-       unsigned int t0, t1, t2_8, t2_16, t2i, t4, ta;
+       u32 t0, t1, t2_8, t2_16, t2i, t4, ta;
  
        if ((pio < 0) || (pio > 4))
                return -EINVAL;
@@@ -299,8 -299,8 +299,8 @@@ mpc52xx_ata_compute_mdma_timings(struc
        if (speed < 0 || speed > 2)
                return -EINVAL;
  
-       t->mdma1 = (s->t0M << 24) | (s->td << 16) | (s->tkw << 8) | (s->tm);
-       t->mdma2 = (s->th << 24) | (s->tj << 16) | (s->tn << 8);
+       t->mdma1 = ((u32)s->t0M << 24) | ((u32)s->td << 16) | ((u32)s->tkw << 8) | s->tm;
+       t->mdma2 = ((u32)s->th << 24) | ((u32)s->tj << 16) | ((u32)s->tn << 8);
        t->using_udma = 0;
  
        return 0;
@@@ -316,11 -316,11 +316,11 @@@ mpc52xx_ata_compute_udma_timings(struc
        if (speed < 0 || speed > 2)
                return -EINVAL;
  
-       t->udma1 = (s->t2cyc << 24) | (s->tcyc << 16) | (s->tds << 8) | s->tdh;
-       t->udma2 = (s->tdvs << 24) | (s->tdvh << 16) | (s->tfs << 8) | s->tli;
-       t->udma3 = (s->tmli << 24) | (s->taz << 16) | (s->tenv << 8) | s->tsr;
-       t->udma4 = (s->tss << 24) | (s->trfs << 16) | (s->trp << 8) | s->tack;
-       t->udma5 = (s->tzah << 24);
+       t->udma1 = ((u32)s->t2cyc << 24) | ((u32)s->tcyc << 16) | ((u32)s->tds << 8) | s->tdh;
+       t->udma2 = ((u32)s->tdvs << 24) | ((u32)s->tdvh << 16) | ((u32)s->tfs << 8) | s->tli;
+       t->udma3 = ((u32)s->tmli << 24) | ((u32)s->taz << 16) | ((u32)s->tenv << 8) | s->tsr;
+       t->udma4 = ((u32)s->tss << 24) | ((u32)s->trfs << 16) | ((u32)s->trp << 8) | s->tack;
+       t->udma5 = (u32)s->tzah << 24;
        t->using_udma = 1;
  
        return 0;
@@@ -694,7 -694,7 +694,7 @@@ mpc52xx_ata_probe(struct of_device *op
        struct bcom_task *dmatsk = NULL;
  
        /* Get ipb frequency */
 -      ipb_freq = mpc5xxx_get_bus_frequency(op->node);
 +      ipb_freq = mpc5xxx_get_bus_frequency(op->dev.of_node);
        if (!ipb_freq) {
                dev_err(&op->dev, "could not determine IPB bus frequency\n");
                return -ENODEV;
  
        /* Get device base address from device tree, request the region
         * and ioremap it. */
 -      rv = of_address_to_resource(op->node, 0, &res_mem);
 +      rv = of_address_to_resource(op->dev.of_node, 0, &res_mem);
        if (rv) {
                dev_err(&op->dev, "could not determine device base address\n");
                return rv;
         * The MPC5200 ATA controller supports MWDMA modes 0, 1 and 2 and
         * UDMA modes 0, 1 and 2.
         */
 -      prop = of_get_property(op->node, "mwdma-mode", &proplen);
 +      prop = of_get_property(op->dev.of_node, "mwdma-mode", &proplen);
        if ((prop) && (proplen >= 4))
                mwdma_mask = ATA_MWDMA2 & ((1 << (*prop + 1)) - 1);
 -      prop = of_get_property(op->node, "udma-mode", &proplen);
 +      prop = of_get_property(op->dev.of_node, "udma-mode", &proplen);
        if ((prop) && (proplen >= 4))
                udma_mask = ATA_UDMA2 & ((1 << (*prop + 1)) - 1);
  
 -      ata_irq = irq_of_parse_and_map(op->node, 0);
 +      ata_irq = irq_of_parse_and_map(op->dev.of_node, 0);
        if (ata_irq == NO_IRQ) {
                dev_err(&op->dev, "error mapping irq\n");
                return -EINVAL;
@@@ -884,6 -884,9 +884,6 @@@ static struct of_device_id mpc52xx_ata_
  
  
  static struct of_platform_driver mpc52xx_ata_of_platform_driver = {
 -      .owner          = THIS_MODULE,
 -      .name           = DRV_NAME,
 -      .match_table    = mpc52xx_ata_of_match,
        .probe          = mpc52xx_ata_probe,
        .remove         = mpc52xx_ata_remove,
  #ifdef CONFIG_PM
        .driver         = {
                .name   = DRV_NAME,
                .owner  = THIS_MODULE,
 +              .of_match_table = mpc52xx_ata_of_match,
        },
  };
  
diff --combined drivers/crypto/talitos.c
index 7e4e42d85fe48ef4e7cc611fb9f3bec5d7162b3f,6a0f59d1fc5c4e834aaf90006ca30c7e35f8cdd9..637c105f53d262f904230c77b5bc5a5a5234fda7
@@@ -1,7 -1,7 +1,7 @@@
  /*
   * talitos - Freescale Integrated Security Engine (SEC) device driver
   *
-  * Copyright (c) 2008 Freescale Semiconductor, Inc.
+  * Copyright (c) 2008-2010 Freescale Semiconductor, Inc.
   *
   * Scatterlist Crypto API glue code copied from files with the following:
   * Copyright (c) 2006-2007 Herbert Xu <herbert@gondor.apana.org.au>
  #include <crypto/aes.h>
  #include <crypto/des.h>
  #include <crypto/sha.h>
+ #include <crypto/md5.h>
  #include <crypto/aead.h>
  #include <crypto/authenc.h>
  #include <crypto/skcipher.h>
+ #include <crypto/hash.h>
+ #include <crypto/internal/hash.h>
  #include <crypto/scatterwalk.h>
  
  #include "talitos.h"
@@@ -65,6 -68,13 +68,13 @@@ struct talitos_ptr 
        __be32 ptr;     /* address */
  };
  
+ static const struct talitos_ptr zero_entry = {
+       .len = 0,
+       .j_extent = 0,
+       .eptr = 0,
+       .ptr = 0
+ };
  /* descriptor */
  struct talitos_desc {
        __be32 hdr;                     /* header high bits */
@@@ -146,6 -156,7 +156,7 @@@ struct talitos_private 
  /* .features flag */
  #define TALITOS_FTR_SRC_LINK_TBL_LEN_INCLUDES_EXTENT 0x00000001
  #define TALITOS_FTR_HW_AUTH_CHECK 0x00000002
+ #define TALITOS_FTR_SHA224_HWINIT 0x00000004
  
  static void to_talitos_ptr(struct talitos_ptr *talitos_ptr, dma_addr_t dma_addr)
  {
@@@ -692,7 -703,7 +703,7 @@@ static void talitos_unregister_rng(stru
  #define TALITOS_MAX_KEY_SIZE          64
  #define TALITOS_MAX_IV_LENGTH         16 /* max of AES_BLOCK_SIZE, DES3_EDE_BLOCK_SIZE */
  
- #define MD5_DIGEST_SIZE   16
+ #define MD5_BLOCK_SIZE    64
  
  struct talitos_ctx {
        struct device *dev;
        unsigned int authsize;
  };
  
+ #define HASH_MAX_BLOCK_SIZE           SHA512_BLOCK_SIZE
+ #define TALITOS_MDEU_MAX_CONTEXT_SIZE TALITOS_MDEU_CONTEXT_SIZE_SHA384_SHA512
+ struct talitos_ahash_req_ctx {
+       u64 count;
+       u32 hw_context[TALITOS_MDEU_MAX_CONTEXT_SIZE / sizeof(u32)];
+       unsigned int hw_context_size;
+       u8 buf[HASH_MAX_BLOCK_SIZE];
+       u8 bufnext[HASH_MAX_BLOCK_SIZE];
+       unsigned int swinit;
+       unsigned int first;
+       unsigned int last;
+       unsigned int to_hash_later;
+       struct scatterlist bufsl[2];
+       struct scatterlist *psrc;
+ };
  static int aead_setauthsize(struct crypto_aead *authenc,
                            unsigned int authsize)
  {
@@@ -821,10 -849,14 +849,14 @@@ static void talitos_sg_unmap(struct dev
                else
                        dma_unmap_sg(dev, src, src_nents, DMA_TO_DEVICE);
  
-               if (edesc->dst_is_chained)
-                       talitos_unmap_sg_chain(dev, dst, DMA_FROM_DEVICE);
-               else
-                       dma_unmap_sg(dev, dst, dst_nents, DMA_FROM_DEVICE);
+               if (dst) {
+                       if (edesc->dst_is_chained)
+                               talitos_unmap_sg_chain(dev, dst,
+                                                      DMA_FROM_DEVICE);
+                       else
+                               dma_unmap_sg(dev, dst, dst_nents,
+                                            DMA_FROM_DEVICE);
+               }
        } else
                if (edesc->src_is_chained)
                        talitos_unmap_sg_chain(dev, src, DMA_BIDIRECTIONAL);
@@@ -1114,12 -1146,67 +1146,67 @@@ static int sg_count(struct scatterlist 
        return sg_nents;
  }
  
+ /**
+  * sg_copy_end_to_buffer - Copy end data from SG list to a linear buffer
+  * @sgl:               The SG list
+  * @nents:             Number of SG entries
+  * @buf:               Where to copy to
+  * @buflen:            The number of bytes to copy
+  * @skip:              The number of bytes to skip before copying.
+  *                       Note: skip + buflen should equal SG total size.
+  *
+  * Returns the number of copied bytes.
+  *
+  **/
+ static size_t sg_copy_end_to_buffer(struct scatterlist *sgl, unsigned int nents,
+                                   void *buf, size_t buflen, unsigned int skip)
+ {
+       unsigned int offset = 0;
+       unsigned int boffset = 0;
+       struct sg_mapping_iter miter;
+       unsigned long flags;
+       unsigned int sg_flags = SG_MITER_ATOMIC;
+       size_t total_buffer = buflen + skip;
+       sg_flags |= SG_MITER_FROM_SG;
+       sg_miter_start(&miter, sgl, nents, sg_flags);
+       local_irq_save(flags);
+       while (sg_miter_next(&miter) && offset < total_buffer) {
+               unsigned int len;
+               unsigned int ignore;
+               if ((offset + miter.length) > skip) {
+                       if (offset < skip) {
+                               /* Copy part of this segment */
+                               ignore = skip - offset;
+                               len = miter.length - ignore;
+                               memcpy(buf + boffset, miter.addr + ignore, len);
+                       } else {
+                               /* Copy all of this segment */
+                               len = miter.length;
+                               memcpy(buf + boffset, miter.addr, len);
+                       }
+                       boffset += len;
+               }
+               offset += miter.length;
+       }
+       sg_miter_stop(&miter);
+       local_irq_restore(flags);
+       return boffset;
+ }
  /*
   * allocate and map the extended descriptor
   */
  static struct talitos_edesc *talitos_edesc_alloc(struct device *dev,
                                                 struct scatterlist *src,
                                                 struct scatterlist *dst,
+                                                int hash_result,
                                                 unsigned int cryptlen,
                                                 unsigned int authsize,
                                                 int icv_stashing,
        src_nents = sg_count(src, cryptlen + authsize, &src_chained);
        src_nents = (src_nents == 1) ? 0 : src_nents;
  
-       if (dst == src) {
-               dst_nents = src_nents;
+       if (hash_result) {
+               dst_nents = 0;
        } else {
-               dst_nents = sg_count(dst, cryptlen + authsize, &dst_chained);
-               dst_nents = (dst_nents == 1) ? 0 : dst_nents;
+               if (dst == src) {
+                       dst_nents = src_nents;
+               } else {
+                       dst_nents = sg_count(dst, cryptlen + authsize,
+                                            &dst_chained);
+                       dst_nents = (dst_nents == 1) ? 0 : dst_nents;
+               }
        }
  
        /*
        edesc->src_is_chained = src_chained;
        edesc->dst_is_chained = dst_chained;
        edesc->dma_len = dma_len;
-       edesc->dma_link_tbl = dma_map_single(dev, &edesc->link_tbl[0],
-                                            edesc->dma_len, DMA_BIDIRECTIONAL);
+       if (dma_len)
+               edesc->dma_link_tbl = dma_map_single(dev, &edesc->link_tbl[0],
+                                                    edesc->dma_len,
+                                                    DMA_BIDIRECTIONAL);
  
        return edesc;
  }
@@@ -1184,7 -1278,7 +1278,7 @@@ static struct talitos_edesc *aead_edesc
        struct crypto_aead *authenc = crypto_aead_reqtfm(areq);
        struct talitos_ctx *ctx = crypto_aead_ctx(authenc);
  
-       return talitos_edesc_alloc(ctx->dev, areq->src, areq->dst,
+       return talitos_edesc_alloc(ctx->dev, areq->src, areq->dst, 0,
                                   areq->cryptlen, ctx->authsize, icv_stashing,
                                   areq->base.flags);
  }
@@@ -1441,8 -1535,8 +1535,8 @@@ static struct talitos_edesc *ablkcipher
        struct crypto_ablkcipher *cipher = crypto_ablkcipher_reqtfm(areq);
        struct talitos_ctx *ctx = crypto_ablkcipher_ctx(cipher);
  
-       return talitos_edesc_alloc(ctx->dev, areq->src, areq->dst, areq->nbytes,
-                                  0, 0, areq->base.flags);
+       return talitos_edesc_alloc(ctx->dev, areq->src, areq->dst, 0,
+                                  areq->nbytes, 0, 0, areq->base.flags);
  }
  
  static int ablkcipher_encrypt(struct ablkcipher_request *areq)
@@@ -1478,15 -1572,329 +1572,329 @@@ static int ablkcipher_decrypt(struct ab
        return common_nonsnoop(edesc, areq, NULL, ablkcipher_done);
  }
  
+ static void common_nonsnoop_hash_unmap(struct device *dev,
+                                      struct talitos_edesc *edesc,
+                                      struct ahash_request *areq)
+ {
+       struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq);
+       unmap_single_talitos_ptr(dev, &edesc->desc.ptr[5], DMA_FROM_DEVICE);
+       /* When using hashctx-in, must unmap it. */
+       if (edesc->desc.ptr[1].len)
+               unmap_single_talitos_ptr(dev, &edesc->desc.ptr[1],
+                                        DMA_TO_DEVICE);
+       if (edesc->desc.ptr[2].len)
+               unmap_single_talitos_ptr(dev, &edesc->desc.ptr[2],
+                                        DMA_TO_DEVICE);
+       talitos_sg_unmap(dev, edesc, req_ctx->psrc, NULL);
+       if (edesc->dma_len)
+               dma_unmap_single(dev, edesc->dma_link_tbl, edesc->dma_len,
+                                DMA_BIDIRECTIONAL);
+ }
+ static void ahash_done(struct device *dev,
+                      struct talitos_desc *desc, void *context,
+                      int err)
+ {
+       struct ahash_request *areq = context;
+       struct talitos_edesc *edesc =
+                container_of(desc, struct talitos_edesc, desc);
+       struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq);
+       if (!req_ctx->last && req_ctx->to_hash_later) {
+               /* Position any partial block for next update/final/finup */
+               memcpy(req_ctx->buf, req_ctx->bufnext, req_ctx->to_hash_later);
+       }
+       common_nonsnoop_hash_unmap(dev, edesc, areq);
+       kfree(edesc);
+       areq->base.complete(&areq->base, err);
+ }
+ static int common_nonsnoop_hash(struct talitos_edesc *edesc,
+                               struct ahash_request *areq, unsigned int length,
+                               void (*callback) (struct device *dev,
+                                                 struct talitos_desc *desc,
+                                                 void *context, int error))
+ {
+       struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq);
+       struct talitos_ctx *ctx = crypto_ahash_ctx(tfm);
+       struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq);
+       struct device *dev = ctx->dev;
+       struct talitos_desc *desc = &edesc->desc;
+       int sg_count, ret;
+       /* first DWORD empty */
+       desc->ptr[0] = zero_entry;
+       /* hash context in */
+       if (!req_ctx->first || req_ctx->swinit) {
+               map_single_talitos_ptr(dev, &desc->ptr[1],
+                                      req_ctx->hw_context_size,
+                                      (char *)req_ctx->hw_context, 0,
+                                      DMA_TO_DEVICE);
+               req_ctx->swinit = 0;
+       } else {
+               desc->ptr[1] = zero_entry;
+               /* Indicate next op is not the first. */
+               req_ctx->first = 0;
+       }
+       /* HMAC key */
+       if (ctx->keylen)
+               map_single_talitos_ptr(dev, &desc->ptr[2], ctx->keylen,
+                                      (char *)&ctx->key, 0, DMA_TO_DEVICE);
+       else
+               desc->ptr[2] = zero_entry;
+       /*
+        * data in
+        */
+       desc->ptr[3].len = cpu_to_be16(length);
+       desc->ptr[3].j_extent = 0;
+       sg_count = talitos_map_sg(dev, req_ctx->psrc,
+                                 edesc->src_nents ? : 1,
+                                 DMA_TO_DEVICE,
+                                 edesc->src_is_chained);
+       if (sg_count == 1) {
+               to_talitos_ptr(&desc->ptr[3], sg_dma_address(req_ctx->psrc));
+       } else {
+               sg_count = sg_to_link_tbl(req_ctx->psrc, sg_count, length,
+                                         &edesc->link_tbl[0]);
+               if (sg_count > 1) {
+                       desc->ptr[3].j_extent |= DESC_PTR_LNKTBL_JUMP;
+                       to_talitos_ptr(&desc->ptr[3], edesc->dma_link_tbl);
+                       dma_sync_single_for_device(ctx->dev,
+                                                  edesc->dma_link_tbl,
+                                                  edesc->dma_len,
+                                                  DMA_BIDIRECTIONAL);
+               } else {
+                       /* Only one segment now, so no link tbl needed */
+                       to_talitos_ptr(&desc->ptr[3],
+                                      sg_dma_address(req_ctx->psrc));
+               }
+       }
+       /* fifth DWORD empty */
+       desc->ptr[4] = zero_entry;
+       /* hash/HMAC out -or- hash context out */
+       if (req_ctx->last)
+               map_single_talitos_ptr(dev, &desc->ptr[5],
+                                      crypto_ahash_digestsize(tfm),
+                                      areq->result, 0, DMA_FROM_DEVICE);
+       else
+               map_single_talitos_ptr(dev, &desc->ptr[5],
+                                      req_ctx->hw_context_size,
+                                      req_ctx->hw_context, 0, DMA_FROM_DEVICE);
+       /* last DWORD empty */
+       desc->ptr[6] = zero_entry;
+       ret = talitos_submit(dev, desc, callback, areq);
+       if (ret != -EINPROGRESS) {
+               common_nonsnoop_hash_unmap(dev, edesc, areq);
+               kfree(edesc);
+       }
+       return ret;
+ }
+ static struct talitos_edesc *ahash_edesc_alloc(struct ahash_request *areq,
+                                              unsigned int nbytes)
+ {
+       struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq);
+       struct talitos_ctx *ctx = crypto_ahash_ctx(tfm);
+       struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq);
+       return talitos_edesc_alloc(ctx->dev, req_ctx->psrc, NULL, 1,
+                                  nbytes, 0, 0, areq->base.flags);
+ }
+ static int ahash_init(struct ahash_request *areq)
+ {
+       struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq);
+       struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq);
+       /* Initialize the context */
+       req_ctx->count = 0;
+       req_ctx->first = 1; /* first indicates h/w must init its context */
+       req_ctx->swinit = 0; /* assume h/w init of context */
+       req_ctx->hw_context_size =
+               (crypto_ahash_digestsize(tfm) <= SHA256_DIGEST_SIZE)
+                       ? TALITOS_MDEU_CONTEXT_SIZE_MD5_SHA1_SHA256
+                       : TALITOS_MDEU_CONTEXT_SIZE_SHA384_SHA512;
+       return 0;
+ }
+ /*
+  * on h/w without explicit sha224 support, we initialize h/w context
+  * manually with sha224 constants, and tell it to run sha256.
+  */
+ static int ahash_init_sha224_swinit(struct ahash_request *areq)
+ {
+       struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq);
+       ahash_init(areq);
+       req_ctx->swinit = 1;/* prevent h/w initting context with sha256 values*/
+       req_ctx->hw_context[0] = cpu_to_be32(SHA224_H0);
+       req_ctx->hw_context[1] = cpu_to_be32(SHA224_H1);
+       req_ctx->hw_context[2] = cpu_to_be32(SHA224_H2);
+       req_ctx->hw_context[3] = cpu_to_be32(SHA224_H3);
+       req_ctx->hw_context[4] = cpu_to_be32(SHA224_H4);
+       req_ctx->hw_context[5] = cpu_to_be32(SHA224_H5);
+       req_ctx->hw_context[6] = cpu_to_be32(SHA224_H6);
+       req_ctx->hw_context[7] = cpu_to_be32(SHA224_H7);
+       /* init 64-bit count */
+       req_ctx->hw_context[8] = 0;
+       req_ctx->hw_context[9] = 0;
+       return 0;
+ }
+ static int ahash_process_req(struct ahash_request *areq, unsigned int nbytes)
+ {
+       struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq);
+       struct talitos_ctx *ctx = crypto_ahash_ctx(tfm);
+       struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq);
+       struct talitos_edesc *edesc;
+       unsigned int blocksize =
+                       crypto_tfm_alg_blocksize(crypto_ahash_tfm(tfm));
+       unsigned int nbytes_to_hash;
+       unsigned int to_hash_later;
+       unsigned int index;
+       int chained;
+       index = req_ctx->count & (blocksize - 1);
+       req_ctx->count += nbytes;
+       if (!req_ctx->last && (index + nbytes) < blocksize) {
+               /* Buffer the partial block */
+               sg_copy_to_buffer(areq->src,
+                                 sg_count(areq->src, nbytes, &chained),
+                                 req_ctx->buf + index, nbytes);
+               return 0;
+       }
+       if (index) {
+               /* partial block from previous update; chain it in. */
+               sg_init_table(req_ctx->bufsl, (nbytes) ? 2 : 1);
+               sg_set_buf(req_ctx->bufsl, req_ctx->buf, index);
+               if (nbytes)
+                       scatterwalk_sg_chain(req_ctx->bufsl, 2,
+                                            areq->src);
+               req_ctx->psrc = req_ctx->bufsl;
+       } else {
+               req_ctx->psrc = areq->src;
+       }
+       nbytes_to_hash =  index + nbytes;
+       if (!req_ctx->last) {
+               to_hash_later = (nbytes_to_hash & (blocksize - 1));
+               if (to_hash_later) {
+                       int nents;
+                       /* Must copy to_hash_later bytes from the end
+                        * to bufnext (a partial block) for later.
+                        */
+                       nents = sg_count(areq->src, nbytes, &chained);
+                       sg_copy_end_to_buffer(areq->src, nents,
+                                             req_ctx->bufnext,
+                                             to_hash_later,
+                                             nbytes - to_hash_later);
+                       /* Adjust count for what will be hashed now */
+                       nbytes_to_hash -= to_hash_later;
+               }
+               req_ctx->to_hash_later = to_hash_later;
+       }
+       /* allocate extended descriptor */
+       edesc = ahash_edesc_alloc(areq, nbytes_to_hash);
+       if (IS_ERR(edesc))
+               return PTR_ERR(edesc);
+       edesc->desc.hdr = ctx->desc_hdr_template;
+       /* On last one, request SEC to pad; otherwise continue */
+       if (req_ctx->last)
+               edesc->desc.hdr |= DESC_HDR_MODE0_MDEU_PAD;
+       else
+               edesc->desc.hdr |= DESC_HDR_MODE0_MDEU_CONT;
+       /* request SEC to INIT hash. */
+       if (req_ctx->first && !req_ctx->swinit)
+               edesc->desc.hdr |= DESC_HDR_MODE0_MDEU_INIT;
+       /* When the tfm context has a keylen, it's an HMAC.
+        * A first or last (ie. not middle) descriptor must request HMAC.
+        */
+       if (ctx->keylen && (req_ctx->first || req_ctx->last))
+               edesc->desc.hdr |= DESC_HDR_MODE0_MDEU_HMAC;
+       return common_nonsnoop_hash(edesc, areq, nbytes_to_hash,
+                                   ahash_done);
+ }
+ static int ahash_update(struct ahash_request *areq)
+ {
+       struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq);
+       req_ctx->last = 0;
+       return ahash_process_req(areq, areq->nbytes);
+ }
+ static int ahash_final(struct ahash_request *areq)
+ {
+       struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq);
+       req_ctx->last = 1;
+       return ahash_process_req(areq, 0);
+ }
+ static int ahash_finup(struct ahash_request *areq)
+ {
+       struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq);
+       req_ctx->last = 1;
+       return ahash_process_req(areq, areq->nbytes);
+ }
+ static int ahash_digest(struct ahash_request *areq)
+ {
+       struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq);
+       struct crypto_ahash *ahash = crypto_ahash_reqtfm(areq);
+       ahash->init(areq);
+       req_ctx->last = 1;
+       return ahash_process_req(areq, areq->nbytes);
+ }
  struct talitos_alg_template {
-       struct crypto_alg alg;
+       u32 type;
+       union {
+               struct crypto_alg crypto;
+               struct ahash_alg hash;
+       } alg;
        __be32 desc_hdr_template;
  };
  
  static struct talitos_alg_template driver_algs[] = {
        /* AEAD algorithms.  These use a single-pass ipsec_esp descriptor */
-       {
-               .alg = {
+       {       .type = CRYPTO_ALG_TYPE_AEAD,
+               .alg.crypto = {
                        .cra_name = "authenc(hmac(sha1),cbc(aes))",
                        .cra_driver_name = "authenc-hmac-sha1-cbc-aes-talitos",
                        .cra_blocksize = AES_BLOCK_SIZE,
                                     DESC_HDR_MODE1_MDEU_PAD |
                                     DESC_HDR_MODE1_MDEU_SHA1_HMAC,
        },
-       {
-               .alg = {
+       {       .type = CRYPTO_ALG_TYPE_AEAD,
+               .alg.crypto = {
                        .cra_name = "authenc(hmac(sha1),cbc(des3_ede))",
                        .cra_driver_name = "authenc-hmac-sha1-cbc-3des-talitos",
                        .cra_blocksize = DES3_EDE_BLOCK_SIZE,
                                     DESC_HDR_MODE1_MDEU_PAD |
                                     DESC_HDR_MODE1_MDEU_SHA1_HMAC,
        },
-       {
-               .alg = {
+       {       .type = CRYPTO_ALG_TYPE_AEAD,
+               .alg.crypto = {
                        .cra_name = "authenc(hmac(sha256),cbc(aes))",
                        .cra_driver_name = "authenc-hmac-sha256-cbc-aes-talitos",
                        .cra_blocksize = AES_BLOCK_SIZE,
                                     DESC_HDR_MODE1_MDEU_PAD |
                                     DESC_HDR_MODE1_MDEU_SHA256_HMAC,
        },
-       {
-               .alg = {
+       {       .type = CRYPTO_ALG_TYPE_AEAD,
+               .alg.crypto = {
                        .cra_name = "authenc(hmac(sha256),cbc(des3_ede))",
                        .cra_driver_name = "authenc-hmac-sha256-cbc-3des-talitos",
                        .cra_blocksize = DES3_EDE_BLOCK_SIZE,
                                     DESC_HDR_MODE1_MDEU_PAD |
                                     DESC_HDR_MODE1_MDEU_SHA256_HMAC,
        },
-       {
-               .alg = {
+       {       .type = CRYPTO_ALG_TYPE_AEAD,
+               .alg.crypto = {
                        .cra_name = "authenc(hmac(md5),cbc(aes))",
                        .cra_driver_name = "authenc-hmac-md5-cbc-aes-talitos",
                        .cra_blocksize = AES_BLOCK_SIZE,
                                     DESC_HDR_MODE1_MDEU_PAD |
                                     DESC_HDR_MODE1_MDEU_MD5_HMAC,
        },
-       {
-               .alg = {
+       {       .type = CRYPTO_ALG_TYPE_AEAD,
+               .alg.crypto = {
                        .cra_name = "authenc(hmac(md5),cbc(des3_ede))",
                        .cra_driver_name = "authenc-hmac-md5-cbc-3des-talitos",
                        .cra_blocksize = DES3_EDE_BLOCK_SIZE,
                                     DESC_HDR_MODE1_MDEU_MD5_HMAC,
        },
        /* ABLKCIPHER algorithms. */
-       {
-               .alg = {
+       {       .type = CRYPTO_ALG_TYPE_ABLKCIPHER,
+               .alg.crypto = {
                        .cra_name = "cbc(aes)",
                        .cra_driver_name = "cbc-aes-talitos",
                        .cra_blocksize = AES_BLOCK_SIZE,
                                     DESC_HDR_SEL0_AESU |
                                     DESC_HDR_MODE0_AESU_CBC,
        },
-       {
-               .alg = {
+       {       .type = CRYPTO_ALG_TYPE_ABLKCIPHER,
+               .alg.crypto = {
                        .cra_name = "cbc(des3_ede)",
                        .cra_driver_name = "cbc-3des-talitos",
                        .cra_blocksize = DES3_EDE_BLOCK_SIZE,
                                     DESC_HDR_SEL0_DEU |
                                     DESC_HDR_MODE0_DEU_CBC |
                                     DESC_HDR_MODE0_DEU_3DES,
-       }
+       },
+       /* AHASH algorithms. */
+       {       .type = CRYPTO_ALG_TYPE_AHASH,
+               .alg.hash = {
+                       .init = ahash_init,
+                       .update = ahash_update,
+                       .final = ahash_final,
+                       .finup = ahash_finup,
+                       .digest = ahash_digest,
+                       .halg.digestsize = MD5_DIGEST_SIZE,
+                       .halg.base = {
+                               .cra_name = "md5",
+                               .cra_driver_name = "md5-talitos",
+                               .cra_blocksize = MD5_BLOCK_SIZE,
+                               .cra_flags = CRYPTO_ALG_TYPE_AHASH |
+                                            CRYPTO_ALG_ASYNC,
+                               .cra_type = &crypto_ahash_type
+                       }
+               },
+               .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU |
+                                    DESC_HDR_SEL0_MDEUA |
+                                    DESC_HDR_MODE0_MDEU_MD5,
+       },
+       {       .type = CRYPTO_ALG_TYPE_AHASH,
+               .alg.hash = {
+                       .init = ahash_init,
+                       .update = ahash_update,
+                       .final = ahash_final,
+                       .finup = ahash_finup,
+                       .digest = ahash_digest,
+                       .halg.digestsize = SHA1_DIGEST_SIZE,
+                       .halg.base = {
+                               .cra_name = "sha1",
+                               .cra_driver_name = "sha1-talitos",
+                               .cra_blocksize = SHA1_BLOCK_SIZE,
+                               .cra_flags = CRYPTO_ALG_TYPE_AHASH |
+                                            CRYPTO_ALG_ASYNC,
+                               .cra_type = &crypto_ahash_type
+                       }
+               },
+               .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU |
+                                    DESC_HDR_SEL0_MDEUA |
+                                    DESC_HDR_MODE0_MDEU_SHA1,
+       },
+       {       .type = CRYPTO_ALG_TYPE_AHASH,
+               .alg.hash = {
+                       .init = ahash_init,
+                       .update = ahash_update,
+                       .final = ahash_final,
+                       .finup = ahash_finup,
+                       .digest = ahash_digest,
+                       .halg.digestsize = SHA224_DIGEST_SIZE,
+                       .halg.base = {
+                               .cra_name = "sha224",
+                               .cra_driver_name = "sha224-talitos",
+                               .cra_blocksize = SHA224_BLOCK_SIZE,
+                               .cra_flags = CRYPTO_ALG_TYPE_AHASH |
+                                            CRYPTO_ALG_ASYNC,
+                               .cra_type = &crypto_ahash_type
+                       }
+               },
+               .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU |
+                                    DESC_HDR_SEL0_MDEUA |
+                                    DESC_HDR_MODE0_MDEU_SHA224,
+       },
+       {       .type = CRYPTO_ALG_TYPE_AHASH,
+               .alg.hash = {
+                       .init = ahash_init,
+                       .update = ahash_update,
+                       .final = ahash_final,
+                       .finup = ahash_finup,
+                       .digest = ahash_digest,
+                       .halg.digestsize = SHA256_DIGEST_SIZE,
+                       .halg.base = {
+                               .cra_name = "sha256",
+                               .cra_driver_name = "sha256-talitos",
+                               .cra_blocksize = SHA256_BLOCK_SIZE,
+                               .cra_flags = CRYPTO_ALG_TYPE_AHASH |
+                                            CRYPTO_ALG_ASYNC,
+                               .cra_type = &crypto_ahash_type
+                       }
+               },
+               .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU |
+                                    DESC_HDR_SEL0_MDEUA |
+                                    DESC_HDR_MODE0_MDEU_SHA256,
+       },
+       {       .type = CRYPTO_ALG_TYPE_AHASH,
+               .alg.hash = {
+                       .init = ahash_init,
+                       .update = ahash_update,
+                       .final = ahash_final,
+                       .finup = ahash_finup,
+                       .digest = ahash_digest,
+                       .halg.digestsize = SHA384_DIGEST_SIZE,
+                       .halg.base = {
+                               .cra_name = "sha384",
+                               .cra_driver_name = "sha384-talitos",
+                               .cra_blocksize = SHA384_BLOCK_SIZE,
+                               .cra_flags = CRYPTO_ALG_TYPE_AHASH |
+                                            CRYPTO_ALG_ASYNC,
+                               .cra_type = &crypto_ahash_type
+                       }
+               },
+               .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU |
+                                    DESC_HDR_SEL0_MDEUB |
+                                    DESC_HDR_MODE0_MDEUB_SHA384,
+       },
+       {       .type = CRYPTO_ALG_TYPE_AHASH,
+               .alg.hash = {
+                       .init = ahash_init,
+                       .update = ahash_update,
+                       .final = ahash_final,
+                       .finup = ahash_finup,
+                       .digest = ahash_digest,
+                       .halg.digestsize = SHA512_DIGEST_SIZE,
+                       .halg.base = {
+                               .cra_name = "sha512",
+                               .cra_driver_name = "sha512-talitos",
+                               .cra_blocksize = SHA512_BLOCK_SIZE,
+                               .cra_flags = CRYPTO_ALG_TYPE_AHASH |
+                                            CRYPTO_ALG_ASYNC,
+                               .cra_type = &crypto_ahash_type
+                       }
+               },
+               .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU |
+                                    DESC_HDR_SEL0_MDEUB |
+                                    DESC_HDR_MODE0_MDEUB_SHA512,
+       },
  };
  
  struct talitos_crypto_alg {
        struct list_head entry;
        struct device *dev;
-       __be32 desc_hdr_template;
-       struct crypto_alg crypto_alg;
+       struct talitos_alg_template algt;
  };
  
  static int talitos_cra_init(struct crypto_tfm *tfm)
        struct talitos_crypto_alg *talitos_alg;
        struct talitos_ctx *ctx = crypto_tfm_ctx(tfm);
  
-       talitos_alg =  container_of(alg, struct talitos_crypto_alg, crypto_alg);
+       if ((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) == CRYPTO_ALG_TYPE_AHASH)
+               talitos_alg = container_of(__crypto_ahash_alg(alg),
+                                          struct talitos_crypto_alg,
+                                          algt.alg.hash);
+       else
+               talitos_alg = container_of(alg, struct talitos_crypto_alg,
+                                          algt.alg.crypto);
  
        /* update context with ptr to dev */
        ctx->dev = talitos_alg->dev;
  
        /* copy descriptor header template value */
-       ctx->desc_hdr_template = talitos_alg->desc_hdr_template;
+       ctx->desc_hdr_template = talitos_alg->algt.desc_hdr_template;
+       return 0;
+ }
+ static int talitos_cra_init_aead(struct crypto_tfm *tfm)
+ {
+       struct talitos_ctx *ctx = crypto_tfm_ctx(tfm);
+       talitos_cra_init(tfm);
  
        /* random first IV */
        get_random_bytes(ctx->iv, TALITOS_MAX_IV_LENGTH);
        return 0;
  }
  
+ static int talitos_cra_init_ahash(struct crypto_tfm *tfm)
+ {
+       struct talitos_ctx *ctx = crypto_tfm_ctx(tfm);
+       talitos_cra_init(tfm);
+       ctx->keylen = 0;
+       crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm),
+                                sizeof(struct talitos_ahash_req_ctx));
+       return 0;
+ }
  /*
   * given the alg's descriptor header template, determine whether descriptor
   * type and primary/secondary execution units required match the hw
@@@ -1747,7 -2309,15 +2309,15 @@@ static int talitos_remove(struct of_dev
        int i;
  
        list_for_each_entry_safe(t_alg, n, &priv->alg_list, entry) {
-               crypto_unregister_alg(&t_alg->crypto_alg);
+               switch (t_alg->algt.type) {
+               case CRYPTO_ALG_TYPE_ABLKCIPHER:
+               case CRYPTO_ALG_TYPE_AEAD:
+                       crypto_unregister_alg(&t_alg->algt.alg.crypto);
+                       break;
+               case CRYPTO_ALG_TYPE_AHASH:
+                       crypto_unregister_ahash(&t_alg->algt.alg.hash);
+                       break;
+               }
                list_del(&t_alg->entry);
                kfree(t_alg);
        }
@@@ -1781,6 -2351,7 +2351,7 @@@ static struct talitos_crypto_alg *talit
                                                    struct talitos_alg_template
                                                           *template)
  {
+       struct talitos_private *priv = dev_get_drvdata(dev);
        struct talitos_crypto_alg *t_alg;
        struct crypto_alg *alg;
  
        if (!t_alg)
                return ERR_PTR(-ENOMEM);
  
-       alg = &t_alg->crypto_alg;
-       *alg = template->alg;
+       t_alg->algt = *template;
+       switch (t_alg->algt.type) {
+       case CRYPTO_ALG_TYPE_ABLKCIPHER:
+               alg = &t_alg->algt.alg.crypto;
+               alg->cra_init = talitos_cra_init;
+               break;
+       case CRYPTO_ALG_TYPE_AEAD:
+               alg = &t_alg->algt.alg.crypto;
+               alg->cra_init = talitos_cra_init_aead;
+               break;
+       case CRYPTO_ALG_TYPE_AHASH:
+               alg = &t_alg->algt.alg.hash.halg.base;
+               alg->cra_init = talitos_cra_init_ahash;
+               if (!(priv->features & TALITOS_FTR_SHA224_HWINIT) &&
+                   !strcmp(alg->cra_name, "sha224")) {
+                       t_alg->algt.alg.hash.init = ahash_init_sha224_swinit;
+                       t_alg->algt.desc_hdr_template =
+                                       DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU |
+                                       DESC_HDR_SEL0_MDEUA |
+                                       DESC_HDR_MODE0_MDEU_SHA256;
+               }
+               break;
+       }
  
        alg->cra_module = THIS_MODULE;
-       alg->cra_init = talitos_cra_init;
        alg->cra_priority = TALITOS_CRA_PRIORITY;
        alg->cra_alignmask = 0;
        alg->cra_ctxsize = sizeof(struct talitos_ctx);
  
-       t_alg->desc_hdr_template = template->desc_hdr_template;
        t_alg->dev = dev;
  
        return t_alg;
@@@ -1807,7 -2398,7 +2398,7 @@@ static int talitos_probe(struct of_devi
                         const struct of_device_id *match)
  {
        struct device *dev = &ofdev->dev;
 -      struct device_node *np = ofdev->node;
 +      struct device_node *np = ofdev->dev.of_node;
        struct talitos_private *priv;
        const unsigned int *prop;
        int i, err;
                priv->features |= TALITOS_FTR_SRC_LINK_TBL_LEN_INCLUDES_EXTENT;
  
        if (of_device_is_compatible(np, "fsl,sec2.1"))
-               priv->features |= TALITOS_FTR_HW_AUTH_CHECK;
+               priv->features |= TALITOS_FTR_HW_AUTH_CHECK |
+                                 TALITOS_FTR_SHA224_HWINIT;
  
        priv->chan = kzalloc(sizeof(struct talitos_channel) *
                             priv->num_channels, GFP_KERNEL);
        for (i = 0; i < ARRAY_SIZE(driver_algs); i++) {
                if (hw_supports(dev, driver_algs[i].desc_hdr_template)) {
                        struct talitos_crypto_alg *t_alg;
+                       char *name = NULL;
  
                        t_alg = talitos_alg_alloc(dev, &driver_algs[i]);
                        if (IS_ERR(t_alg)) {
                                goto err_out;
                        }
  
-                       err = crypto_register_alg(&t_alg->crypto_alg);
+                       switch (t_alg->algt.type) {
+                       case CRYPTO_ALG_TYPE_ABLKCIPHER:
+                       case CRYPTO_ALG_TYPE_AEAD:
+                               err = crypto_register_alg(
+                                               &t_alg->algt.alg.crypto);
+                               name = t_alg->algt.alg.crypto.cra_driver_name;
+                               break;
+                       case CRYPTO_ALG_TYPE_AHASH:
+                               err = crypto_register_ahash(
+                                               &t_alg->algt.alg.hash);
+                               name =
+                                t_alg->algt.alg.hash.halg.base.cra_driver_name;
+                               break;
+                       }
                        if (err) {
                                dev_err(dev, "%s alg registration failed\n",
-                                       t_alg->crypto_alg.cra_driver_name);
+                                       name);
                                kfree(t_alg);
                        } else {
                                list_add_tail(&t_alg->entry, &priv->alg_list);
-                               dev_info(dev, "%s\n",
-                                        t_alg->crypto_alg.cra_driver_name);
+                               dev_info(dev, "%s\n", name);
                        }
                }
        }
@@@ -1968,11 -2573,8 +2573,11 @@@ static const struct of_device_id talito
  MODULE_DEVICE_TABLE(of, talitos_match);
  
  static struct of_platform_driver talitos_driver = {
 -      .name = "talitos",
 -      .match_table = talitos_match,
 +      .driver = {
 +              .name = "talitos",
 +              .owner = THIS_MODULE,
 +              .of_match_table = talitos_match,
 +      },
        .probe = talitos_probe,
        .remove = talitos_remove,
  };
diff --combined drivers/dma/fsldma.c
index c3d74697f5a904aad4d7944f592f0a5a456959cf,1fdf180cbd67d55d1b4264eb3df8fb5cae12f940..8088b14ba5f7fd8077e5b9794754d2a9afa41477
@@@ -775,13 -775,18 +775,18 @@@ fail
        return NULL;
  }
  
- static void fsl_dma_device_terminate_all(struct dma_chan *dchan)
+ static int fsl_dma_device_control(struct dma_chan *dchan,
+                                 enum dma_ctrl_cmd cmd, unsigned long arg)
  {
        struct fsldma_chan *chan;
        unsigned long flags;
  
+       /* Only supports DMA_TERMINATE_ALL */
+       if (cmd != DMA_TERMINATE_ALL)
+               return -ENXIO;
        if (!dchan)
-               return;
+               return -EINVAL;
  
        chan = to_fsl_chan(dchan);
  
        fsldma_free_desc_list(chan, &chan->ld_running);
  
        spin_unlock_irqrestore(&chan->desc_lock, flags);
+       return 0;
  }
  
  /**
@@@ -965,13 -972,12 +972,12 @@@ static void fsl_dma_memcpy_issue_pendin
  }
  
  /**
-  * fsl_dma_is_complete - Determine the DMA status
+  * fsl_tx_status - Determine the DMA status
   * @chan : Freescale DMA channel
   */
- static enum dma_status fsl_dma_is_complete(struct dma_chan *dchan,
+ static enum dma_status fsl_tx_status(struct dma_chan *dchan,
                                        dma_cookie_t cookie,
-                                       dma_cookie_t *done,
-                                       dma_cookie_t *used)
+                                       struct dma_tx_state *txstate)
  {
        struct fsldma_chan *chan = to_fsl_chan(dchan);
        dma_cookie_t last_used;
        last_used = dchan->cookie;
        last_complete = chan->completed_cookie;
  
-       if (done)
-               *done = last_complete;
-       if (used)
-               *used = last_used;
+       dma_set_tx_state(txstate, last_complete, last_used, 0);
  
        return dma_async_is_complete(cookie, last_complete, last_used);
  }
@@@ -1313,7 -1315,7 +1315,7 @@@ static int __devinit fsldma_of_probe(st
        INIT_LIST_HEAD(&fdev->common.channels);
  
        /* ioremap the registers for use */
 -      fdev->regs = of_iomap(op->node, 0);
 +      fdev->regs = of_iomap(op->dev.of_node, 0);
        if (!fdev->regs) {
                dev_err(&op->dev, "unable to ioremap registers\n");
                err = -ENOMEM;
        }
  
        /* map the channel IRQ if it exists, but don't hookup the handler yet */
 -      fdev->irq = irq_of_parse_and_map(op->node, 0);
 +      fdev->irq = irq_of_parse_and_map(op->dev.of_node, 0);
  
        dma_cap_set(DMA_MEMCPY, fdev->common.cap_mask);
        dma_cap_set(DMA_INTERRUPT, fdev->common.cap_mask);
        fdev->common.device_free_chan_resources = fsl_dma_free_chan_resources;
        fdev->common.device_prep_dma_interrupt = fsl_dma_prep_interrupt;
        fdev->common.device_prep_dma_memcpy = fsl_dma_prep_memcpy;
-       fdev->common.device_is_tx_complete = fsl_dma_is_complete;
+       fdev->common.device_tx_status = fsl_tx_status;
        fdev->common.device_issue_pending = fsl_dma_memcpy_issue_pending;
        fdev->common.device_prep_slave_sg = fsl_dma_prep_slave_sg;
-       fdev->common.device_terminate_all = fsl_dma_device_terminate_all;
+       fdev->common.device_control = fsl_dma_device_control;
        fdev->common.dev = &op->dev;
  
        dev_set_drvdata(&op->dev, fdev);
         * of_platform_bus_remove(). Instead, we manually instantiate every DMA
         * channel object.
         */
 -      for_each_child_of_node(op->node, child) {
 +      for_each_child_of_node(op->dev.of_node, child) {
                if (of_device_is_compatible(child, "fsl,eloplus-dma-channel")) {
                        fsl_dma_chan_probe(fdev, child,
                                FSL_DMA_IP_85XX | FSL_DMA_BIG_ENDIAN,
@@@ -1409,13 -1411,10 +1411,13 @@@ static const struct of_device_id fsldma
  };
  
  static struct of_platform_driver fsldma_of_driver = {
 -      .name           = "fsl-elo-dma",
 -      .match_table    = fsldma_of_ids,
 -      .probe          = fsldma_of_probe,
 -      .remove         = fsldma_of_remove,
 +      .driver = {
 +              .name = "fsl-elo-dma",
 +              .owner = THIS_MODULE,
 +              .of_match_table = fsldma_of_ids,
 +      },
 +      .probe = fsldma_of_probe,
 +      .remove = fsldma_of_remove,
  };
  
  /*----------------------------------------------------------------------------*/
index a7b05447e0abe5148b2a3e23c77b749e0b537d9f,c6079fcca13fe58667ff794d63a93f71a5f14666..fa98abe4686fb06598c6f8b318e4866dff1f41be
@@@ -3935,12 -3935,13 +3935,13 @@@ static void ppc440spe_adma_free_chan_re
  }
  
  /**
-  * ppc440spe_adma_is_complete - poll the status of an ADMA transaction
+  * ppc440spe_adma_tx_status - poll the status of an ADMA transaction
   * @chan: ADMA channel handle
   * @cookie: ADMA transaction identifier
+  * @txstate: a holder for the current state of the channel
   */
- static enum dma_status ppc440spe_adma_is_complete(struct dma_chan *chan,
-       dma_cookie_t cookie, dma_cookie_t *done, dma_cookie_t *used)
+ static enum dma_status ppc440spe_adma_tx_status(struct dma_chan *chan,
+                       dma_cookie_t cookie, struct dma_tx_state *txstate)
  {
        struct ppc440spe_adma_chan *ppc440spe_chan;
        dma_cookie_t last_used;
        last_used = chan->cookie;
        last_complete = ppc440spe_chan->completed_cookie;
  
-       if (done)
-               *done = last_complete;
-       if (used)
-               *used = last_used;
+       dma_set_tx_state(txstate, last_complete, last_used, 0);
  
        ret = dma_async_is_complete(cookie, last_complete, last_used);
        if (ret == DMA_SUCCESS)
        last_used = chan->cookie;
        last_complete = ppc440spe_chan->completed_cookie;
  
-       if (done)
-               *done = last_complete;
-       if (used)
-               *used = last_used;
+       dma_set_tx_state(txstate, last_complete, last_used, 0);
  
        return dma_async_is_complete(cookie, last_complete, last_used);
  }
@@@ -4180,7 -4175,7 +4175,7 @@@ static void ppc440spe_adma_init_capabil
                                ppc440spe_adma_alloc_chan_resources;
        adev->common.device_free_chan_resources =
                                ppc440spe_adma_free_chan_resources;
-       adev->common.device_is_tx_complete = ppc440spe_adma_is_complete;
+       adev->common.device_tx_status = ppc440spe_adma_tx_status;
        adev->common.device_issue_pending = ppc440spe_adma_issue_pending;
  
        /* Set prep routines based on capability */
@@@ -4949,12 -4944,12 +4944,12 @@@ static const struct of_device_id ppc440
  MODULE_DEVICE_TABLE(of, ppc440spe_adma_of_match);
  
  static struct of_platform_driver ppc440spe_adma_driver = {
 -      .match_table = ppc440spe_adma_of_match,
        .probe = ppc440spe_adma_probe,
        .remove = __devexit_p(ppc440spe_adma_remove),
        .driver = {
                .name = "PPC440SP(E)-ADMA",
                .owner = THIS_MODULE,
 +              .of_match_table = ppc440spe_adma_of_match,
        },
  };
  
diff --combined drivers/gpio/pca953x.c
index 1db114b0999086b8482f4ff0c9cae94f34eb5ee2,b827c976dc6214cec1d04256182c05861b345294..f156ab3bb6ed24921d6d202e7020fe985f64d43d
@@@ -252,6 -252,18 +252,18 @@@ static void pca953x_irq_bus_lock(unsign
  static void pca953x_irq_bus_sync_unlock(unsigned int irq)
  {
        struct pca953x_chip *chip = get_irq_chip_data(irq);
+       uint16_t new_irqs;
+       uint16_t level;
+       /* Look for any newly setup interrupt */
+       new_irqs = chip->irq_trig_fall | chip->irq_trig_raise;
+       new_irqs &= ~chip->reg_direction;
+       while (new_irqs) {
+               level = __ffs(new_irqs);
+               pca953x_gpio_direction_input(&chip->gpio_chip, level);
+               new_irqs &= ~(1 << level);
+       }
  
        mutex_unlock(&chip->irq_lock);
  }
@@@ -278,7 -290,7 +290,7 @@@ static int pca953x_irq_set_type(unsigne
        else
                chip->irq_trig_raise &= ~mask;
  
-       return pca953x_gpio_direction_input(&chip->gpio_chip, level);
+       return 0;
  }
  
  static struct irq_chip pca953x_irq_chip = {
@@@ -437,7 -449,7 +449,7 @@@ pca953x_get_alt_pdata(struct i2c_clien
        struct device_node *node;
        const uint16_t *val;
  
 -      node = dev_archdata_get_node(&client->dev.archdata);
 +      node = client->dev.of_node;
        if (node == NULL)
                return NULL;
  
index 7637e123414292459846142d49c7f994cc58add2,16948db38973f1866fffe4df07710627b771662c..b02b4533651d8076f522e96923b09b3f3e8b289b
@@@ -440,8 -440,8 +440,8 @@@ static int __devinit cpm_i2c_setup(stru
  
        init_waitqueue_head(&cpm->i2c_wait);
  
 -      cpm->irq = of_irq_to_resource(ofdev->node, 0, NULL);
 +      cpm->irq = of_irq_to_resource(ofdev->dev.of_node, 0, NULL);
-       if (cpm->irq == NO_IRQ)
+       if (!cpm->irq)
                return -EINVAL;
  
        /* Install interrupt handler. */
                return ret;
  
        /* I2C parameter RAM */
 -      i2c_base = of_iomap(ofdev->node, 1);
 +      i2c_base = of_iomap(ofdev->dev.of_node, 1);
        if (i2c_base == NULL) {
                ret = -EINVAL;
                goto out_irq;
        }
  
 -      if (of_device_is_compatible(ofdev->node, "fsl,cpm1-i2c")) {
 +      if (of_device_is_compatible(ofdev->dev.of_node, "fsl,cpm1-i2c")) {
  
                /* Check for and use a microcode relocation patch. */
                cpm->i2c_ram = i2c_base;
  
                cpm->version = 1;
  
 -      } else if (of_device_is_compatible(ofdev->node, "fsl,cpm2-i2c")) {
 +      } else if (of_device_is_compatible(ofdev->dev.of_node, "fsl,cpm2-i2c")) {
                cpm->i2c_addr = cpm_muram_alloc(sizeof(struct i2c_ram), 64);
                cpm->i2c_ram = cpm_muram_addr(cpm->i2c_addr);
                out_be16(i2c_base, cpm->i2c_addr);
        }
  
        /* I2C control/status registers */
 -      cpm->i2c_reg = of_iomap(ofdev->node, 0);
 +      cpm->i2c_reg = of_iomap(ofdev->dev.of_node, 0);
        if (cpm->i2c_reg == NULL) {
                ret = -EINVAL;
                goto out_ram;
        }
  
 -      data = of_get_property(ofdev->node, "fsl,cpm-command", &len);
 +      data = of_get_property(ofdev->dev.of_node, "fsl,cpm-command", &len);
        if (!data || len != 4) {
                ret = -EINVAL;
                goto out_reg;
        }
        cpm->cp_command = *data;
  
 -      data = of_get_property(ofdev->node, "linux,i2c-class", &len);
 +      data = of_get_property(ofdev->dev.of_node, "linux,i2c-class", &len);
        if (data && len == 4)
                cpm->adap.class = *data;
  
 -      data = of_get_property(ofdev->node, "clock-frequency", &len);
 +      data = of_get_property(ofdev->dev.of_node, "clock-frequency", &len);
        if (data && len == 4)
                cpm->freq = *data;
        else
@@@ -661,7 -661,7 +661,7 @@@ static int __devinit cpm_i2c_probe(stru
  
        /* register new adapter to i2c module... */
  
 -      data = of_get_property(ofdev->node, "linux,i2c-index", &len);
 +      data = of_get_property(ofdev->dev.of_node, "linux,i2c-index", &len);
        if (data && len == 4) {
                cpm->adap.nr = *data;
                result = i2c_add_numbered_adapter(&cpm->adap);
        /*
         * register OF I2C devices
         */
 -      of_register_i2c_devices(&cpm->adap, ofdev->node);
 +      of_register_i2c_devices(&cpm->adap, ofdev->dev.of_node);
  
        return 0;
  out_shut:
@@@ -718,13 -718,13 +718,13 @@@ static const struct of_device_id cpm_i2
  MODULE_DEVICE_TABLE(of, cpm_i2c_match);
  
  static struct of_platform_driver cpm_i2c_driver = {
 -      .match_table    = cpm_i2c_match,
        .probe          = cpm_i2c_probe,
        .remove         = __devexit_p(cpm_i2c_remove),
 -      .driver         = {
 -              .name   = "fsl-i2c-cpm",
 -              .owner  = THIS_MODULE,
 -      }
 +      .driver = {
 +              .name = "fsl-i2c-cpm",
 +              .owner = THIS_MODULE,
 +              .of_match_table = cpm_i2c_match,
 +      },
  };
  
  static int __init cpm_i2c_init(void)
index 3876f993fe764e956b928b01b39e3c4eda5c55e1,f8ccc0fe95a83761f0e8c579450f0d542abde641..bf344135647a8654a47c8b343c140e68453f40d5
@@@ -39,7 -39,7 +39,7 @@@
  #include <linux/init.h>
  #include <linux/interrupt.h>
  #include <asm/irq.h>
- #include <asm/io.h>
+ #include <linux/io.h>
  #include <linux/i2c.h>
  #include <linux/i2c-id.h>
  #include <linux/of_platform.h>
@@@ -664,16 -664,16 +664,16 @@@ static inline u8 iic_clckdiv(unsigned i
  static int __devinit iic_request_irq(struct of_device *ofdev,
                                     struct ibm_iic_private *dev)
  {
 -      struct device_node *np = ofdev->node;
 +      struct device_node *np = ofdev->dev.of_node;
        int irq;
  
        if (iic_force_poll)
-               return NO_IRQ;
+               return 0;
  
        irq = irq_of_parse_and_map(np, 0);
-       if (irq == NO_IRQ) {
+       if (!irq) {
                dev_err(&ofdev->dev, "irq_of_parse_and_map failed\n");
-               return NO_IRQ;
+               return 0;
        }
  
        /* Disable interrupts until we finish initialization, assumes
        if (request_irq(irq, iic_handler, 0, "IBM IIC", dev)) {
                dev_err(&ofdev->dev, "request_irq %d failed\n", irq);
                /* Fallback to the polling mode */
-               return NO_IRQ;
+               return 0;
        }
  
        return irq;
  static int __devinit iic_probe(struct of_device *ofdev,
                               const struct of_device_id *match)
  {
 -      struct device_node *np = ofdev->node;
 +      struct device_node *np = ofdev->dev.of_node;
        struct ibm_iic_private *dev;
        struct i2c_adapter *adap;
        const u32 *freq;
        init_waitqueue_head(&dev->wq);
  
        dev->irq = iic_request_irq(ofdev, dev);
-       if (dev->irq == NO_IRQ)
+       if (!dev->irq)
                dev_warn(&ofdev->dev, "using polling mode\n");
  
        /* Board specific settings */
        return 0;
  
  error_cleanup:
-       if (dev->irq != NO_IRQ) {
+       if (dev->irq) {
                iic_interrupt_mode(dev, 0);
                free_irq(dev->irq, dev);
        }
@@@ -790,7 -790,7 +790,7 @@@ static int __devexit iic_remove(struct 
  
        i2c_del_adapter(&dev->adap);
  
-       if (dev->irq != NO_IRQ) {
+       if (dev->irq) {
                iic_interrupt_mode(dev, 0);
                free_irq(dev->irq, dev);
        }
@@@ -807,11 -807,8 +807,11 @@@ static const struct of_device_id ibm_ii
  };
  
  static struct of_platform_driver ibm_iic_driver = {
 -      .name   = "ibm-iic",
 -      .match_table = ibm_iic_match,
 +      .driver = {
 +              .name = "ibm-iic",
 +              .owner = THIS_MODULE,
 +              .of_match_table = ibm_iic_match,
 +      },
        .probe  = iic_probe,
        .remove = __devexit_p(iic_remove),
  };
index 791b71f46f7b2ef293c7d16fd783997c26fcd829,e86cef300c7d694090a15df38cb627e4182d8c61..df00eb1f11f9ee44d3f2d6d8826ff2d15895bee8
@@@ -118,7 -118,7 +118,7 @@@ static int i2c_wait(struct mpc_i2c *i2c
        u32 x;
        int result = 0;
  
-       if (i2c->irq == NO_IRQ) {
+       if (!i2c->irq) {
                while (!(readb(i2c->base + MPC_I2C_SR) & CSR_MIF)) {
                        schedule();
                        if (time_after(jiffies, orig_jiffies + timeout)) {
@@@ -560,15 -560,15 +560,15 @@@ static int __devinit fsl_i2c_probe(stru
  
        init_waitqueue_head(&i2c->queue);
  
 -      i2c->base = of_iomap(op->node, 0);
 +      i2c->base = of_iomap(op->dev.of_node, 0);
        if (!i2c->base) {
                dev_err(i2c->dev, "failed to map controller\n");
                result = -ENOMEM;
                goto fail_map;
        }
  
 -      i2c->irq = irq_of_parse_and_map(op->node, 0);
 +      i2c->irq = irq_of_parse_and_map(op->dev.of_node, 0);
-       if (i2c->irq != NO_IRQ) { /* i2c->irq = NO_IRQ implies polling */
+       if (i2c->irq) { /* no i2c->irq implies polling */
                result = request_irq(i2c->irq, mpc_i2c_isr,
                                     IRQF_SHARED, "i2c-mpc", i2c);
                if (result < 0) {
                }
        }
  
 -      if (of_get_property(op->node, "fsl,preserve-clocking", NULL)) {
 +      if (of_get_property(op->dev.of_node, "fsl,preserve-clocking", NULL)) {
                clock = MPC_I2C_CLOCK_PRESERVE;
        } else {
 -              prop = of_get_property(op->node, "clock-frequency", &plen);
 +              prop = of_get_property(op->dev.of_node, "clock-frequency",
 +                                      &plen);
                if (prop && plen == sizeof(u32))
                        clock = *prop;
        }
  
        if (match->data) {
                struct mpc_i2c_data *data = match->data;
 -              data->setup(op->node, i2c, clock, data->prescaler);
 +              data->setup(op->dev.of_node, i2c, clock, data->prescaler);
        } else {
                /* Backwards compatibility */
 -              if (of_get_property(op->node, "dfsrr", NULL))
 -                      mpc_i2c_setup_8xxx(op->node, i2c, clock, 0);
 +              if (of_get_property(op->dev.of_node, "dfsrr", NULL))
 +                      mpc_i2c_setup_8xxx(op->dev.of_node, i2c, clock, 0);
        }
  
        dev_set_drvdata(&op->dev, i2c);
                dev_err(i2c->dev, "failed to add adapter\n");
                goto fail_add;
        }
 -      of_register_i2c_devices(&i2c->adap, op->node);
 +      of_register_i2c_devices(&i2c->adap, op->dev.of_node);
  
        return result;
  
@@@ -628,7 -627,7 +628,7 @@@ static int __devexit fsl_i2c_remove(str
        i2c_del_adapter(&i2c->adap);
        dev_set_drvdata(&op->dev, NULL);
  
-       if (i2c->irq != NO_IRQ)
+       if (i2c->irq)
                free_irq(i2c->irq, i2c);
  
        irq_dispose_mapping(i2c->irq);
@@@ -675,12 -674,12 +675,12 @@@ MODULE_DEVICE_TABLE(of, mpc_i2c_of_matc
  
  /* Structure for a device driver */
  static struct of_platform_driver mpc_i2c_driver = {
 -      .match_table    = mpc_i2c_of_match,
        .probe          = fsl_i2c_probe,
        .remove         = __devexit_p(fsl_i2c_remove),
 -      .driver         = {
 -              .owner  = THIS_MODULE,
 -              .name   = DRV_NAME,
 +      .driver = {
 +              .owner = THIS_MODULE,
 +              .name = DRV_NAME,
 +              .of_match_table = mpc_i2c_of_match,
        },
  };
  
diff --combined drivers/i2c/i2c-core.c
index 4099b2b8c39254c4205d56e1e513acef65ff2df8,db3c9f3a764796206dac6ea7210da5499fdd1cc3..e0f833cca3f1193c24480c4efc446a7568a9a3af
  #include "i2c-core.h"
  
  
- /* core_lock protects i2c_adapter_idr, userspace_devices, and guarantees
+ /* core_lock protects i2c_adapter_idr, and guarantees
     that device detection, deletion of detected devices, and attach_adapter
     and detach_adapter calls are serialized */
  static DEFINE_MUTEX(core_lock);
  static DEFINE_IDR(i2c_adapter_idr);
- static LIST_HEAD(userspace_devices);
  
  static struct device_type i2c_client_type;
  static int i2c_check_addr(struct i2c_adapter *adapter, int addr);
@@@ -117,8 -116,10 +116,10 @@@ static int i2c_device_probe(struct devi
        dev_dbg(dev, "probe\n");
  
        status = driver->probe(client, i2c_match_id(driver->id_table, client));
-       if (status)
+       if (status) {
                client->driver = NULL;
+               i2c_set_clientdata(client, NULL);
+       }
        return status;
  }
  
@@@ -139,8 -140,10 +140,10 @@@ static int i2c_device_remove(struct dev
                dev->driver = NULL;
                status = 0;
        }
-       if (status == 0)
+       if (status == 0) {
                client->driver = NULL;
+               i2c_set_clientdata(client, NULL);
+       }
        return status;
  }
  
@@@ -156,106 -159,130 +159,130 @@@ static void i2c_device_shutdown(struct 
                driver->shutdown(client);
  }
  
- #ifdef CONFIG_SUSPEND
- static int i2c_device_pm_suspend(struct device *dev)
+ #ifdef CONFIG_PM_SLEEP
+ static int i2c_legacy_suspend(struct device *dev, pm_message_t mesg)
  {
-       const struct dev_pm_ops *pm;
+       struct i2c_client *client = i2c_verify_client(dev);
+       struct i2c_driver *driver;
  
-       if (!dev->driver)
+       if (!client || !dev->driver)
                return 0;
-       pm = dev->driver->pm;
-       if (!pm || !pm->suspend)
+       driver = to_i2c_driver(dev->driver);
+       if (!driver->suspend)
                return 0;
-       return pm->suspend(dev);
+       return driver->suspend(client, mesg);
  }
  
- static int i2c_device_pm_resume(struct device *dev)
+ static int i2c_legacy_resume(struct device *dev)
  {
-       const struct dev_pm_ops *pm;
+       struct i2c_client *client = i2c_verify_client(dev);
+       struct i2c_driver *driver;
  
-       if (!dev->driver)
+       if (!client || !dev->driver)
                return 0;
-       pm = dev->driver->pm;
-       if (!pm || !pm->resume)
+       driver = to_i2c_driver(dev->driver);
+       if (!driver->resume)
                return 0;
-       return pm->resume(dev);
+       return driver->resume(client);
  }
- #else
- #define i2c_device_pm_suspend NULL
- #define i2c_device_pm_resume  NULL
- #endif
  
- #ifdef CONFIG_PM_RUNTIME
- static int i2c_device_runtime_suspend(struct device *dev)
+ static int i2c_device_pm_suspend(struct device *dev)
  {
-       const struct dev_pm_ops *pm;
+       const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
  
-       if (!dev->driver)
-               return 0;
-       pm = dev->driver->pm;
-       if (!pm || !pm->runtime_suspend)
+       if (pm_runtime_suspended(dev))
                return 0;
-       return pm->runtime_suspend(dev);
- }
  
- static int i2c_device_runtime_resume(struct device *dev)
- {
-       const struct dev_pm_ops *pm;
+       if (pm)
+               return pm->suspend ? pm->suspend(dev) : 0;
  
-       if (!dev->driver)
-               return 0;
-       pm = dev->driver->pm;
-       if (!pm || !pm->runtime_resume)
-               return 0;
-       return pm->runtime_resume(dev);
+       return i2c_legacy_suspend(dev, PMSG_SUSPEND);
  }
  
- static int i2c_device_runtime_idle(struct device *dev)
+ static int i2c_device_pm_resume(struct device *dev)
  {
-       const struct dev_pm_ops *pm = NULL;
+       const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
        int ret;
  
-       if (dev->driver)
-               pm = dev->driver->pm;
-       if (pm && pm->runtime_idle) {
-               ret = pm->runtime_idle(dev);
-               if (ret)
-                       return ret;
+       if (pm)
+               ret = pm->resume ? pm->resume(dev) : 0;
+       else
+               ret = i2c_legacy_resume(dev);
+       if (!ret) {
+               pm_runtime_disable(dev);
+               pm_runtime_set_active(dev);
+               pm_runtime_enable(dev);
        }
  
-       return pm_runtime_suspend(dev);
+       return ret;
  }
- #else
- #define i2c_device_runtime_suspend    NULL
- #define i2c_device_runtime_resume     NULL
- #define i2c_device_runtime_idle               NULL
- #endif
  
- static int i2c_device_suspend(struct device *dev, pm_message_t mesg)
+ static int i2c_device_pm_freeze(struct device *dev)
  {
-       struct i2c_client *client = i2c_verify_client(dev);
-       struct i2c_driver *driver;
+       const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
  
-       if (!client || !dev->driver)
+       if (pm_runtime_suspended(dev))
                return 0;
-       driver = to_i2c_driver(dev->driver);
-       if (!driver->suspend)
-               return 0;
-       return driver->suspend(client, mesg);
+       if (pm)
+               return pm->freeze ? pm->freeze(dev) : 0;
+       return i2c_legacy_suspend(dev, PMSG_FREEZE);
  }
  
- static int i2c_device_resume(struct device *dev)
+ static int i2c_device_pm_thaw(struct device *dev)
  {
-       struct i2c_client *client = i2c_verify_client(dev);
-       struct i2c_driver *driver;
+       const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
  
-       if (!client || !dev->driver)
+       if (pm_runtime_suspended(dev))
                return 0;
-       driver = to_i2c_driver(dev->driver);
-       if (!driver->resume)
+       if (pm)
+               return pm->thaw ? pm->thaw(dev) : 0;
+       return i2c_legacy_resume(dev);
+ }
+ static int i2c_device_pm_poweroff(struct device *dev)
+ {
+       const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
+       if (pm_runtime_suspended(dev))
                return 0;
-       return driver->resume(client);
+       if (pm)
+               return pm->poweroff ? pm->poweroff(dev) : 0;
+       return i2c_legacy_suspend(dev, PMSG_HIBERNATE);
+ }
+ static int i2c_device_pm_restore(struct device *dev)
+ {
+       const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
+       int ret;
+       if (pm)
+               ret = pm->restore ? pm->restore(dev) : 0;
+       else
+               ret = i2c_legacy_resume(dev);
+       if (!ret) {
+               pm_runtime_disable(dev);
+               pm_runtime_set_active(dev);
+               pm_runtime_enable(dev);
+       }
+       return ret;
  }
+ #else /* !CONFIG_PM_SLEEP */
+ #define i2c_device_pm_suspend NULL
+ #define i2c_device_pm_resume  NULL
+ #define i2c_device_pm_freeze  NULL
+ #define i2c_device_pm_thaw    NULL
+ #define i2c_device_pm_poweroff        NULL
+ #define i2c_device_pm_restore NULL
+ #endif /* !CONFIG_PM_SLEEP */
  
  static void i2c_client_dev_release(struct device *dev)
  {
@@@ -298,9 -325,15 +325,15 @@@ static const struct attribute_group *i2
  static const struct dev_pm_ops i2c_device_pm_ops = {
        .suspend = i2c_device_pm_suspend,
        .resume = i2c_device_pm_resume,
-       .runtime_suspend = i2c_device_runtime_suspend,
-       .runtime_resume = i2c_device_runtime_resume,
-       .runtime_idle = i2c_device_runtime_idle,
+       .freeze = i2c_device_pm_freeze,
+       .thaw = i2c_device_pm_thaw,
+       .poweroff = i2c_device_pm_poweroff,
+       .restore = i2c_device_pm_restore,
+       SET_RUNTIME_PM_OPS(
+               pm_generic_runtime_suspend,
+               pm_generic_runtime_resume,
+               pm_generic_runtime_idle
+       )
  };
  
  struct bus_type i2c_bus_type = {
        .probe          = i2c_device_probe,
        .remove         = i2c_device_remove,
        .shutdown       = i2c_device_shutdown,
-       .suspend        = i2c_device_suspend,
-       .resume         = i2c_device_resume,
        .pm             = &i2c_device_pm_ops,
  };
  EXPORT_SYMBOL_GPL(i2c_bus_type);
@@@ -387,9 -418,6 +418,9 @@@ i2c_new_device(struct i2c_adapter *adap
        client->dev.parent = &client->adapter->dev;
        client->dev.bus = &i2c_bus_type;
        client->dev.type = &i2c_client_type;
 +#ifdef CONFIG_OF
 +      client->dev.of_node = info->of_node;
 +#endif
  
        dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adap),
                     client->addr);
@@@ -541,9 -569,9 +572,9 @@@ i2c_sysfs_new_device(struct device *dev
                return -EEXIST;
  
        /* Keep track of the added device */
-       mutex_lock(&core_lock);
-       list_add_tail(&client->detected, &userspace_devices);
-       mutex_unlock(&core_lock);
+       i2c_lock_adapter(adap);
+       list_add_tail(&client->detected, &adap->userspace_clients);
+       i2c_unlock_adapter(adap);
        dev_info(dev, "%s: Instantiated device %s at 0x%02hx\n", "new_device",
                 info.type, info.addr);
  
@@@ -582,9 -610,10 +613,10 @@@ i2c_sysfs_delete_device(struct device *
  
        /* Make sure the device was added through sysfs */
        res = -ENOENT;
-       mutex_lock(&core_lock);
-       list_for_each_entry_safe(client, next, &userspace_devices, detected) {
-               if (client->addr == addr && client->adapter == adap) {
+       i2c_lock_adapter(adap);
+       list_for_each_entry_safe(client, next, &adap->userspace_clients,
+                                detected) {
+               if (client->addr == addr) {
                        dev_info(dev, "%s: Deleting device %s at 0x%02hx\n",
                                 "delete_device", client->name, client->addr);
  
                        break;
                }
        }
-       mutex_unlock(&core_lock);
+       i2c_unlock_adapter(adap);
  
        if (res < 0)
                dev_err(dev, "%s: Can't find device in list\n",
@@@ -676,6 -705,7 +708,7 @@@ static int i2c_register_adapter(struct 
        }
  
        rt_mutex_init(&adap->bus_lock);
+       INIT_LIST_HEAD(&adap->userspace_clients);
  
        /* Set default timeout to 1 second if not already set */
        if (adap->timeout == 0)
@@@ -878,14 -908,15 +911,15 @@@ int i2c_del_adapter(struct i2c_adapter 
                return res;
  
        /* Remove devices instantiated from sysfs */
-       list_for_each_entry_safe(client, next, &userspace_devices, detected) {
-               if (client->adapter == adap) {
-                       dev_dbg(&adap->dev, "Removing %s at 0x%x\n",
-                               client->name, client->addr);
-                       list_del(&client->detected);
-                       i2c_unregister_device(client);
-               }
+       i2c_lock_adapter(adap);
+       list_for_each_entry_safe(client, next, &adap->userspace_clients,
+                                detected) {
+               dev_dbg(&adap->dev, "Removing %s at 0x%x\n", client->name,
+                       client->addr);
+               list_del(&client->detected);
+               i2c_unregister_device(client);
        }
+       i2c_unlock_adapter(adap);
  
        /* Detach any active clients. This can't fail, thus we do not
           checking the returned value. */
@@@ -1190,10 -1221,10 +1224,10 @@@ EXPORT_SYMBOL(i2c_transfer)
   *
   * Returns negative errno, or else the number of bytes written.
   */
- int i2c_master_send(struct i2c_client *client,const char *buf ,int count)
+ int i2c_master_send(struct i2c_client *client, const char *buf, int count)
  {
        int ret;
-       struct i2c_adapter *adap=client->adapter;
+       struct i2c_adapter *adap = client->adapter;
        struct i2c_msg msg;
  
        msg.addr = client->addr;
@@@ -1217,9 -1248,9 +1251,9 @@@ EXPORT_SYMBOL(i2c_master_send)
   *
   * Returns negative errno, or else the number of bytes read.
   */
- int i2c_master_recv(struct i2c_client *client, char *buf ,int count)
+ int i2c_master_recv(struct i2c_client *client, char *bufint count)
  {
-       struct i2c_adapter *adap=client->adapter;
+       struct i2c_adapter *adap = client->adapter;
        struct i2c_msg msg;
        int ret;
  
@@@ -1263,12 -1294,23 +1297,23 @@@ static int i2c_detect_address(struct i2
                return 0;
  
        /* Make sure there is something at this address */
-       if (i2c_smbus_xfer(adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL) < 0)
-               return 0;
+       if (addr == 0x73 && (adapter->class & I2C_CLASS_HWMON)) {
+               /* Special probe for FSC hwmon chips */
+               union i2c_smbus_data dummy;
  
-       /* Prevent 24RF08 corruption */
-       if ((addr & ~0x0f) == 0x50)
-               i2c_smbus_xfer(adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL);
+               if (i2c_smbus_xfer(adapter, addr, 0, I2C_SMBUS_READ, 0,
+                                  I2C_SMBUS_BYTE_DATA, &dummy) < 0)
+                       return 0;
+       } else {
+               if (i2c_smbus_xfer(adapter, addr, 0, I2C_SMBUS_WRITE, 0,
+                                  I2C_SMBUS_QUICK, NULL) < 0)
+                       return 0;
+               /* Prevent 24RF08 corruption */
+               if ((addr & ~0x0f) == 0x50)
+                       i2c_smbus_xfer(adapter, addr, 0, I2C_SMBUS_WRITE, 0,
+                                      I2C_SMBUS_QUICK, NULL);
+       }
  
        /* Finally call the custom detection function */
        memset(&info, 0, sizeof(struct i2c_board_info));
@@@ -1410,7 -1452,7 +1455,7 @@@ i2c_new_probed_device(struct i2c_adapte
  }
  EXPORT_SYMBOL_GPL(i2c_new_probed_device);
  
- struct i2c_adapteri2c_get_adapter(int id)
+ struct i2c_adapter *i2c_get_adapter(int id)
  {
        struct i2c_adapter *adapter;
  
@@@ -1437,7 -1479,7 +1482,7 @@@ static u8 crc8(u16 data
  {
        int i;
  
-       for(i = 0; i < 8; i++) {
+       for (i = 0; i < 8; i++) {
                if (data & 0x8000)
                        data = data ^ POLY;
                data = data << 1;
@@@ -1450,7 -1492,7 +1495,7 @@@ static u8 i2c_smbus_pec(u8 crc, u8 *p, 
  {
        int i;
  
-       for(i = 0; i < count; i++)
+       for (i = 0; i < count; i++)
                crc = crc8((crc ^ p[i]) << 8);
        return crc;
  }
@@@ -1520,7 -1562,7 +1565,7 @@@ EXPORT_SYMBOL(i2c_smbus_read_byte)
   */
  s32 i2c_smbus_write_byte(struct i2c_client *client, u8 value)
  {
-       return i2c_smbus_xfer(client->adapter,client->addr,client->flags,
+       return i2c_smbus_xfer(client->adapter, client->addr, client->flags,
                              I2C_SMBUS_WRITE, value, I2C_SMBUS_BYTE, NULL);
  }
  EXPORT_SYMBOL(i2c_smbus_write_byte);
@@@ -1558,9 -1600,9 +1603,9 @@@ s32 i2c_smbus_write_byte_data(struct i2
  {
        union i2c_smbus_data data;
        data.byte = value;
-       return i2c_smbus_xfer(client->adapter,client->addr,client->flags,
-                             I2C_SMBUS_WRITE,command,
-                             I2C_SMBUS_BYTE_DATA,&data);
+       return i2c_smbus_xfer(client->adapter, client->addr, client->flags,
+                             I2C_SMBUS_WRITE, command,
+                             I2C_SMBUS_BYTE_DATA, &data);
  }
  EXPORT_SYMBOL(i2c_smbus_write_byte_data);
  
@@@ -1597,9 -1639,9 +1642,9 @@@ s32 i2c_smbus_write_word_data(struct i2
  {
        union i2c_smbus_data data;
        data.word = value;
-       return i2c_smbus_xfer(client->adapter,client->addr,client->flags,
-                             I2C_SMBUS_WRITE,command,
-                             I2C_SMBUS_WORD_DATA,&data);
+       return i2c_smbus_xfer(client->adapter, client->addr, client->flags,
+                             I2C_SMBUS_WRITE, command,
+                             I2C_SMBUS_WORD_DATA, &data);
  }
  EXPORT_SYMBOL(i2c_smbus_write_word_data);
  
@@@ -1676,9 -1718,9 +1721,9 @@@ s32 i2c_smbus_write_block_data(struct i
                length = I2C_SMBUS_BLOCK_MAX;
        data.block[0] = length;
        memcpy(&data.block[1], values, length);
-       return i2c_smbus_xfer(client->adapter,client->addr,client->flags,
-                             I2C_SMBUS_WRITE,command,
-                             I2C_SMBUS_BLOCK_DATA,&data);
+       return i2c_smbus_xfer(client->adapter, client->addr, client->flags,
+                             I2C_SMBUS_WRITE, command,
+                             I2C_SMBUS_BLOCK_DATA, &data);
  }
  EXPORT_SYMBOL(i2c_smbus_write_block_data);
  
@@@ -1720,10 -1762,10 +1765,10 @@@ EXPORT_SYMBOL(i2c_smbus_write_i2c_block
  
  /* Simulate a SMBus command using the i2c protocol
     No checking of parameters is done!  */
- static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr,
-                                    unsigned short flags,
-                                    char read_write, u8 command, int size,
-                                    union i2c_smbus_data * data)
+ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter *adapter, u16 addr,
+                                  unsigned short flags,
+                                  char read_write, u8 command, int size,
+                                  union i2c_smbus_data *data)
  {
        /* So we need to generate a series of msgs. In the case of writing, we
          need to use only one message; when reading, we need two. We initialize
          simpler. */
        unsigned char msgbuf0[I2C_SMBUS_BLOCK_MAX+3];
        unsigned char msgbuf1[I2C_SMBUS_BLOCK_MAX+2];
-       int num = read_write == I2C_SMBUS_READ?2:1;
+       int num = read_write == I2C_SMBUS_READ ? 2 : 1;
        struct i2c_msg msg[2] = { { addr, flags, 1, msgbuf0 },
                                  { addr, flags | I2C_M_RD, 0, msgbuf1 }
                                };
        int status;
  
        msgbuf0[0] = command;
-       switch(size) {
+       switch (size) {
        case I2C_SMBUS_QUICK:
                msg[0].len = 0;
                /* Special case: The read/write field is used as data */
                if (read_write == I2C_SMBUS_READ)
                        msg[1].len = 2;
                else {
-                       msg[0].len=3;
+                       msg[0].len = 3;
                        msgbuf0[1] = data->word & 0xff;
                        msgbuf0[2] = data->word >> 8;
                }
        }
  
        if (read_write == I2C_SMBUS_READ)
-               switch(size) {
-                       case I2C_SMBUS_BYTE:
-                               data->byte = msgbuf0[0];
-                               break;
-                       case I2C_SMBUS_BYTE_DATA:
-                               data->byte = msgbuf1[0];
-                               break;
-                       case I2C_SMBUS_WORD_DATA:
-                       case I2C_SMBUS_PROC_CALL:
-                               data->word = msgbuf1[0] | (msgbuf1[1] << 8);
-                               break;
-                       case I2C_SMBUS_I2C_BLOCK_DATA:
-                               for (i = 0; i < data->block[0]; i++)
-                                       data->block[i+1] = msgbuf1[i];
-                               break;
-                       case I2C_SMBUS_BLOCK_DATA:
-                       case I2C_SMBUS_BLOCK_PROC_CALL:
-                               for (i = 0; i < msgbuf1[0] + 1; i++)
-                                       data->block[i] = msgbuf1[i];
-                               break;
+               switch (size) {
+               case I2C_SMBUS_BYTE:
+                       data->byte = msgbuf0[0];
+                       break;
+               case I2C_SMBUS_BYTE_DATA:
+                       data->byte = msgbuf1[0];
+                       break;
+               case I2C_SMBUS_WORD_DATA:
+               case I2C_SMBUS_PROC_CALL:
+                       data->word = msgbuf1[0] | (msgbuf1[1] << 8);
+                       break;
+               case I2C_SMBUS_I2C_BLOCK_DATA:
+                       for (i = 0; i < data->block[0]; i++)
+                               data->block[i+1] = msgbuf1[i];
+                       break;
+               case I2C_SMBUS_BLOCK_DATA:
+               case I2C_SMBUS_BLOCK_PROC_CALL:
+                       for (i = 0; i < msgbuf1[0] + 1; i++)
+                               data->block[i] = msgbuf1[i];
+                       break;
                }
        return 0;
  }
@@@ -1924,7 -1966,7 +1969,7 @@@ s32 i2c_smbus_xfer(struct i2c_adapter *
                }
                rt_mutex_unlock(&adapter->bus_lock);
        } else
-               res = i2c_smbus_xfer_emulated(adapter,addr,flags,read_write,
+               res = i2c_smbus_xfer_emulated(adapter, addr, flags, read_write,
                                              command, protocol, data);
  
        return res;
diff --combined drivers/macintosh/smu.c
index ef1f3330a10e82e901d1613fac6fca29cfa5b26e,c9da5c4c167d9ea1dbaa995ceb854acfd6001840..2506c957712e894479e48ced054b5eb4bf532873
@@@ -671,11 -671,8 +671,11 @@@ static const struct of_device_id smu_pl
  
  static struct of_platform_driver smu_of_platform_driver =
  {
 -      .name           = "smu",
 -      .match_table    = smu_platform_match,
 +      .driver = {
 +              .name = "smu",
 +              .owner = THIS_MODULE,
 +              .of_match_table = smu_platform_match,
 +      },
        .probe          = smu_platform_probe,
  };
  
@@@ -1186,8 -1183,10 +1186,10 @@@ static ssize_t smu_read_command(struct 
                return -EOVERFLOW;
        spin_lock_irqsave(&pp->lock, flags);
        if (pp->cmd.status == 1) {
-               if (file->f_flags & O_NONBLOCK)
+               if (file->f_flags & O_NONBLOCK) {
+                       spin_unlock_irqrestore(&pp->lock, flags);
                        return -EAGAIN;
+               }
                add_wait_queue(&pp->wait, &wait);
                for (;;) {
                        set_current_state(TASK_INTERRUPTIBLE);
index 4147fe328c556e7915fb46df7988d7d9a2ff2393,36dbcee1ac29aa8c67416b7041cb08d1550e15cf..ba124baa646d7af1fe54cf958d2e26c2af5a00d9
@@@ -143,7 -143,7 +143,7 @@@ static int of_flash_remove(struct of_de
  static struct mtd_info * __devinit obsolete_probe(struct of_device *dev,
                                                  struct map_info *map)
  {
 -      struct device_node *dp = dev->node;
 +      struct device_node *dp = dev->dev.of_node;
        const char *of_probe;
        struct mtd_info *mtd;
        static const char *rom_probe_types[]
        }
  }
  
+ #ifdef CONFIG_MTD_PARTITIONS
+ /* When partitions are set we look for a linux,part-probe property which
+    specifies the list of partition probers to use. If none is given then the
+    default is use. These take precedence over other device tree
+    information. */
+ static const char *part_probe_types_def[] = { "cmdlinepart", "RedBoot", NULL };
+ static const char ** __devinit of_get_probes(struct device_node *dp)
+ {
+       const char *cp;
+       int cplen;
+       unsigned int l;
+       unsigned int count;
+       const char **res;
+       cp = of_get_property(dp, "linux,part-probe", &cplen);
+       if (cp == NULL)
+               return part_probe_types_def;
+       count = 0;
+       for (l = 0; l != cplen; l++)
+               if (cp[l] == 0)
+                       count++;
+       res = kzalloc((count + 1)*sizeof(*res), GFP_KERNEL);
+       count = 0;
+       while (cplen > 0) {
+               res[count] = cp;
+               l = strlen(cp) + 1;
+               cp += l;
+               cplen -= l;
+               count++;
+       }
+       return res;
+ }
+ static void __devinit of_free_probes(const char **probes)
+ {
+       if (probes != part_probe_types_def)
+               kfree(probes);
+ }
+ #endif
  static int __devinit of_flash_probe(struct of_device *dev,
                                    const struct of_device_id *match)
  {
  #ifdef CONFIG_MTD_PARTITIONS
-       static const char *part_probe_types[]
-               = { "cmdlinepart", "RedBoot", NULL };
+       const char **part_probe_types;
  #endif
 -      struct device_node *dp = dev->node;
 +      struct device_node *dp = dev->dev.of_node;
        struct resource res;
        struct of_flash *info;
        const char *probe_type = match->data;
        p = of_get_property(dp, "reg", &count);
        if (count % reg_tuple_size != 0) {
                dev_err(&dev->dev, "Malformed reg property on %s\n",
 -                              dev->node->full_name);
 +                              dev->dev.of_node->full_name);
                err = -EINVAL;
                goto err_flash_remove;
        }
  
        dev_set_drvdata(&dev->dev, info);
  
-       mtd_list = kzalloc(sizeof(struct mtd_info) * count, GFP_KERNEL);
+       mtd_list = kzalloc(sizeof(*mtd_list) * count, GFP_KERNEL);
        if (!mtd_list)
                goto err_flash_remove;
  
                goto err_out;
  
  #ifdef CONFIG_MTD_PARTITIONS
-       /* First look for RedBoot table or partitions on the command
-        * line, these take precedence over device tree information */
+       part_probe_types = of_get_probes(dp);
        err = parse_mtd_partitions(info->cmtd, part_probe_types,
                                   &info->parts, 0);
-       if (err < 0)
+       if (err < 0) {
+               of_free_probes(part_probe_types);
                return err;
+       }
+       of_free_probes(part_probe_types);
  
  #ifdef CONFIG_MTD_OF_PARTS
        if (err == 0) {
@@@ -375,11 -418,8 +418,11 @@@ static struct of_device_id of_flash_mat
  MODULE_DEVICE_TABLE(of, of_flash_match);
  
  static struct of_platform_driver of_flash_driver = {
 -      .name           = "of-flash",
 -      .match_table    = of_flash_match,
 +      .driver = {
 +              .name = "of-flash",
 +              .owner = THIS_MODULE,
 +              .of_match_table = of_flash_match,
 +      },
        .probe          = of_flash_probe,
        .remove         = of_flash_remove,
  };
index f45a8d0c1508640e26f6bce6480029778d81d39c,3f38fb8e66668c37f36a86d29fb7c08766e752e6..5084cc51794421c10eb2067dc151a22511b12968
@@@ -874,7 -874,7 +874,7 @@@ static int __devinit fsl_elbc_chip_prob
        priv->ctrl = ctrl;
        priv->dev = ctrl->dev;
  
-       priv->vbase = ioremap(res.start, res.end - res.start + 1);
+       priv->vbase = ioremap(res.start, resource_size(&res));
        if (!priv->vbase) {
                dev_err(ctrl->dev, "failed to map chip region\n");
                ret = -ENOMEM;
        if (ret)
                goto err;
  
-       ret = nand_scan_ident(&priv->mtd, 1);
+       ret = nand_scan_ident(&priv->mtd, 1, NULL);
        if (ret)
                goto err;
  
@@@ -1030,14 -1030,14 +1030,14 @@@ static int __devinit fsl_elbc_ctrl_prob
        init_waitqueue_head(&ctrl->controller.wq);
        init_waitqueue_head(&ctrl->irq_wait);
  
 -      ctrl->regs = of_iomap(ofdev->node, 0);
 +      ctrl->regs = of_iomap(ofdev->dev.of_node, 0);
        if (!ctrl->regs) {
                dev_err(&ofdev->dev, "failed to get memory region\n");
                ret = -ENODEV;
                goto err;
        }
  
 -      ctrl->irq = of_irq_to_resource(ofdev->node, 0, NULL);
 +      ctrl->irq = of_irq_to_resource(ofdev->dev.of_node, 0, NULL);
        if (ctrl->irq == NO_IRQ) {
                dev_err(&ofdev->dev, "failed to get irq resource\n");
                ret = -ENODEV;
                goto err;
        }
  
 -      for_each_child_of_node(ofdev->node, child)
 +      for_each_child_of_node(ofdev->dev.of_node, child)
                if (of_device_is_compatible(child, "fsl,elbc-fcm-nand"))
                        fsl_elbc_chip_probe(ctrl, child);
  
@@@ -1078,10 -1078,9 +1078,10 @@@ static const struct of_device_id fsl_el
  
  static struct of_platform_driver fsl_elbc_ctrl_driver = {
        .driver = {
 -              .name   = "fsl-elbc",
 +              .name = "fsl-elbc",
 +              .owner = THIS_MODULE,
 +              .of_match_table = fsl_elbc_match,
        },
 -      .match_table = fsl_elbc_match,
        .probe = fsl_elbc_ctrl_probe,
        .remove = fsl_elbc_ctrl_remove,
  };
index b7ab5a0ec35d4d3db7515de2985d1bc73ccc8882,2d215ccb564d7961ac7c502900a72265b777d4c8..00aea6f7d1f1bc6bbf8bfae8080bce0b01c633e7
@@@ -49,7 -49,10 +49,10 @@@ struct fsl_upm_nand 
        uint32_t wait_flags;
  };
  
- #define to_fsl_upm_nand(mtd) container_of(mtd, struct fsl_upm_nand, mtd)
+ static inline struct fsl_upm_nand *to_fsl_upm_nand(struct mtd_info *mtdinfo)
+ {
+       return container_of(mtdinfo, struct fsl_upm_nand, mtd);
+ }
  
  static int fun_chip_ready(struct mtd_info *mtd)
  {
@@@ -303,7 -306,7 +306,7 @@@ static int __devinit fun_probe(struct o
                                  FSL_UPM_WAIT_WRITE_BYTE;
  
        fun->io_base = devm_ioremap_nocache(&ofdev->dev, io_res.start,
-                                           io_res.end - io_res.start + 1);
+                                           resource_size(&io_res));
        if (!fun->io_base) {
                ret = -ENOMEM;
                goto err2;
@@@ -350,18 -353,15 +353,18 @@@ static int __devexit fun_remove(struct 
        return 0;
  }
  
- static struct of_device_id of_fun_match[] = {
+ static const struct of_device_id of_fun_match[] = {
        { .compatible = "fsl,upm-nand" },
        {},
  };
  MODULE_DEVICE_TABLE(of, of_fun_match);
  
  static struct of_platform_driver of_fun_driver = {
 -      .name           = "fsl,upm-nand",
 -      .match_table    = of_fun_match,
 +      .driver = {
 +              .name = "fsl,upm-nand",
 +              .owner = THIS_MODULE,
 +              .of_match_table = of_fun_match,
 +      },
        .probe          = fun_probe,
        .remove         = __devexit_p(fun_remove),
  };
index a97e9c95ab6a94427ee6d55cf03204ede1dd7a70,090a05c12cbe0db0c67659a0abb39354aa0e11ff..f02af24d033a73341b7490acec7f2255e8ed67c9
@@@ -93,7 -93,7 +93,7 @@@ static int __devinit pasemi_nand_probe(
                                      const struct of_device_id *match)
  {
        struct pci_dev *pdev;
 -      struct device_node *np = ofdev->node;
 +      struct device_node *np = ofdev->dev.of_node;
        struct resource res;
        struct nand_chip *chip;
        int err = 0;
@@@ -209,7 -209,7 +209,7 @@@ static int __devexit pasemi_nand_remove
        return 0;
  }
  
- static struct of_device_id pasemi_nand_match[] =
+ static const struct of_device_id pasemi_nand_match[] =
  {
        {
                .compatible   = "pasemi,localbus-nand",
@@@ -221,11 -221,8 +221,11 @@@ MODULE_DEVICE_TABLE(of, pasemi_nand_mat
  
  static struct of_platform_driver pasemi_nand_driver =
  {
 -      .name           = (char*)driver_name,
 -      .match_table    = pasemi_nand_match,
 +      .driver = {
 +              .name = (char*)driver_name,
 +              .owner = THIS_MODULE,
 +              .of_match_table = pasemi_nand_match,
 +      },
        .probe          = pasemi_nand_probe,
        .remove         = pasemi_nand_remove,
  };
index edb9b138414343fdf4fbe98709e06a093c402e79,b37cbde6e7dbfb0981b00d6934fdd397023020d1..884852dc7eb44b29d1788fb43db7c3f6846c6936
@@@ -220,7 -220,7 +220,7 @@@ static int __devinit socrates_nand_prob
        dev_set_drvdata(&ofdev->dev, host);
  
        /* first scan to find the device and get the page size */
-       if (nand_scan_ident(mtd, 1)) {
+       if (nand_scan_ident(mtd, 1, NULL)) {
                res = -ENXIO;
                goto out;
        }
@@@ -290,7 -290,7 +290,7 @@@ static int __devexit socrates_nand_remo
        return 0;
  }
  
- static struct of_device_id socrates_nand_match[] =
+ static const struct of_device_id socrates_nand_match[] =
  {
        {
                .compatible   = "abb,socrates-nand",
  MODULE_DEVICE_TABLE(of, socrates_nand_match);
  
  static struct of_platform_driver socrates_nand_driver = {
 -      .name           = "socrates_nand",
 -      .match_table    = socrates_nand_match,
 +      .driver = {
 +              .name = "socrates_nand",
 +              .owner = THIS_MODULE,
 +              .of_match_table = socrates_nand_match,
 +      },
        .probe          = socrates_nand_probe,
        .remove         = __devexit_p(socrates_nand_remove),
  };
index 2120784f8db4574a7613521bffa97c86cea38233,225fd147774aa1f8c37ea452f46d1e558a317316..8af8442c694a69c2e4e5dea49ebcd7d13a4e92de
@@@ -25,7 -25,6 +25,6 @@@
  #include <linux/interrupt.h>
  #include <linux/platform_device.h>
  #include <linux/netdevice.h>
- #include <linux/can.h>
  #include <linux/can/dev.h>
  #include <linux/of_platform.h>
  #include <sysdev/fsl_soc.h>
@@@ -393,17 -392,15 +392,17 @@@ static struct of_device_id __devinitdat
  };
  
  static struct of_platform_driver mpc5xxx_can_driver = {
 -      .owner = THIS_MODULE,
 -      .name = "mpc5xxx_can",
 +      .driver = {
 +              .name = "mpc5xxx_can",
 +              .owner = THIS_MODULE,
 +              .of_match_table = mpc5xxx_can_table,
 +      },
        .probe = mpc5xxx_can_probe,
        .remove = __devexit_p(mpc5xxx_can_remove),
  #ifdef CONFIG_PM
        .suspend = mpc5xxx_can_suspend,
        .resume = mpc5xxx_can_resume,
  #endif
 -      .match_table = mpc5xxx_can_table,
  };
  
  static int __init mpc5xxx_can_init(void)
index 158b76ebf3eaf527e20ae861b8cdef32d8041a23,34e79efbd2fca7413924a8e47abde8b47baa82bb..ac1a83d7c2044fdd20c5b42063de62231b7d2725
@@@ -38,7 -38,6 +38,6 @@@
  #include <linux/interrupt.h>
  #include <linux/netdevice.h>
  #include <linux/delay.h>
- #include <linux/can.h>
  #include <linux/can/dev.h>
  
  #include <linux/of_platform.h>
@@@ -72,7 -71,7 +71,7 @@@ static int __devexit sja1000_ofp_remove
  {
        struct net_device *dev = dev_get_drvdata(&ofdev->dev);
        struct sja1000_priv *priv = netdev_priv(dev);
 -      struct device_node *np = ofdev->node;
 +      struct device_node *np = ofdev->dev.of_node;
        struct resource res;
  
        dev_set_drvdata(&ofdev->dev, NULL);
@@@ -91,7 -90,7 +90,7 @@@
  static int __devinit sja1000_ofp_probe(struct of_device *ofdev,
                                       const struct of_device_id *id)
  {
 -      struct device_node *np = ofdev->node;
 +      struct device_node *np = ofdev->dev.of_node;
        struct net_device *dev;
        struct sja1000_priv *priv;
        struct resource res;
@@@ -216,13 -215,11 +215,13 @@@ static struct of_device_id __devinitdat
  MODULE_DEVICE_TABLE(of, sja1000_ofp_table);
  
  static struct of_platform_driver sja1000_ofp_driver = {
 -      .owner = THIS_MODULE,
 -      .name = DRV_NAME,
 +      .driver = {
 +              .owner = THIS_MODULE,
 +              .name = DRV_NAME,
 +              .of_match_table = sja1000_ofp_table,
 +      },
        .probe = sja1000_ofp_probe,
        .remove = __devexit_p(sja1000_ofp_remove),
 -      .match_table = sja1000_ofp_table,
  };
  
  static int __init sja1000_ofp_init(void)
index b23173864c60e9c25c2268a071a09e30ba842627,02698a1c80b057a4f57eba4e5e72f40c2c7da293..f547894ff48fc3a02317548dafe8ec900e5044e2
@@@ -122,11 -122,8 +122,11 @@@ static struct of_device_id ehea_device_
  MODULE_DEVICE_TABLE(of, ehea_device_table);
  
  static struct of_platform_driver ehea_driver = {
 -      .name = "ehea",
 -      .match_table = ehea_device_table,
 +      .driver = {
 +              .name = "ehea",
 +              .owner = THIS_MODULE,
 +              .of_match_table = ehea_device_table,
 +      },
        .probe = ehea_probe_adapter,
        .remove = ehea_remove,
  };
@@@ -794,11 -791,17 +794,17 @@@ static struct ehea_cqe *ehea_proc_cqes(
                cqe_counter++;
                rmb();
                if (cqe->status & EHEA_CQE_STAT_ERR_MASK) {
-                       ehea_error("Send Completion Error: Resetting port");
+                       ehea_error("Bad send completion status=0x%04X",
+                                  cqe->status);
                        if (netif_msg_tx_err(pr->port))
                                ehea_dump(cqe, sizeof(*cqe), "Send CQE");
-                       ehea_schedule_port_reset(pr->port);
-                       break;
+                       if (cqe->status & EHEA_CQE_STAT_RESET_MASK) {
+                               ehea_error("Resetting port");
+                               ehea_schedule_port_reset(pr->port);
+                               break;
+                       }
                }
  
                if (netif_msg_tx_done(pr->port))
                quota--;
  
                cqe = ehea_poll_cq(send_cq);
-       };
+       }
  
        ehea_update_feca(send_cq, cqe_counter);
        atomic_add(swqe_av, &pr->swqe_avail);
@@@ -904,6 -907,8 +910,8 @@@ static irqreturn_t ehea_qp_aff_irq_hand
        struct ehea_eqe *eqe;
        struct ehea_qp *qp;
        u32 qp_token;
+       u64 resource_type, aer, aerr;
+       int reset_port = 0;
  
        eqe = ehea_poll_eq(port->qp_eq);
  
                           eqe->entry, qp_token);
  
                qp = port->port_res[qp_token].qp;
-               ehea_error_data(port->adapter, qp->fw_handle);
+               resource_type = ehea_error_data(port->adapter, qp->fw_handle,
+                                               &aer, &aerr);
+               if (resource_type == EHEA_AER_RESTYPE_QP) {
+                       if ((aer & EHEA_AER_RESET_MASK) ||
+                           (aerr & EHEA_AERR_RESET_MASK))
+                                reset_port = 1;
+               } else
+                       reset_port = 1;   /* Reset in case of CQ or EQ error */
                eqe = ehea_poll_eq(port->qp_eq);
        }
  
-       ehea_schedule_port_reset(port);
+       if (reset_port) {
+               ehea_error("Resetting port");
+               ehea_schedule_port_reset(port);
+       }
  
        return IRQ_HANDLED;
  }
@@@ -1621,7 -1639,7 +1642,7 @@@ static void write_swqe2_TSO(struct sk_b
  {
        struct ehea_vsgentry *sg1entry = &swqe->u.immdata_desc.sg_entry;
        u8 *imm_data = &swqe->u.immdata_desc.immediate_data[0];
-       int skb_data_size = skb->len - skb->data_len;
+       int skb_data_size = skb_headlen(skb);
        int headersize;
  
        /* Packet is TCP with TSO enabled */
         */
        headersize = ETH_HLEN + ip_hdrlen(skb) + tcp_hdrlen(skb);
  
-       skb_data_size = skb->len - skb->data_len;
+       skb_data_size = skb_headlen(skb);
  
        if (skb_data_size >= headersize) {
                /* copy immediate data */
  static void write_swqe2_nonTSO(struct sk_buff *skb,
                               struct ehea_swqe *swqe, u32 lkey)
  {
-       int skb_data_size = skb->len - skb->data_len;
+       int skb_data_size = skb_headlen(skb);
        u8 *imm_data = &swqe->u.immdata_desc.immediate_data[0];
        struct ehea_vsgentry *sg1entry = &swqe->u.immdata_desc.sg_entry;
  
@@@ -1863,7 -1881,6 +1884,6 @@@ static void ehea_promiscuous(struct net
        port->promisc = enable;
  out:
        free_page((unsigned long)cb7);
-       return;
  }
  
  static u64 ehea_multicast_reg_helper(struct ehea_port *port, u64 mc_mac_addr,
@@@ -1970,7 -1987,7 +1990,7 @@@ static void ehea_add_multicast_entry(st
  static void ehea_set_multicast_list(struct net_device *dev)
  {
        struct ehea_port *port = netdev_priv(dev);
-       struct dev_mc_list *k_mcl_entry;
+       struct netdev_hw_addr *ha;
        int ret;
  
        if (dev->flags & IFF_PROMISC) {
                        goto out;
                }
  
-               netdev_for_each_mc_addr(k_mcl_entry, dev)
-                       ehea_add_multicast_entry(port, k_mcl_entry->dmi_addr);
+               netdev_for_each_mc_addr(ha, dev)
+                       ehea_add_multicast_entry(port, ha->addr);
  
        }
  out:
        ehea_update_bcmc_registrations();
-       return;
  }
  
  static int ehea_change_mtu(struct net_device *dev, int new_mtu)
@@@ -2111,8 -2127,8 +2130,8 @@@ static void ehea_xmit3(struct sk_buff *
        } else {
                /* first copy data from the skb->data buffer ... */
                skb_copy_from_linear_data(skb, imm_data,
-                                         skb->len - skb->data_len);
-               imm_data += skb->len - skb->data_len;
+                                         skb_headlen(skb));
+               imm_data += skb_headlen(skb);
  
                /* ... then copy data from the fragments */
                for (i = 0; i < nfrags; i++) {
@@@ -2223,7 -2239,7 +2242,7 @@@ static int ehea_start_xmit(struct sk_bu
                }
                spin_unlock_irqrestore(&pr->netif_queue, flags);
        }
-       dev->trans_start = jiffies;
+       dev->trans_start = jiffies; /* NETIF_F_LLTX driver :( */
        spin_unlock(&pr->xmit_lock);
  
        return NETDEV_TX_OK;
@@@ -2320,7 -2336,6 +2339,6 @@@ static void ehea_vlan_rx_kill_vid(struc
                ehea_error("modify_ehea_port failed");
  out:
        free_page((unsigned long)cb1);
-       return;
  }
  
  int ehea_activate_qp(struct ehea_adapter *adapter, struct ehea_qp *qp)
@@@ -2863,7 -2878,6 +2881,6 @@@ static void ehea_reset_port(struct work
        netif_wake_queue(dev);
  out:
        mutex_unlock(&port->port_lock);
-       return;
  }
  
  static void ehea_rereg_mrs(struct work_struct *work)
        int ret, i;
        struct ehea_adapter *adapter;
  
-       mutex_lock(&dlpar_mem_lock);
        ehea_info("LPAR memory changed - re-initializing driver");
  
        list_for_each_entry(adapter, &adapter_list, list)
                }
        ehea_info("re-initializing driver complete");
  out:
-       mutex_unlock(&dlpar_mem_lock);
        return;
  }
  
@@@ -3038,7 -3050,7 +3053,7 @@@ static DEVICE_ATTR(log_port_id, S_IRUS
  static void __devinit logical_port_release(struct device *dev)
  {
        struct ehea_port *port = container_of(dev, struct ehea_port, ofdev.dev);
 -      of_node_put(port->ofdev.node);
 +      of_node_put(port->ofdev.dev.of_node);
  }
  
  static struct device *ehea_register_port(struct ehea_port *port,
  {
        int ret;
  
 -      port->ofdev.node = of_node_get(dn);
 +      port->ofdev.dev.of_node = of_node_get(dn);
        port->ofdev.dev.parent = &port->adapter->ofdev->dev;
        port->ofdev.dev.bus = &ibmebus_bus_type;
  
@@@ -3213,7 -3225,7 +3228,7 @@@ static int ehea_setup_ports(struct ehea
        const u32 *dn_log_port_id;
        int i = 0;
  
 -      lhea_dn = adapter->ofdev->node;
 +      lhea_dn = adapter->ofdev->dev.of_node;
        while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) {
  
                dn_log_port_id = of_get_property(eth_dn, "ibm,hea-port-no",
                        ehea_remove_adapter_mr(adapter);
  
                i++;
-       };
+       }
        return 0;
  }
  
@@@ -3252,7 -3264,7 +3267,7 @@@ static struct device_node *ehea_get_eth
        struct device_node *eth_dn = NULL;
        const u32 *dn_log_port_id;
  
 -      lhea_dn = adapter->ofdev->node;
 +      lhea_dn = adapter->ofdev->dev.of_node;
        while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) {
  
                dn_log_port_id = of_get_property(eth_dn, "ibm,hea-port-no",
                if (dn_log_port_id)
                        if (*dn_log_port_id == logical_port_id)
                                return eth_dn;
-       };
+       }
  
        return NULL;
  }
@@@ -3382,7 -3394,7 +3397,7 @@@ static int __devinit ehea_probe_adapter
        const u64 *adapter_handle;
        int ret;
  
 -      if (!dev || !dev->node) {
 +      if (!dev || !dev->dev.of_node) {
                ehea_error("Invalid ibmebus device probed");
                return -EINVAL;
        }
  
        adapter->ofdev = dev;
  
 -      adapter_handle = of_get_property(dev->node, "ibm,hea-handle",
 +      adapter_handle = of_get_property(dev->dev.of_node, "ibm,hea-handle",
                                         NULL);
        if (adapter_handle)
                adapter->handle = *adapter_handle;
  
        if (!adapter->handle) {
                dev_err(&dev->dev, "failed getting handle for adapter"
 -                      " '%s'\n", dev->node->full_name);
 +                      " '%s'\n", dev->dev.of_node->full_name);
                ret = -ENODEV;
                goto out_free_ad;
        }
@@@ -3524,7 -3536,14 +3539,14 @@@ void ehea_crash_handler(void
  static int ehea_mem_notifier(struct notifier_block *nb,
                               unsigned long action, void *data)
  {
+       int ret = NOTIFY_BAD;
        struct memory_notify *arg = data;
+       if (!mutex_trylock(&dlpar_mem_lock)) {
+               ehea_info("ehea_mem_notifier must not be called parallelized");
+               goto out;
+       }
        switch (action) {
        case MEM_CANCEL_OFFLINE:
                ehea_info("memory offlining canceled");
                ehea_info("memory is going online");
                set_bit(__EHEA_STOP_XFER, &ehea_driver_flags);
                if (ehea_add_sect_bmap(arg->start_pfn, arg->nr_pages))
-                       return NOTIFY_BAD;
+                       goto out_unlock;
                ehea_rereg_mrs(NULL);
                break;
        case MEM_GOING_OFFLINE:
                ehea_info("memory is going offline");
                set_bit(__EHEA_STOP_XFER, &ehea_driver_flags);
                if (ehea_rem_sect_bmap(arg->start_pfn, arg->nr_pages))
-                       return NOTIFY_BAD;
+                       goto out_unlock;
                ehea_rereg_mrs(NULL);
                break;
        default:
        }
  
        ehea_update_firmware_handles();
+       ret = NOTIFY_OK;
  
-       return NOTIFY_OK;
+ out_unlock:
+       mutex_unlock(&dlpar_mem_lock);
+ out:
+       return ret;
  }
  
  static struct notifier_block ehea_mem_nb = {
index be540b67ea57d3a3fb698c55d772d86f6c2a9f20,221f440c10f4b59c49232283dae0fbbd48920856..25e6cc6840b1ecf1993630d2f1b5acf19a3675b6
@@@ -327,7 -327,6 +327,6 @@@ static int mpc52xx_fec_start_xmit(struc
        }
  
        spin_lock_irqsave(&priv->lock, flags);
-       dev->trans_start = jiffies;
  
        bd = (struct bcom_fec_bd *)
                bcom_prepare_next_buffer(priv->tx_dmatsk);
@@@ -436,7 -435,6 +435,6 @@@ static irqreturn_t mpc52xx_fec_rx_inter
                                 DMA_FROM_DEVICE);
                length = status & BCOM_FEC_RX_BD_LEN_MASK;
                skb_put(rskb, length - 4);      /* length without CRC32 */
-               rskb->dev = dev;
                rskb->protocol = eth_type_trans(rskb, dev);
                netif_rx(rskb);
  
@@@ -576,12 -574,12 +574,12 @@@ static void mpc52xx_fec_set_multicast_l
                        out_be32(&fec->gaddr2, 0xffffffff);
                } else {
                        u32 crc;
-                       struct dev_mc_list *dmi;
+                       struct netdev_hw_addr *ha;
                        u32 gaddr1 = 0x00000000;
                        u32 gaddr2 = 0x00000000;
  
-                       netdev_for_each_mc_addr(dmi, dev) {
-                               crc = ether_crc_le(6, dmi->dmi_addr) >> 26;
+                       netdev_for_each_mc_addr(ha, dev) {
+                               crc = ether_crc_le(6, ha->addr) >> 26;
                                if (crc >= 32)
                                        gaddr1 |= 1 << (crc-32);
                                else
@@@ -873,7 -871,7 +871,7 @@@ mpc52xx_fec_probe(struct of_device *op
        priv->ndev = ndev;
  
        /* Reserve FEC control zone */
 -      rv = of_address_to_resource(op->node, 0, &mem);
 +      rv = of_address_to_resource(op->dev.of_node, 0, &mem);
        if (rv) {
                printk(KERN_ERR DRIVER_NAME ": "
                                "Error while parsing device node resource\n" );
  
        /* Get the IRQ we need one by one */
                /* Control */
 -      ndev->irq = irq_of_parse_and_map(op->node, 0);
 +      ndev->irq = irq_of_parse_and_map(op->dev.of_node, 0);
  
                /* RX */
        priv->r_irq = bcom_get_task_irq(priv->rx_dmatsk);
        /* Start with safe defaults for link connection */
        priv->speed = 100;
        priv->duplex = DUPLEX_HALF;
 -      priv->mdio_speed = ((mpc5xxx_get_bus_frequency(op->node) >> 20) / 5) << 1;
 +      priv->mdio_speed = ((mpc5xxx_get_bus_frequency(op->dev.of_node) >> 20) / 5) << 1;
  
        /* The current speed preconfigures the speed of the MII link */
 -      prop = of_get_property(op->node, "current-speed", &prop_size);
 +      prop = of_get_property(op->dev.of_node, "current-speed", &prop_size);
        if (prop && (prop_size >= sizeof(u32) * 2)) {
                priv->speed = prop[0];
                priv->duplex = prop[1] ? DUPLEX_FULL : DUPLEX_HALF;
        }
  
        /* If there is a phy handle, then get the PHY node */
 -      priv->phy_node = of_parse_phandle(op->node, "phy-handle", 0);
 +      priv->phy_node = of_parse_phandle(op->dev.of_node, "phy-handle", 0);
  
        /* the 7-wire property means don't use MII mode */
 -      if (of_find_property(op->node, "fsl,7-wire-mode", NULL)) {
 +      if (of_find_property(op->dev.of_node, "fsl,7-wire-mode", NULL)) {
                priv->seven_wire_mode = 1;
                dev_info(&ndev->dev, "using 7-wire PHY mode\n");
        }
@@@ -1065,11 -1063,9 +1063,11 @@@ static struct of_device_id mpc52xx_fec_
  MODULE_DEVICE_TABLE(of, mpc52xx_fec_match);
  
  static struct of_platform_driver mpc52xx_fec_driver = {
 -      .owner          = THIS_MODULE,
 -      .name           = DRIVER_NAME,
 -      .match_table    = mpc52xx_fec_match,
 +      .driver = {
 +              .name = DRIVER_NAME,
 +              .owner = THIS_MODULE,
 +              .of_match_table = mpc52xx_fec_match,
 +      },
        .probe          = mpc52xx_fec_probe,
        .remove         = mpc52xx_fec_remove,
  #ifdef CONFIG_PM
index cae2d16858d19fd4f82dd5cc23a0f0f99872e160,0fb0fefcb7874f5ba159be21a73db0fb3d710523..309a0eaddd815739d33c196d94ce3aad770cec34
@@@ -674,8 -674,6 +674,6 @@@ static int fs_enet_start_xmit(struct sk
                                skb->data, skb->len, DMA_TO_DEVICE));
        CBDW_DATLEN(bdp, skb->len);
  
-       dev->trans_start = jiffies;
        /*
         * If this was the last BD in the ring, start at the beginning again.
         */
@@@ -1015,7 -1013,7 +1013,7 @@@ static int __devinit fs_enet_probe(stru
                return -ENOMEM;
  
        if (!IS_FEC(match)) {
 -              data = of_get_property(ofdev->node, "fsl,cpm-command", &len);
 +              data = of_get_property(ofdev->dev.of_node, "fsl,cpm-command", &len);
                if (!data || len != 4)
                        goto out_free_fpi;
  
        fpi->rx_copybreak = 240;
        fpi->use_napi = 1;
        fpi->napi_weight = 17;
 -      fpi->phy_node = of_parse_phandle(ofdev->node, "phy-handle", 0);
 -      if ((!fpi->phy_node) && (!of_get_property(ofdev->node, "fixed-link",
 +      fpi->phy_node = of_parse_phandle(ofdev->dev.of_node, "phy-handle", 0);
 +      if ((!fpi->phy_node) && (!of_get_property(ofdev->dev.of_node, "fixed-link",
                                                  NULL)))
                goto out_free_fpi;
  
        spin_lock_init(&fep->lock);
        spin_lock_init(&fep->tx_lock);
  
 -      mac_addr = of_get_mac_address(ofdev->node);
 +      mac_addr = of_get_mac_address(ofdev->dev.of_node);
        if (mac_addr)
                memcpy(ndev->dev_addr, mac_addr, 6);
  
@@@ -1158,11 -1156,8 +1156,11 @@@ static struct of_device_id fs_enet_matc
  MODULE_DEVICE_TABLE(of, fs_enet_match);
  
  static struct of_platform_driver fs_enet_driver = {
 -      .name   = "fs_enet",
 -      .match_table = fs_enet_match,
 +      .driver = {
 +              .owner = THIS_MODULE,
 +              .name = "fs_enet",
 +              .of_match_table = fs_enet_match,
 +      },
        .probe = fs_enet_probe,
        .remove = fs_enet_remove,
  };
index 9d4f272137d653d027d0e363b92a0bc4e20a485b,714da967fa19bde3162c5be324bd48fcd19e926f..5d45084b287d13afa6d24dcfc02d18f56afb0ce1
@@@ -88,19 -88,19 +88,19 @@@ static int do_pd_setup(struct fs_enet_p
        struct fs_platform_info *fpi = fep->fpi;
        int ret = -EINVAL;
  
 -      fep->interrupt = of_irq_to_resource(ofdev->node, 0, NULL);
 +      fep->interrupt = of_irq_to_resource(ofdev->dev.of_node, 0, NULL);
        if (fep->interrupt == NO_IRQ)
                goto out;
  
 -      fep->fcc.fccp = of_iomap(ofdev->node, 0);
 +      fep->fcc.fccp = of_iomap(ofdev->dev.of_node, 0);
        if (!fep->fcc.fccp)
                goto out;
  
 -      fep->fcc.ep = of_iomap(ofdev->node, 1);
 +      fep->fcc.ep = of_iomap(ofdev->dev.of_node, 1);
        if (!fep->fcc.ep)
                goto out_fccp;
  
 -      fep->fcc.fcccp = of_iomap(ofdev->node, 2);
 +      fep->fcc.fcccp = of_iomap(ofdev->dev.of_node, 2);
        if (!fep->fcc.fcccp)
                goto out_ep;
  
@@@ -231,12 -231,12 +231,12 @@@ static void set_multicast_finish(struc
  
  static void set_multicast_list(struct net_device *dev)
  {
-       struct dev_mc_list *pmc;
+       struct netdev_hw_addr *ha;
  
        if ((dev->flags & IFF_PROMISC) == 0) {
                set_multicast_start(dev);
-               netdev_for_each_mc_addr(pmc, dev)
-                       set_multicast_one(dev, pmc->dmi_addr);
+               netdev_for_each_mc_addr(ha, dev)
+                       set_multicast_one(dev, ha->addr);
                set_multicast_finish(dev);
        } else
                set_promiscuous_mode(dev);
index bd7a6e7064bb2ae8968ce99badb75a88baf28201,7eff92ef01da4de9e28857cfbe0a5c69f4789b41..7ca1642276d02e44949a966f3107c7b36c82ea03
@@@ -98,11 -98,11 +98,11 @@@ static int do_pd_setup(struct fs_enet_p
  {
        struct of_device *ofdev = to_of_device(fep->dev);
  
 -      fep->interrupt = of_irq_to_resource(ofdev->node, 0, NULL);
 +      fep->interrupt = of_irq_to_resource(ofdev->dev.of_node, 0, NULL);
        if (fep->interrupt == NO_IRQ)
                return -EINVAL;
  
 -      fep->fec.fecp = of_iomap(ofdev->node, 0);
 +      fep->fec.fecp = of_iomap(ofdev->dev.of_node, 0);
        if (!fep->fcc.fccp)
                return -EINVAL;
  
@@@ -232,12 -232,12 +232,12 @@@ static void set_multicast_finish(struc
  
  static void set_multicast_list(struct net_device *dev)
  {
-       struct dev_mc_list *pmc;
+       struct netdev_hw_addr *ha;
  
        if ((dev->flags & IFF_PROMISC) == 0) {
                set_multicast_start(dev);
-               netdev_for_each_mc_addr(pmc, dev)
-                       set_multicast_one(dev, pmc->dmi_addr);
+               netdev_for_each_mc_addr(ha, dev)
+                       set_multicast_one(dev, ha->addr);
                set_multicast_finish(dev);
        } else
                set_promiscuous_mode(dev);
index 49a4d8c60168b046d5c405593c88ec75d93dc6a3,7f0591e43cd992feac439dbdd83bbb7a9ae17d42..a3c44544846d5ab2ef1a54e205c51e4e79310688
@@@ -98,15 -98,15 +98,15 @@@ static int do_pd_setup(struct fs_enet_p
  {
        struct of_device *ofdev = to_of_device(fep->dev);
  
 -      fep->interrupt = of_irq_to_resource(ofdev->node, 0, NULL);
 +      fep->interrupt = of_irq_to_resource(ofdev->dev.of_node, 0, NULL);
        if (fep->interrupt == NO_IRQ)
                return -EINVAL;
  
 -      fep->scc.sccp = of_iomap(ofdev->node, 0);
 +      fep->scc.sccp = of_iomap(ofdev->dev.of_node, 0);
        if (!fep->scc.sccp)
                return -EINVAL;
  
 -      fep->scc.ep = of_iomap(ofdev->node, 1);
 +      fep->scc.ep = of_iomap(ofdev->dev.of_node, 1);
        if (!fep->scc.ep) {
                iounmap(fep->scc.sccp);
                return -EINVAL;
@@@ -223,12 -223,12 +223,12 @@@ static void set_multicast_finish(struc
  
  static void set_multicast_list(struct net_device *dev)
  {
-       struct dev_mc_list *pmc;
+       struct netdev_hw_addr *ha;
  
        if ((dev->flags & IFF_PROMISC) == 0) {
                set_multicast_start(dev);
-               netdev_for_each_mc_addr(pmc, dev)
-                       set_multicast_one(dev, pmc->dmi_addr);
+               netdev_for_each_mc_addr(ha, dev)
+                       set_multicast_one(dev, ha->addr);
                set_multicast_finish(dev);
        } else
                set_promiscuous_mode(dev);
index 16508535720a9da18523cf1eddc52c0327e47daf,ff028f59b9306c086f03df626e5cecf31d131a22..b4c41d72c423ef79e004bd901f23ef03f96e311f
@@@ -205,8 -205,6 +205,6 @@@ static int fsl_pq_mdio_find_free(struc
  static u32 __iomem *get_gfar_tbipa(struct fsl_pq_mdio __iomem *regs, struct device_node *np)
  {
        struct gfar __iomem *enet_regs;
-       u32 __iomem *ioremap_tbipa;
-       u64 addr, size;
  
        /*
         * This is mildly evil, but so is our hardware for doing this.
                return &enet_regs->tbipa;
        } else if (of_device_is_compatible(np, "fsl,etsec2-mdio") ||
                        of_device_is_compatible(np, "fsl,etsec2-tbi")) {
-               addr = of_translate_address(np, of_get_address(np, 1, &size, NULL));
-               ioremap_tbipa = ioremap(addr, size);
-               return ioremap_tbipa;
+               return of_iomap(np, 1);
        } else
                return NULL;
  }
@@@ -271,7 -267,7 +267,7 @@@ static int get_ucc_id_for_range(u64 sta
  static int fsl_pq_mdio_probe(struct of_device *ofdev,
                const struct of_device_id *match)
  {
 -      struct device_node *np = ofdev->node;
 +      struct device_node *np = ofdev->dev.of_node;
        struct device_node *tbi;
        struct fsl_pq_mdio_priv *priv;
        struct fsl_pq_mdio __iomem *regs = NULL;
        u32 __iomem *tbipa;
        struct mii_bus *new_bus;
        int tbiaddr = -1;
+       const u32 *addrp;
        u64 addr = 0, size = 0;
-       int err = 0;
+       int err;
  
        priv = kzalloc(sizeof(*priv), GFP_KERNEL);
        if (!priv)
                return -ENOMEM;
  
        new_bus = mdiobus_alloc();
-       if (NULL == new_bus)
+       if (!new_bus) {
+               err = -ENOMEM;
                goto err_free_priv;
+       }
  
        new_bus->name = "Freescale PowerQUICC MII Bus",
        new_bus->read = &fsl_pq_mdio_read,
        new_bus->priv = priv;
        fsl_pq_mdio_bus_name(new_bus->id, np);
  
+       addrp = of_get_address(np, 0, &size, NULL);
+       if (!addrp) {
+               err = -EINVAL;
+               goto err_free_bus;
+       }
        /* Set the PHY base address */
-       addr = of_translate_address(np, of_get_address(np, 0, &size, NULL));
+       addr = of_translate_address(np, addrp);
+       if (addr == OF_BAD_ADDR) {
+               err = -EINVAL;
+               goto err_free_bus;
+       }
        map = ioremap(addr, size);
        if (!map) {
                err = -ENOMEM;
@@@ -461,13 -471,10 +471,13 @@@ static struct of_device_id fsl_pq_mdio_
  MODULE_DEVICE_TABLE(of, fsl_pq_mdio_match);
  
  static struct of_platform_driver fsl_pq_mdio_driver = {
 -      .name = "fsl-pq_mdio",
 +      .driver = {
 +              .name = "fsl-pq_mdio",
 +              .owner = THIS_MODULE,
 +              .of_match_table = fsl_pq_mdio_match,
 +      },
        .probe = fsl_pq_mdio_probe,
        .remove = fsl_pq_mdio_remove,
 -      .match_table = fsl_pq_mdio_match,
  };
  
  int __init fsl_pq_mdio_init(void)
diff --combined drivers/net/gianfar.c
index c3b292a31328eac3b5ed11e4f91ad478b6fbf51f,c6791cd4ee0537503a70f4cbd2d0a005725c863d..1830f3199cb523080b1a880dd5e834ad9fb8d99a
@@@ -82,6 -82,7 +82,7 @@@
  #include <linux/tcp.h>
  #include <linux/udp.h>
  #include <linux/in.h>
+ #include <linux/net_tstamp.h>
  
  #include <asm/io.h>
  #include <asm/irq.h>
@@@ -377,6 -378,13 +378,13 @@@ static void gfar_init_mac(struct net_de
                rctrl |= RCTRL_PADDING(priv->padding);
        }
  
+       /* Insert receive time stamps into padding alignment bytes */
+       if (priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER) {
+               rctrl &= ~RCTRL_PAL_MASK;
+               rctrl |= RCTRL_PRSDEP_INIT | RCTRL_TS_ENABLE | RCTRL_PADDING(8);
+               priv->padding = 8;
+       }
        /* keep vlan related bits if it's enabled */
        if (priv->vlgrp) {
                rctrl |= RCTRL_VLEX | RCTRL_PRSDEP_INIT;
@@@ -501,7 -509,8 +509,8 @@@ void unlock_tx_qs(struct gfar_private *
  /* Returns 1 if incoming frames use an FCB */
  static inline int gfar_uses_fcb(struct gfar_private *priv)
  {
-       return priv->vlgrp || priv->rx_csum_enable;
+       return priv->vlgrp || priv->rx_csum_enable ||
+               (priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER);
  }
  
  static void free_tx_pointers(struct gfar_private *priv)
@@@ -549,12 -558,8 +558,8 @@@ static int gfar_parse_group(struct devi
                struct gfar_private *priv, const char *model)
  {
        u32 *queue_mask;
-       u64 addr, size;
-       addr = of_translate_address(np,
-                       of_get_address(np, 0, &size, NULL));
-       priv->gfargrp[priv->num_grps].regs = ioremap(addr, size);
  
+       priv->gfargrp[priv->num_grps].regs = of_iomap(np, 0);
        if (!priv->gfargrp[priv->num_grps].regs)
                return -ENOMEM;
  
@@@ -603,7 -608,7 +608,7 @@@ static int gfar_of_init(struct of_devic
        int err = 0, i;
        struct net_device *dev = NULL;
        struct gfar_private *priv = NULL;
 -      struct device_node *np = ofdev->node;
 +      struct device_node *np = ofdev->dev.of_node;
        struct device_node *child = NULL;
        const u32 *stash;
        const u32 *stash_len;
                return -ENOMEM;
  
        priv = netdev_priv(dev);
 -      priv->node = ofdev->node;
 +      priv->node = ofdev->dev.of_node;
        priv->ndev = dev;
  
        dev->num_tx_queues = num_tx_qs;
                        FSL_GIANFAR_DEV_HAS_CSUM |
                        FSL_GIANFAR_DEV_HAS_VLAN |
                        FSL_GIANFAR_DEV_HAS_MAGIC_PACKET |
-                       FSL_GIANFAR_DEV_HAS_EXTENDED_HASH;
+                       FSL_GIANFAR_DEV_HAS_EXTENDED_HASH |
+                       FSL_GIANFAR_DEV_HAS_TIMER;
  
        ctype = of_get_property(np, "phy-connection-type", NULL);
  
@@@ -772,6 -778,48 +778,48 @@@ err_grp_init
        return err;
  }
  
+ static int gfar_hwtstamp_ioctl(struct net_device *netdev,
+                       struct ifreq *ifr, int cmd)
+ {
+       struct hwtstamp_config config;
+       struct gfar_private *priv = netdev_priv(netdev);
+       if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
+               return -EFAULT;
+       /* reserved for future extensions */
+       if (config.flags)
+               return -EINVAL;
+       switch (config.tx_type) {
+       case HWTSTAMP_TX_OFF:
+               priv->hwts_tx_en = 0;
+               break;
+       case HWTSTAMP_TX_ON:
+               if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER))
+                       return -ERANGE;
+               priv->hwts_tx_en = 1;
+               break;
+       default:
+               return -ERANGE;
+       }
+       switch (config.rx_filter) {
+       case HWTSTAMP_FILTER_NONE:
+               priv->hwts_rx_en = 0;
+               break;
+       default:
+               if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER))
+                       return -ERANGE;
+               priv->hwts_rx_en = 1;
+               config.rx_filter = HWTSTAMP_FILTER_ALL;
+               break;
+       }
+       return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ?
+               -EFAULT : 0;
+ }
  /* Ioctl MII Interface */
  static int gfar_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
  {
        if (!netif_running(dev))
                return -EINVAL;
  
+       if (cmd == SIOCSHWTSTAMP)
+               return gfar_hwtstamp_ioctl(dev, rq, cmd);
        if (!priv->phydev)
                return -ENODEV;
  
@@@ -888,7 -939,7 +939,7 @@@ static int gfar_probe(struct of_device 
        priv = netdev_priv(dev);
        priv->ndev = dev;
        priv->ofdev = ofdev;
 -      priv->node = ofdev->node;
 +      priv->node = ofdev->dev.of_node;
        SET_NETDEV_DEV(dev, &ofdev->dev);
  
        spin_lock_init(&priv->bflock);
        else
                priv->padding = 0;
  
-       if (dev->features & NETIF_F_IP_CSUM)
+       if (dev->features & NETIF_F_IP_CSUM ||
+                       priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER)
                dev->hard_header_len += GMAC_FCB_LEN;
  
        /* Program the isrg regs only if number of grps > 1 */
@@@ -1292,21 -1344,9 +1344,9 @@@ static struct dev_pm_ops gfar_pm_ops = 
  
  #define GFAR_PM_OPS (&gfar_pm_ops)
  
- static int gfar_legacy_suspend(struct of_device *ofdev, pm_message_t state)
- {
-       return gfar_suspend(&ofdev->dev);
- }
- static int gfar_legacy_resume(struct of_device *ofdev)
- {
-       return gfar_resume(&ofdev->dev);
- }
  #else
  
  #define GFAR_PM_OPS NULL
- #define gfar_legacy_suspend NULL
- #define gfar_legacy_resume NULL
  
  #endif
  
@@@ -1515,9 -1555,9 +1555,9 @@@ static void gfar_halt_nodisable(struct 
                tempval |= (DMACTRL_GRS | DMACTRL_GTS);
                gfar_write(&regs->dmactrl, tempval);
  
-               while (!(gfar_read(&regs->ievent) &
-                        (IEVENT_GRSC | IEVENT_GTSC)))
-                       cpu_relax();
+               spin_event_timeout(((gfar_read(&regs->ievent) &
+                        (IEVENT_GRSC | IEVENT_GTSC)) ==
+                        (IEVENT_GRSC | IEVENT_GTSC)), -1, 0);
        }
  }
  
@@@ -1653,6 -1693,7 +1693,7 @@@ static void free_skb_resources(struct g
                        sizeof(struct rxbd8) * priv->total_rx_ring_size,
                        priv->tx_queue[0]->tx_bd_base,
                        priv->tx_queue[0]->tx_bd_dma_base);
+       skb_queue_purge(&priv->rx_recycle);
  }
  
  void gfar_start(struct net_device *dev)
                gfar_write(&regs->imask, IMASK_DEFAULT);
        }
  
-       dev->trans_start = jiffies;
+       dev->trans_start = jiffies; /* prevent tx timeout */
  }
  
  void gfar_configure_coalescing(struct gfar_private *priv,
@@@ -1926,23 -1967,29 +1967,29 @@@ static int gfar_start_xmit(struct sk_bu
        struct netdev_queue *txq;
        struct gfar __iomem *regs = NULL;
        struct txfcb *fcb = NULL;
-       struct txbd8 *txbdp, *txbdp_start, *base;
+       struct txbd8 *txbdp, *txbdp_start, *base, *txbdp_tstamp = NULL;
        u32 lstatus;
-       int i, rq = 0;
+       int i, rq = 0, do_tstamp = 0;
        u32 bufaddr;
        unsigned long flags;
-       unsigned int nr_frags, length;
+       unsigned int nr_frags, nr_txbds, length;
+       union skb_shared_tx *shtx;
  
        rq = skb->queue_mapping;
        tx_queue = priv->tx_queue[rq];
        txq = netdev_get_tx_queue(dev, rq);
        base = tx_queue->tx_bd_base;
        regs = tx_queue->grp->regs;
+       shtx = skb_tx(skb);
+       /* check if time stamp should be generated */
+       if (unlikely(shtx->hardware && priv->hwts_tx_en))
+               do_tstamp = 1;
  
        /* make space for additional header when fcb is needed */
        if (((skb->ip_summed == CHECKSUM_PARTIAL) ||
-                       (priv->vlgrp && vlan_tx_tag_present(skb))) &&
+                       (priv->vlgrp && vlan_tx_tag_present(skb)) ||
+                       unlikely(do_tstamp)) &&
                        (skb_headroom(skb) < GMAC_FCB_LEN)) {
                struct sk_buff *skb_new;
  
        /* total number of fragments in the SKB */
        nr_frags = skb_shinfo(skb)->nr_frags;
  
+       /* calculate the required number of TxBDs for this skb */
+       if (unlikely(do_tstamp))
+               nr_txbds = nr_frags + 2;
+       else
+               nr_txbds = nr_frags + 1;
        /* check if there is space to queue this packet */
-       if ((nr_frags+1) > tx_queue->num_txbdfree) {
+       if (nr_txbds > tx_queue->num_txbdfree) {
                /* no space, stop the queue */
                netif_tx_stop_queue(txq);
                dev->stats.tx_fifo_errors++;
        txq->tx_packets ++;
  
        txbdp = txbdp_start = tx_queue->cur_tx;
+       lstatus = txbdp->lstatus;
+       /* Time stamp insertion requires one additional TxBD */
+       if (unlikely(do_tstamp))
+               txbdp_tstamp = txbdp = next_txbd(txbdp, base,
+                               tx_queue->tx_ring_size);
  
        if (nr_frags == 0) {
-               lstatus = txbdp->lstatus | BD_LFLAG(TXBD_LAST | TXBD_INTERRUPT);
+               if (unlikely(do_tstamp))
+                       txbdp_tstamp->lstatus |= BD_LFLAG(TXBD_LAST |
+                                       TXBD_INTERRUPT);
+               else
+                       lstatus |= BD_LFLAG(TXBD_LAST | TXBD_INTERRUPT);
        } else {
                /* Place the fragment addresses and lengths into the TxBDs */
                for (i = 0; i < nr_frags; i++) {
                gfar_tx_vlan(skb, fcb);
        }
  
-       /* setup the TxBD length and buffer pointer for the first BD */
+       /* Setup tx hardware time stamping if requested */
+       if (unlikely(do_tstamp)) {
+               shtx->in_progress = 1;
+               if (fcb == NULL)
+                       fcb = gfar_add_fcb(skb);
+               fcb->ptp = 1;
+               lstatus |= BD_LFLAG(TXBD_TOE);
+       }
        txbdp_start->bufPtr = dma_map_single(&priv->ofdev->dev, skb->data,
                        skb_headlen(skb), DMA_TO_DEVICE);
  
-       lstatus |= BD_LFLAG(TXBD_CRC | TXBD_READY) | skb_headlen(skb);
+       /*
+        * If time stamping is requested one additional TxBD must be set up. The
+        * first TxBD points to the FCB and must have a data length of
+        * GMAC_FCB_LEN. The second TxBD points to the actual frame data with
+        * the full frame length.
+        */
+       if (unlikely(do_tstamp)) {
+               txbdp_tstamp->bufPtr = txbdp_start->bufPtr + GMAC_FCB_LEN;
+               txbdp_tstamp->lstatus |= BD_LFLAG(TXBD_READY) |
+                               (skb_headlen(skb) - GMAC_FCB_LEN);
+               lstatus |= BD_LFLAG(TXBD_CRC | TXBD_READY) | GMAC_FCB_LEN;
+       } else {
+               lstatus |= BD_LFLAG(TXBD_CRC | TXBD_READY) | skb_headlen(skb);
+       }
  
        /*
         * We can work in parallel with gfar_clean_tx_ring(), except
        tx_queue->cur_tx = next_txbd(txbdp, base, tx_queue->tx_ring_size);
  
        /* reduce TxBD free count */
-       tx_queue->num_txbdfree -= (nr_frags + 1);
-       dev->trans_start = jiffies;
+       tx_queue->num_txbdfree -= (nr_txbds);
  
        /* If the next BD still needs to be cleaned up, then the bds
           are full.  We need to tell the kernel to stop sending us stuff. */
@@@ -2092,7 -2174,6 +2174,6 @@@ static int gfar_close(struct net_devic
  
        disable_napi(priv);
  
-       skb_queue_purge(&priv->rx_recycle);
        cancel_work_sync(&priv->reset_task);
        stop_gfar(dev);
  
@@@ -2255,16 -2336,18 +2336,18 @@@ static int gfar_clean_tx_ring(struct gf
        struct net_device *dev = tx_queue->dev;
        struct gfar_private *priv = netdev_priv(dev);
        struct gfar_priv_rx_q *rx_queue = NULL;
-       struct txbd8 *bdp;
+       struct txbd8 *bdp, *next = NULL;
        struct txbd8 *lbdp = NULL;
        struct txbd8 *base = tx_queue->tx_bd_base;
        struct sk_buff *skb;
        int skb_dirtytx;
        int tx_ring_size = tx_queue->tx_ring_size;
-       int frags = 0;
+       int frags = 0, nr_txbds = 0;
        int i;
        int howmany = 0;
        u32 lstatus;
+       size_t buflen;
+       union skb_shared_tx *shtx;
  
        rx_queue = priv->rx_queue[tx_queue->qindex];
        bdp = tx_queue->dirty_tx;
                unsigned long flags;
  
                frags = skb_shinfo(skb)->nr_frags;
-               lbdp = skip_txbd(bdp, frags, base, tx_ring_size);
+               /*
+                * When time stamping, one additional TxBD must be freed.
+                * Also, we need to dma_unmap_single() the TxPAL.
+                */
+               shtx = skb_tx(skb);
+               if (unlikely(shtx->in_progress))
+                       nr_txbds = frags + 2;
+               else
+                       nr_txbds = frags + 1;
+               lbdp = skip_txbd(bdp, nr_txbds - 1, base, tx_ring_size);
  
                lstatus = lbdp->lstatus;
  
                                (lstatus & BD_LENGTH_MASK))
                        break;
  
-               dma_unmap_single(&priv->ofdev->dev,
-                               bdp->bufPtr,
-                               bdp->length,
-                               DMA_TO_DEVICE);
+               if (unlikely(shtx->in_progress)) {
+                       next = next_txbd(bdp, base, tx_ring_size);
+                       buflen = next->length + GMAC_FCB_LEN;
+               } else
+                       buflen = bdp->length;
+               dma_unmap_single(&priv->ofdev->dev, bdp->bufPtr,
+                               buflen, DMA_TO_DEVICE);
+               if (unlikely(shtx->in_progress)) {
+                       struct skb_shared_hwtstamps shhwtstamps;
+                       u64 *ns = (u64*) (((u32)skb->data + 0x10) & ~0x7);
+                       memset(&shhwtstamps, 0, sizeof(shhwtstamps));
+                       shhwtstamps.hwtstamp = ns_to_ktime(*ns);
+                       skb_tstamp_tx(skb, &shhwtstamps);
+                       bdp->lstatus &= BD_LFLAG(TXBD_WRAP);
+                       bdp = next;
+               }
  
                bdp->lstatus &= BD_LFLAG(TXBD_WRAP);
                bdp = next_txbd(bdp, base, tx_ring_size);
  
                howmany++;
                spin_lock_irqsave(&tx_queue->txlock, flags);
-               tx_queue->num_txbdfree += frags + 1;
+               tx_queue->num_txbdfree += nr_txbds;
                spin_unlock_irqrestore(&tx_queue->txlock, flags);
        }
  
@@@ -2474,6 -2582,17 +2582,17 @@@ static int gfar_process_frame(struct ne
                skb_pull(skb, amount_pull);
        }
  
+       /* Get receive timestamp from the skb */
+       if (priv->hwts_rx_en) {
+               struct skb_shared_hwtstamps *shhwtstamps = skb_hwtstamps(skb);
+               u64 *ns = (u64 *) skb->data;
+               memset(shhwtstamps, 0, sizeof(*shhwtstamps));
+               shhwtstamps->hwtstamp = ns_to_ktime(*ns);
+       }
+       if (priv->padding)
+               skb_pull(skb, priv->padding);
        if (priv->rx_csum_enable)
                gfar_rx_checksum(skb, fcb);
  
@@@ -2510,8 -2629,7 +2629,7 @@@ int gfar_clean_rx_ring(struct gfar_priv
        bdp = rx_queue->cur_rx;
        base = rx_queue->rx_bd_base;
  
-       amount_pull = (gfar_uses_fcb(priv) ? GMAC_FCB_LEN : 0) +
-               priv->padding;
+       amount_pull = (gfar_uses_fcb(priv) ? GMAC_FCB_LEN : 0);
  
        while (!((bdp->status & RXBD_EMPTY) || (--rx_work_limit < 0))) {
                struct sk_buff *newskb;
@@@ -2798,7 -2916,7 +2916,7 @@@ static void adjust_link(struct net_devi
   * whenever dev->flags is changed */
  static void gfar_set_multi(struct net_device *dev)
  {
-       struct dev_mc_list *mc_ptr;
+       struct netdev_hw_addr *ha;
        struct gfar_private *priv = netdev_priv(dev);
        struct gfar __iomem *regs = priv->gfargrp[0].regs;
        u32 tempval;
                        return;
  
                /* Parse the list, and set the appropriate bits */
-               netdev_for_each_mc_addr(mc_ptr, dev) {
+               netdev_for_each_mc_addr(ha, dev) {
                        if (idx < em_num) {
-                               gfar_set_mac_for_addr(dev, idx,
-                                               mc_ptr->dmi_addr);
+                               gfar_set_mac_for_addr(dev, idx, ha->addr);
                                idx++;
                        } else
-                               gfar_set_hash_for_addr(dev, mc_ptr->dmi_addr);
+                               gfar_set_hash_for_addr(dev, ha->addr);
                }
        }
-       return;
  }
  
  
@@@ -2922,8 -3037,6 +3037,6 @@@ static void gfar_set_hash_for_addr(stru
        tempval = gfar_read(priv->hash_regs[whichreg]);
        tempval |= value;
        gfar_write(priv->hash_regs[whichreg], tempval);
-       return;
  }
  
  
@@@ -3054,16 -3167,12 +3167,14 @@@ MODULE_DEVICE_TABLE(of, gfar_match)
  
  /* Structure for a device driver */
  static struct of_platform_driver gfar_driver = {
 -      .name = "fsl-gianfar",
 -      .match_table = gfar_match,
 -
 +      .driver = {
 +              .name = "fsl-gianfar",
 +              .owner = THIS_MODULE,
 +              .pm = GFAR_PM_OPS,
 +              .of_match_table = gfar_match,
 +      },
        .probe = gfar_probe,
        .remove = gfar_remove,
-       .suspend = gfar_legacy_suspend,
-       .resume = gfar_legacy_resume,
 -      .driver.pm = GFAR_PM_OPS,
  };
  
  static int __init gfar_init(void)
diff --combined drivers/net/greth.c
index 61fd54d35f63123825f480cee7e30efaea7a59bc,fd491e409488e0ea0b8947c36f24f4810b012c03..f37a4c143ddddf985556018dc5e21288e23f3207
@@@ -895,7 -895,6 +895,6 @@@ static int greth_rx_gbit(struct net_dev
                                else
                                        skb->ip_summed = CHECKSUM_NONE;
  
-                               skb->dev = dev;
                                skb->protocol = eth_type_trans(skb, dev);
                                dev->stats.rx_packets++;
                                netif_receive_skb(skb);
@@@ -990,7 -989,7 +989,7 @@@ static u32 greth_hash_get_index(__u8 *a
  
  static void greth_set_hash_filter(struct net_device *dev)
  {
-       struct dev_mc_list *curr;
+       struct netdev_hw_addr *ha;
        struct greth_private *greth = netdev_priv(dev);
        struct greth_regs *regs = (struct greth_regs *) greth->regs;
        u32 mc_filter[2];
  
        mc_filter[0] = mc_filter[1] = 0;
  
-       netdev_for_each_mc_addr(curr, dev) {
-               bitnr = greth_hash_get_index(curr->dmi_addr);
+       netdev_for_each_mc_addr(ha, dev) {
+               bitnr = greth_hash_get_index(ha->addr);
                mc_filter[bitnr >> 5] |= 1 << (bitnr & 31);
        }
  
@@@ -1500,8 -1499,7 +1499,8 @@@ static int __devinit greth_of_probe(str
        if (i == 6) {
                const unsigned char *addr;
                int len;
 -              addr = of_get_property(ofdev->node, "local-mac-address", &len);
 +              addr = of_get_property(ofdev->dev.of_node, "local-mac-address",
 +                                      &len);
                if (addr != NULL && len == 6) {
                        for (i = 0; i < 6; i++)
                                macaddr[i] = (unsigned int) addr[i];
index f8c36a5eb4d79c9d10af257d76faf361e336ce3d,2484e9e6c1edd0f7dd06026d4111b6dadab7ea12..b150c102ca5ace67ce0fb988266ba88b13023cbe
@@@ -136,8 -136,7 +136,8 @@@ static inline void emac_report_timeout_
                                  EMAC_FTR_440EP_PHY_CLK_FIX))
                DBG(dev, "%s" NL, error);
        else if (net_ratelimit())
 -              printk(KERN_ERR "%s: %s\n", dev->ofdev->node->full_name, error);
 +              printk(KERN_ERR "%s: %s\n", dev->ofdev->dev.of_node->full_name,
 +                      error);
  }
  
  /* EMAC PHY clock workaround:
@@@ -390,18 -389,19 +390,19 @@@ static void emac_hash_mc(struct emac_in
        const int regs = EMAC_XAHT_REGS(dev);
        u32 *gaht_base = emac_gaht_base(dev);
        u32 gaht_temp[regs];
-       struct dev_mc_list *dmi;
+       struct netdev_hw_addr *ha;
        int i;
  
        DBG(dev, "hash_mc %d" NL, netdev_mc_count(dev->ndev));
  
        memset(gaht_temp, 0, sizeof (gaht_temp));
  
-       netdev_for_each_mc_addr(dmi, dev->ndev) {
+       netdev_for_each_mc_addr(ha, dev->ndev) {
                int slot, reg, mask;
-               DBG2(dev, "mc %pM" NL, dmi->dmi_addr);
+               DBG2(dev, "mc %pM" NL, ha->addr);
  
-               slot = EMAC_XAHT_CRC_TO_SLOT(dev, ether_crc(ETH_ALEN, dmi->dmi_addr));
+               slot = EMAC_XAHT_CRC_TO_SLOT(dev,
+                                            ether_crc(ETH_ALEN, ha->addr));
                reg = EMAC_XAHT_SLOT_TO_REG(dev, slot);
                mask = EMAC_XAHT_SLOT_TO_MASK(dev, slot);
  
@@@ -1178,7 -1178,7 +1179,7 @@@ static int emac_open(struct net_device 
                netif_carrier_on(dev->ndev);
  
        /* Required for Pause packet support in EMAC */
-       dev_mc_add(ndev, default_mcast_addr, sizeof(default_mcast_addr), 1);
+       dev_mc_add_global(ndev, default_mcast_addr);
  
        emac_configure(dev);
        mal_poll_add(dev->mal, &dev->commac);
@@@ -1701,7 -1701,6 +1702,6 @@@ static int emac_poll_rx(void *param, in
  
                skb_put(skb, len);
        push_packet:
-               skb->dev = dev->ndev;
                skb->protocol = eth_type_trans(skb, dev->ndev);
                emac_rx_csum(dev, skb, ctrl);
  
@@@ -2186,7 -2185,7 +2186,7 @@@ static void emac_ethtool_get_drvinfo(st
        strcpy(info->version, DRV_VERSION);
        info->fw_version[0] = '\0';
        sprintf(info->bus_info, "PPC 4xx EMAC-%d %s",
 -              dev->cell_index, dev->ofdev->node->full_name);
 +              dev->cell_index, dev->ofdev->dev.of_node->full_name);
        info->regdump_len = emac_ethtool_get_regs_len(ndev);
  }
  
@@@ -2380,7 -2379,7 +2380,7 @@@ static int __devinit emac_read_uint_pro
  
  static int __devinit emac_init_phy(struct emac_instance *dev)
  {
 -      struct device_node *np = dev->ofdev->node;
 +      struct device_node *np = dev->ofdev->dev.of_node;
        struct net_device *ndev = dev->ndev;
        u32 phy_map, adv;
        int i;
  
  static int __devinit emac_init_config(struct emac_instance *dev)
  {
 -      struct device_node *np = dev->ofdev->node;
 +      struct device_node *np = dev->ofdev->dev.of_node;
        const void *p;
        unsigned int plen;
        const char *pm, *phy_modes[] = {
@@@ -2724,7 -2723,7 +2724,7 @@@ static int __devinit emac_probe(struct 
  {
        struct net_device *ndev;
        struct emac_instance *dev;
 -      struct device_node *np = ofdev->node;
 +      struct device_node *np = ofdev->dev.of_node;
        struct device_node **blist = NULL;
        int err, i;
  
        err = mal_register_commac(dev->mal, &dev->commac);
        if (err) {
                printk(KERN_ERR "%s: failed to register with mal %s!\n",
 -                     np->full_name, dev->mal_dev->node->full_name);
 +                     np->full_name, dev->mal_dev->dev.of_node->full_name);
                goto err_rel_deps;
        }
        dev->rx_skb_size = emac_rx_skb_size(ndev->mtu);
@@@ -2996,11 -2995,9 +2996,11 @@@ static struct of_device_id emac_match[
  MODULE_DEVICE_TABLE(of, emac_match);
  
  static struct of_platform_driver emac_driver = {
 -      .name = "emac",
 -      .match_table = emac_match,
 -
 +      .driver = {
 +              .name = "emac",
 +              .owner = THIS_MODULE,
 +              .of_match_table = emac_match,
 +      },
        .probe = emac_probe,
        .remove = emac_remove,
  };
index dc318330ec79af1f9182d5bffbb7e7f72a0dc4c7,b59b24d667f0a0a4d9b3f823961506465a191b44..fa7620e2840481d4069268d721b6629d37ad35e0
@@@ -20,9 -20,6 +20,6 @@@
   *   or rx, so this should be okay.
   *
   * TODO:
-  * - Fix driver to work on more than just Virtex5.  Right now the driver
-  *   assumes that the locallink DMA registers are accessed via DCR
-  *   instructions.
   * - Factor out locallink DMA code into separate driver
   * - Fix multicast assignment.
   * - Fix support for hardware checksumming.
@@@ -116,16 -113,85 +113,85 @@@ void temac_indirect_out32(struct temac_
        temac_iow(lp, XTE_CTL0_OFFSET, CNTLREG_WRITE_ENABLE_MASK | reg);
  }
  
+ /**
+  * temac_dma_in32 - Memory mapped DMA read, this function expects a
+  * register input that is based on DCR word addresses which
+  * are then converted to memory mapped byte addresses
+  */
  static u32 temac_dma_in32(struct temac_local *lp, int reg)
  {
-       return dcr_read(lp->sdma_dcrs, reg);
+       return in_be32((u32 *)(lp->sdma_regs + (reg << 2)));
  }
  
+ /**
+  * temac_dma_out32 - Memory mapped DMA read, this function expects a
+  * register input that is based on DCR word addresses which
+  * are then converted to memory mapped byte addresses
+  */
  static void temac_dma_out32(struct temac_local *lp, int reg, u32 value)
+ {
+       out_be32((u32 *)(lp->sdma_regs + (reg << 2)), value);
+ }
+ /* DMA register access functions can be DCR based or memory mapped.
+  * The PowerPC 440 is DCR based, the PowerPC 405 and MicroBlaze are both
+  * memory mapped.
+  */
+ #ifdef CONFIG_PPC_DCR
+ /**
+  * temac_dma_dcr_in32 - DCR based DMA read
+  */
+ static u32 temac_dma_dcr_in(struct temac_local *lp, int reg)
+ {
+       return dcr_read(lp->sdma_dcrs, reg);
+ }
+ /**
+  * temac_dma_dcr_out32 - DCR based DMA write
+  */
+ static void temac_dma_dcr_out(struct temac_local *lp, int reg, u32 value)
  {
        dcr_write(lp->sdma_dcrs, reg, value);
  }
  
+ /**
+  * temac_dcr_setup - If the DMA is DCR based, then setup the address and
+  * I/O  functions
+  */
+ static int temac_dcr_setup(struct temac_local *lp, struct of_device *op,
+                               struct device_node *np)
+ {
+       unsigned int dcrs;
+       /* setup the dcr address mapping if it's in the device tree */
+       dcrs = dcr_resource_start(np, 0);
+       if (dcrs != 0) {
+               lp->sdma_dcrs = dcr_map(np, dcrs, dcr_resource_len(np, 0));
+               lp->dma_in = temac_dma_dcr_in;
+               lp->dma_out = temac_dma_dcr_out;
+               dev_dbg(&op->dev, "DCR base: %x\n", dcrs);
+               return 0;
+       }
+       /* no DCR in the device tree, indicate a failure */
+       return -1;
+ }
+ #else
+ /*
+  * temac_dcr_setup - This is a stub for when DCR is not supported,
+  * such as with MicroBlaze
+  */
+ static int temac_dcr_setup(struct temac_local *lp, struct of_device *op,
+                               struct device_node *np)
+ {
+       return -1;
+ }
+ #endif
  /**
   * temac_dma_bd_init - Setup buffer descriptor rings
   */
@@@ -156,14 -222,14 +222,14 @@@ static int temac_dma_bd_init(struct net
                lp->rx_bd_v[i].next = lp->rx_bd_p +
                                sizeof(*lp->rx_bd_v) * ((i + 1) % RX_BD_NUM);
  
-               skb = alloc_skb(XTE_MAX_JUMBO_FRAME_SIZE
-                               + XTE_ALIGN, GFP_ATOMIC);
+               skb = netdev_alloc_skb_ip_align(ndev,
+                                               XTE_MAX_JUMBO_FRAME_SIZE);
                if (skb == 0) {
                        dev_err(&ndev->dev, "alloc_skb error %d\n", i);
                        return -1;
                }
                lp->rx_skb[i] = skb;
-               skb_reserve(skb,  BUFFER_ALIGN(skb->data));
                /* returns physical address of skb->data */
                lp->rx_bd_v[i].phys = dma_map_single(ndev->dev.parent,
                                                     skb->data,
                lp->rx_bd_v[i].app0 = STS_CTRL_APP0_IRQONEND;
        }
  
-       temac_dma_out32(lp, TX_CHNL_CTRL, 0x10220400 |
+       lp->dma_out(lp, TX_CHNL_CTRL, 0x10220400 |
                                          CHNL_CTRL_IRQ_EN |
                                          CHNL_CTRL_IRQ_DLY_EN |
                                          CHNL_CTRL_IRQ_COAL_EN);
        /* 0x10220483 */
        /* 0x00100483 */
-       temac_dma_out32(lp, RX_CHNL_CTRL, 0xff010000 |
+       lp->dma_out(lp, RX_CHNL_CTRL, 0xff010000 |
                                          CHNL_CTRL_IRQ_EN |
                                          CHNL_CTRL_IRQ_DLY_EN |
                                          CHNL_CTRL_IRQ_COAL_EN |
                                          CHNL_CTRL_IRQ_IOE);
        /* 0xff010283 */
  
-       temac_dma_out32(lp, RX_CURDESC_PTR,  lp->rx_bd_p);
-       temac_dma_out32(lp, RX_TAILDESC_PTR,
+       lp->dma_out(lp, RX_CURDESC_PTR,  lp->rx_bd_p);
+       lp->dma_out(lp, RX_TAILDESC_PTR,
                       lp->rx_bd_p + (sizeof(*lp->rx_bd_v) * (RX_BD_NUM - 1)));
-       temac_dma_out32(lp, TX_CURDESC_PTR, lp->tx_bd_p);
+       lp->dma_out(lp, TX_CURDESC_PTR, lp->tx_bd_p);
  
        return 0;
  }
@@@ -251,20 -317,20 +317,20 @@@ static void temac_set_multicast_list(st
                temac_indirect_out32(lp, XTE_AFM_OFFSET, XTE_AFM_EPPRM_MASK);
                dev_info(&ndev->dev, "Promiscuous mode enabled.\n");
        } else if (!netdev_mc_empty(ndev)) {
-               struct dev_mc_list *mclist;
+               struct netdev_hw_addr *ha;
  
                i = 0;
-               netdev_for_each_mc_addr(mclist, ndev) {
+               netdev_for_each_mc_addr(ha, ndev) {
                        if (i >= MULTICAST_CAM_TABLE_NUM)
                                break;
-                       multi_addr_msw = ((mclist->dmi_addr[3] << 24) |
-                                         (mclist->dmi_addr[2] << 16) |
-                                         (mclist->dmi_addr[1] << 8) |
-                                         (mclist->dmi_addr[0]));
+                       multi_addr_msw = ((ha->addr[3] << 24) |
+                                         (ha->addr[2] << 16) |
+                                         (ha->addr[1] << 8) |
+                                         (ha->addr[0]));
                        temac_indirect_out32(lp, XTE_MAW0_OFFSET,
                                             multi_addr_msw);
-                       multi_addr_lsw = ((mclist->dmi_addr[5] << 8) |
-                                         (mclist->dmi_addr[4]) | (i << 16));
+                       multi_addr_lsw = ((ha->addr[5] << 8) |
+                                         (ha->addr[4]) | (i << 16));
                        temac_indirect_out32(lp, XTE_MAW1_OFFSET,
                                             multi_addr_lsw);
                        i++;
@@@ -427,9 -493,9 +493,9 @@@ static void temac_device_reset(struct n
        temac_indirect_out32(lp, XTE_RXC1_OFFSET, val & ~XTE_RXC1_RXEN_MASK);
  
        /* Reset Local Link (DMA) */
-       temac_dma_out32(lp, DMA_CONTROL_REG, DMA_CONTROL_RST);
+       lp->dma_out(lp, DMA_CONTROL_REG, DMA_CONTROL_RST);
        timeout = 1000;
-       while (temac_dma_in32(lp, DMA_CONTROL_REG) & DMA_CONTROL_RST) {
+       while (lp->dma_in(lp, DMA_CONTROL_REG) & DMA_CONTROL_RST) {
                udelay(1);
                if (--timeout == 0) {
                        dev_err(&ndev->dev,
                        break;
                }
        }
-       temac_dma_out32(lp, DMA_CONTROL_REG, DMA_TAIL_ENABLE);
+       lp->dma_out(lp, DMA_CONTROL_REG, DMA_TAIL_ENABLE);
  
        temac_dma_bd_init(ndev);
  
                dev_err(&ndev->dev, "Error setting TEMAC options\n");
  
        /* Init Driver variable */
-       ndev->trans_start = 0;
+       ndev->trans_start = jiffies; /* prevent tx timeout */
  }
  
  void temac_adjust_link(struct net_device *ndev)
@@@ -598,7 -664,7 +664,7 @@@ static int temac_start_xmit(struct sk_b
                lp->tx_bd_tail = 0;
  
        /* Kick off the transfer */
-       temac_dma_out32(lp, TX_TAILDESC_PTR, tail_p); /* DMA start */
+       lp->dma_out(lp, TX_TAILDESC_PTR, tail_p); /* DMA start */
  
        return NETDEV_TX_OK;
  }
@@@ -612,7 -678,6 +678,6 @@@ static void ll_temac_recv(struct net_de
        struct cdmac_bd *cur_p;
        dma_addr_t tail_p;
        int length;
-       unsigned long skb_vaddr;
        unsigned long flags;
  
        spin_lock_irqsave(&lp->rx_lock, flags);
                skb = lp->rx_skb[lp->rx_bd_ci];
                length = cur_p->app4 & 0x3FFF;
  
-               skb_vaddr = virt_to_bus(skb->data);
-               dma_unmap_single(ndev->dev.parent, skb_vaddr, length,
+               dma_unmap_single(ndev->dev.parent, cur_p->phys, length,
                                 DMA_FROM_DEVICE);
  
                skb_put(skb, length);
                ndev->stats.rx_packets++;
                ndev->stats.rx_bytes += length;
  
-               new_skb = alloc_skb(XTE_MAX_JUMBO_FRAME_SIZE + XTE_ALIGN,
-                               GFP_ATOMIC);
+               new_skb = netdev_alloc_skb_ip_align(ndev,
+                                               XTE_MAX_JUMBO_FRAME_SIZE);
                if (new_skb == 0) {
                        dev_err(&ndev->dev, "no memory for new sk_buff\n");
                        spin_unlock_irqrestore(&lp->rx_lock, flags);
                        return;
                }
  
-               skb_reserve(new_skb, BUFFER_ALIGN(new_skb->data));
                cur_p->app0 = STS_CTRL_APP0_IRQONEND;
                cur_p->phys = dma_map_single(ndev->dev.parent, new_skb->data,
                                             XTE_MAX_JUMBO_FRAME_SIZE,
                cur_p = &lp->rx_bd_v[lp->rx_bd_ci];
                bdstat = cur_p->app0;
        }
-       temac_dma_out32(lp, RX_TAILDESC_PTR, tail_p);
+       lp->dma_out(lp, RX_TAILDESC_PTR, tail_p);
  
        spin_unlock_irqrestore(&lp->rx_lock, flags);
  }
@@@ -675,8 -738,8 +738,8 @@@ static irqreturn_t ll_temac_tx_irq(int 
        struct temac_local *lp = netdev_priv(ndev);
        unsigned int status;
  
-       status = temac_dma_in32(lp, TX_IRQ_REG);
-       temac_dma_out32(lp, TX_IRQ_REG, status);
+       status = lp->dma_in(lp, TX_IRQ_REG);
+       lp->dma_out(lp, TX_IRQ_REG, status);
  
        if (status & (IRQ_COAL | IRQ_DLY))
                temac_start_xmit_done(lp->ndev);
@@@ -693,8 -756,8 +756,8 @@@ static irqreturn_t ll_temac_rx_irq(int 
        unsigned int status;
  
        /* Read and clear the status registers */
-       status = temac_dma_in32(lp, RX_IRQ_REG);
-       temac_dma_out32(lp, RX_IRQ_REG, status);
+       status = lp->dma_in(lp, RX_IRQ_REG);
+       lp->dma_out(lp, RX_IRQ_REG, status);
  
        if (status & (IRQ_COAL | IRQ_DLY))
                ll_temac_recv(lp->ndev);
@@@ -795,7 -858,7 +858,7 @@@ static ssize_t temac_show_llink_regs(st
        int i, len = 0;
  
        for (i = 0; i < 0x11; i++)
-               len += sprintf(buf + len, "%.8x%s", temac_dma_in32(lp, i),
+               len += sprintf(buf + len, "%.8x%s", lp->dma_in(lp, i),
                               (i % 8) == 7 ? "\n" : " ");
        len += sprintf(buf + len, "\n");
  
@@@ -821,7 -884,6 +884,6 @@@ temac_of_probe(struct of_device *op, co
        struct net_device *ndev;
        const void *addr;
        int size, rc = 0;
-       unsigned int dcrs;
  
        /* Init network device structure */
        ndev = alloc_etherdev(sizeof(*lp));
        mutex_init(&lp->indirect_mutex);
  
        /* map device registers */
 -      lp->regs = of_iomap(op->node, 0);
 +      lp->regs = of_iomap(op->dev.of_node, 0);
        if (!lp->regs) {
                dev_err(&op->dev, "could not map temac regs.\n");
                goto nodev;
        }
  
        /* Find the DMA node, map the DMA registers, and decode the DMA IRQs */
 -      np = of_parse_phandle(op->node, "llink-connected", 0);
 +      np = of_parse_phandle(op->dev.of_node, "llink-connected", 0);
        if (!np) {
                dev_err(&op->dev, "could not find DMA node\n");
                goto nodev;
        }
  
-       dcrs = dcr_resource_start(np, 0);
-       if (dcrs == 0) {
-               dev_err(&op->dev, "could not get DMA register address\n");
-               goto nodev;
+       /* Setup the DMA register accesses, could be DCR or memory mapped */
+       if (temac_dcr_setup(lp, op, np)) {
+               /* no DCR in the device tree, try non-DCR */
+               lp->sdma_regs = of_iomap(np, 0);
+               if (lp->sdma_regs) {
+                       lp->dma_in = temac_dma_in32;
+                       lp->dma_out = temac_dma_out32;
+                       dev_dbg(&op->dev, "MEM base: %p\n", lp->sdma_regs);
+               } else {
+                       dev_err(&op->dev, "unable to map DMA registers\n");
+                       goto nodev;
+               }
        }
-       lp->sdma_dcrs = dcr_map(np, dcrs, dcr_resource_len(np, 0));
-       dev_dbg(&op->dev, "DCR base: %x\n", dcrs);
  
        lp->rx_irq = irq_of_parse_and_map(np, 0);
        lp->tx_irq = irq_of_parse_and_map(np, 1);
        of_node_put(np); /* Finished with the DMA node; drop the reference */
  
        /* Retrieve the MAC address */
 -      addr = of_get_property(op->node, "local-mac-address", &size);
 +      addr = of_get_property(op->dev.of_node, "local-mac-address", &size);
        if ((!addr) || (size != 6)) {
                dev_err(&op->dev, "could not find MAC address\n");
                rc = -ENODEV;
        }
        temac_set_mac_address(ndev, (void *)addr);
  
 -      rc = temac_mdio_setup(lp, op->node);
 +      rc = temac_mdio_setup(lp, op->dev.of_node);
        if (rc)
                dev_warn(&op->dev, "error registering MDIO bus\n");
  
 -      lp->phy_node = of_parse_phandle(op->node, "phy-handle", 0);
 +      lp->phy_node = of_parse_phandle(op->dev.of_node, "phy-handle", 0);
        if (lp->phy_node)
                dev_dbg(lp->dev, "using PHY node %s (%p)\n", np->full_name, np);
  
@@@ -955,12 -1024,12 +1024,12 @@@ static struct of_device_id temac_of_mat
  MODULE_DEVICE_TABLE(of, temac_of_match);
  
  static struct of_platform_driver temac_of_driver = {
 -      .match_table = temac_of_match,
        .probe = temac_of_probe,
        .remove = __devexit_p(temac_of_remove),
        .driver = {
                .owner = THIS_MODULE,
                .name = "xilinx_temac",
 +              .of_match_table = temac_of_match,
        },
  };
  
diff --combined drivers/net/myri_sbus.c
index 77835df4d013a113847133565b9589e6caa9e147,3898108f98ce6c7d6bd096a868080def27501223..1a57c3da1f498bb5d21531879ae2d9df941324dd
@@@ -865,7 -865,7 +865,7 @@@ static inline void determine_reg_space_
                printk("myricom: AIEEE weird cpu version %04x assuming pre4.0\n",
                       mp->eeprom.cpuvers);
                mp->reg_size = (3 * 128 * 1024) + 4096;
-       };
+       }
  }
  
  #ifdef DEBUG_DETECT
@@@ -928,7 -928,7 +928,7 @@@ static const struct net_device_ops myri
  
  static int __devinit myri_sbus_probe(struct of_device *op, const struct of_device_id *match)
  {
 -      struct device_node *dp = op->node;
 +      struct device_node *dp = op->dev.of_node;
        static unsigned version_printed;
        struct net_device *dev;
        struct myri_eth *mp;
@@@ -1161,11 -1161,8 +1161,11 @@@ static const struct of_device_id myri_s
  MODULE_DEVICE_TABLE(of, myri_sbus_match);
  
  static struct of_platform_driver myri_sbus_driver = {
 -      .name           = "myri",
 -      .match_table    = myri_sbus_match,
 +      .driver = {
 +              .name = "myri",
 +              .owner = THIS_MODULE,
 +              .of_match_table = myri_sbus_match,
 +      },
        .probe          = myri_sbus_probe,
        .remove         = __devexit_p(myri_sbus_remove),
  };
diff --combined drivers/net/niu.c
index 406d72c4eb71dd93ecd9b016428f0cb19c873dc5,30abb4e436f16ed70b3aa85487d59441fad6a313..63e8e3893bd6cb9d05ad674a036c1b3f49e82aad
@@@ -36,8 -36,8 +36,8 @@@
  #include "niu.h"
  
  #define DRV_MODULE_NAME               "niu"
- #define DRV_MODULE_VERSION    "1.0"
- #define DRV_MODULE_RELDATE    "Nov 14, 2008"
+ #define DRV_MODULE_VERSION    "1.1"
+ #define DRV_MODULE_RELDATE    "Apr 22, 2010"
  
  static char version[] __devinitdata =
        DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
@@@ -3444,6 -3444,7 +3444,7 @@@ static int niu_process_rx_pkt(struct na
                              struct rx_ring_info *rp)
  {
        unsigned int index = rp->rcr_index;
+       struct rx_pkt_hdr1 *rh;
        struct sk_buff *skb;
        int len, num_rcr;
  
                if (num_rcr == 1) {
                        int ptype;
  
-                       off += 2;
-                       append_size -= 2;
                        ptype = (val >> RCR_ENTRY_PKT_TYPE_SHIFT);
                        if ((ptype == RCR_PKT_TYPE_TCP ||
                             ptype == RCR_PKT_TYPE_UDP) &&
                                skb->ip_summed = CHECKSUM_UNNECESSARY;
                        else
                                skb->ip_summed = CHECKSUM_NONE;
-               }
-               if (!(val & RCR_ENTRY_MULTI))
+               } else if (!(val & RCR_ENTRY_MULTI))
                        append_size = len - skb->len;
  
                niu_rx_skb_append(skb, page, off, append_size);
        }
        rp->rcr_index = index;
  
-       skb_reserve(skb, NET_IP_ALIGN);
-       __pskb_pull_tail(skb, min(len, VLAN_ETH_HLEN));
+       len += sizeof(*rh);
+       len = min_t(int, len, sizeof(*rh) + VLAN_ETH_HLEN);
+       __pskb_pull_tail(skb, len);
+       rh = (struct rx_pkt_hdr1 *) skb->data;
+       if (np->dev->features & NETIF_F_RXHASH)
+               skb->rxhash = ((u32)rh->hashval2_0 << 24 |
+                              (u32)rh->hashval2_1 << 16 |
+                              (u32)rh->hashval1_1 << 8 |
+                              (u32)rh->hashval1_2 << 0);
+       skb_pull(skb, sizeof(*rh));
  
        rp->rx_packets++;
        rp->rx_bytes += skb->len;
@@@ -4946,7 -4952,9 +4952,9 @@@ static int niu_init_one_rx_channel(stru
              RX_DMA_CTL_STAT_RCRTO |
              RX_DMA_CTL_STAT_RBR_EMPTY));
        nw64(RXDMA_CFIG1(channel), rp->mbox_dma >> 32);
-       nw64(RXDMA_CFIG2(channel), (rp->mbox_dma & 0x00000000ffffffc0));
+       nw64(RXDMA_CFIG2(channel),
+            ((rp->mbox_dma & RXDMA_CFIG2_MBADDR_L) |
+             RXDMA_CFIG2_FULL_HDR));
        nw64(RBR_CFIG_A(channel),
             ((u64)rp->rbr_table_size << RBR_CFIG_A_LEN_SHIFT) |
             (rp->rbr_dma & (RBR_CFIG_A_STADDR_BASE | RBR_CFIG_A_STADDR)));
@@@ -6314,7 -6322,6 +6322,6 @@@ static void niu_set_rx_mode(struct net_
  {
        struct niu *np = netdev_priv(dev);
        int i, alt_cnt, err;
-       struct dev_addr_list *addr;
        struct netdev_hw_addr *ha;
        unsigned long flags;
        u16 hash[16] = { 0, };
                for (i = 0; i < 16; i++)
                        hash[i] = 0xffff;
        } else if (!netdev_mc_empty(dev)) {
-               netdev_for_each_mc_addr(addr, dev) {
-                       u32 crc = ether_crc_le(ETH_ALEN, addr->da_addr);
+               netdev_for_each_mc_addr(ha, dev) {
+                       u32 crc = ether_crc_le(ETH_ALEN, ha->addr);
  
                        crc >>= 24;
                        hash[crc >> 4] |= (1 << (15 - (crc & 0xf)));
@@@ -7911,6 -7918,18 +7918,18 @@@ static int niu_phys_id(struct net_devic
        return 0;
  }
  
+ static int niu_set_flags(struct net_device *dev, u32 data)
+ {
+       if (data & (ETH_FLAG_LRO | ETH_FLAG_NTUPLE))
+               return -EOPNOTSUPP;
+       if (data & ETH_FLAG_RXHASH)
+               dev->features |= NETIF_F_RXHASH;
+       else
+               dev->features &= ~NETIF_F_RXHASH;
+       return 0;
+ }
  static const struct ethtool_ops niu_ethtool_ops = {
        .get_drvinfo            = niu_get_drvinfo,
        .get_link               = ethtool_op_get_link,
        .phys_id                = niu_phys_id,
        .get_rxnfc              = niu_get_nfc,
        .set_rxnfc              = niu_set_nfc,
+       .set_flags              = niu_set_flags,
+       .get_flags              = ethtool_op_get_flags,
  };
  
  static int niu_ldg_assign_ldn(struct niu *np, struct niu_parent *parent,
@@@ -9094,7 -9115,7 +9115,7 @@@ static int __devinit niu_n2_irq_init(st
        const u32 *int_prop;
        int i;
  
 -      int_prop = of_get_property(op->node, "interrupts", NULL);
 +      int_prop = of_get_property(op->dev.of_node, "interrupts", NULL);
        if (!int_prop)
                return -ENODEV;
  
@@@ -9245,7 -9266,7 +9266,7 @@@ static int __devinit niu_get_of_props(s
        int prop_len;
  
        if (np->parent->plat_type == PLAT_TYPE_NIU)
 -              dp = np->op->node;
 +              dp = np->op->dev.of_node;
        else
                dp = pci_device_to_OF_node(np->pdev);
  
@@@ -9755,6 -9776,12 +9776,12 @@@ static void __devinit niu_device_announ
        }
  }
  
+ static void __devinit niu_set_basic_features(struct net_device *dev)
+ {
+       dev->features |= (NETIF_F_SG | NETIF_F_HW_CSUM |
+                         NETIF_F_GRO | NETIF_F_RXHASH);
+ }
  static int __devinit niu_pci_init_one(struct pci_dev *pdev,
                                      const struct pci_device_id *ent)
  {
                }
        }
  
-       dev->features |= (NETIF_F_SG | NETIF_F_HW_CSUM);
+       niu_set_basic_features(dev);
  
        np->regs = pci_ioremap_bar(pdev, 0);
        if (!np->regs) {
@@@ -10056,10 -10083,10 +10083,10 @@@ static int __devinit niu_of_probe(struc
  
        niu_driver_version();
  
 -      reg = of_get_property(op->node, "reg", NULL);
 +      reg = of_get_property(op->dev.of_node, "reg", NULL);
        if (!reg) {
                dev_err(&op->dev, "%s: No 'reg' property, aborting\n",
 -                      op->node->full_name);
 +                      op->dev.of_node->full_name);
                return -ENODEV;
        }
  
        np = netdev_priv(dev);
  
        memset(&parent_id, 0, sizeof(parent_id));
 -      parent_id.of = of_get_parent(op->node);
 +      parent_id.of = of_get_parent(op->dev.of_node);
  
        np->parent = niu_get_parent(np, &parent_id,
                                    PLAT_TYPE_NIU);
                goto err_out_free_dev;
        }
  
-       dev->features |= (NETIF_F_SG | NETIF_F_HW_CSUM);
+       niu_set_basic_features(dev);
  
        np->regs = of_ioremap(&op->resource[1], 0,
                              resource_size(&op->resource[1]),
@@@ -10207,11 -10234,8 +10234,11 @@@ static const struct of_device_id niu_ma
  MODULE_DEVICE_TABLE(of, niu_match);
  
  static struct of_platform_driver niu_of_driver = {
 -      .name           = "niu",
 -      .match_table    = niu_match,
 +      .driver = {
 +              .name = "niu",
 +              .owner = THIS_MODULE,
 +              .of_match_table = niu_match,
 +      },
        .probe          = niu_of_probe,
        .remove         = __devexit_p(niu_of_remove),
  };
diff --combined drivers/net/sunbmac.c
index 5f0ec390d6fc5cf4630380bebae4d84fa097e47b,4591fe9bf0b9dd5fe875f5e6aecc5f877b0cc119..367e96f317d4d4df298a59945a2d3e3ca7ea9e73
@@@ -362,7 -362,7 +362,7 @@@ static void bigmac_tcvr_write(struct bi
        default:
                printk(KERN_ERR "bigmac_tcvr_read: Whoops, no known transceiver type.\n");
                return;
-       };
+       }
  
        idle_transceiver(tregs);
        write_tcvr_bit(bp, tregs, 0);
@@@ -401,7 -401,7 +401,7 @@@ static unsigned short bigmac_tcvr_read(
        default:
                printk(KERN_ERR "bigmac_tcvr_read: Whoops, no known transceiver type.\n");
                return 0xffff;
-       };
+       }
  
        idle_transceiver(tregs);
        write_tcvr_bit(bp, tregs, 0);
@@@ -982,8 -982,6 +982,6 @@@ static int bigmac_start_xmit(struct sk_
        sbus_writel(CREG_CTRL_TWAKEUP, bp->creg + CREG_CTRL);
  
  
-       dev->trans_start = jiffies;
        return NETDEV_TX_OK;
  }
  
@@@ -999,7 -997,7 +997,7 @@@ static void bigmac_set_multicast(struc
  {
        struct bigmac *bp = netdev_priv(dev);
        void __iomem *bregs = bp->bregs;
-       struct dev_mc_list *dmi;
+       struct netdev_hw_addr *ha;
        char *addrs;
        int i;
        u32 tmp, crc;
                for (i = 0; i < 4; i++)
                        hash_table[i] = 0;
  
-               netdev_for_each_mc_addr(dmi, dev) {
-                       addrs = dmi->dmi_addr;
+               netdev_for_each_mc_addr(ha, dev) {
+                       addrs = ha->addr;
  
                        if (!(*addrs & 1))
                                continue;
@@@ -1133,8 -1131,8 +1131,8 @@@ static int __devinit bigmac_ether_init(
                goto fail_and_cleanup;
  
        /* Get supported SBUS burst sizes. */
 -      bsizes = of_getintprop_default(qec_op->node, "burst-sizes", 0xff);
 -      bsizes_more = of_getintprop_default(qec_op->node, "burst-sizes", 0xff);
 +      bsizes = of_getintprop_default(qec_op->dev.of_node, "burst-sizes", 0xff);
 +      bsizes_more = of_getintprop_default(qec_op->dev.of_node, "burst-sizes", 0xff);
  
        bsizes &= 0xff;
        if (bsizes_more != 0xff)
        }
  
        /* Get the board revision of this BigMAC. */
 -      bp->board_rev = of_getintprop_default(bp->bigmac_op->node,
 +      bp->board_rev = of_getintprop_default(bp->bigmac_op->dev.of_node,
                                              "board-version", 1);
  
        /* Init auto-negotiation timer state. */
@@@ -1292,11 -1290,8 +1290,11 @@@ static const struct of_device_id bigmac
  MODULE_DEVICE_TABLE(of, bigmac_sbus_match);
  
  static struct of_platform_driver bigmac_sbus_driver = {
 -      .name           = "sunbmac",
 -      .match_table    = bigmac_sbus_match,
 +      .driver = {
 +              .name = "sunbmac",
 +              .owner = THIS_MODULE,
 +              .of_match_table = bigmac_sbus_match,
 +      },
        .probe          = bigmac_sbus_probe,
        .remove         = __devexit_p(bigmac_sbus_remove),
  };
diff --combined drivers/net/sunhme.c
index ad2cfc5bb9e1debbb7065d833e0dcb5e2840e9ea,915c5909c7a8bb90e4c6fe22617f5dbee032552c..3d9650b8d38fab26fce127f52d7a09ad1170ff6d
@@@ -855,7 -855,7 +855,7 @@@ static void happy_meal_timer(unsigned l
                hp->timer_ticks = 0;
                hp->timer_state = asleep; /* foo on you */
                break;
-       };
+       }
  
        if (restart_timer) {
                hp->happy_timer.expires = jiffies + ((12 * HZ)/10); /* 1.2 sec. */
@@@ -1488,7 -1488,7 +1488,7 @@@ static int happy_meal_init(struct happy
                HMD(("external, disable MII, "));
                hme_write32(hp, bregs + BMAC_XIFCFG, BIGMAC_XCFG_MIIDISAB);
                break;
-       };
+       }
  
        if (happy_meal_tcvr_reset(hp, tregs))
                return -EAGAIN;
                hme_write32(hp, bregs + BMAC_HTABLE3, 0xffff);
        } else if ((hp->dev->flags & IFF_PROMISC) == 0) {
                u16 hash_table[4];
-               struct dev_mc_list *dmi;
+               struct netdev_hw_addr *ha;
                char *addrs;
                u32 crc;
  
                memset(hash_table, 0, sizeof(hash_table));
-               netdev_for_each_mc_addr(dmi, hp->dev) {
-                       addrs = dmi->dmi_addr;
+               netdev_for_each_mc_addr(ha, hp->dev) {
+                       addrs = ha->addr;
  
                        if (!(*addrs & 1))
                                continue;
@@@ -1734,7 -1734,7 +1734,7 @@@ static void happy_meal_set_initial_adve
        case external:
                hme_write32(hp, bregs + BMAC_XIFCFG, BIGMAC_XCFG_MIIDISAB);
                break;
-       };
+       }
        if (happy_meal_tcvr_reset(hp, tregs))
                return;
  
@@@ -2341,8 -2341,6 +2341,6 @@@ static netdev_tx_t happy_meal_start_xmi
  
        spin_unlock_irq(&hp->happy_lock);
  
-       dev->trans_start = jiffies;
        tx_add_log(hp, TXLOG_ACTION_TXMIT, 0);
        return NETDEV_TX_OK;
  }
@@@ -2362,7 -2360,7 +2360,7 @@@ static void happy_meal_set_multicast(st
  {
        struct happy_meal *hp = netdev_priv(dev);
        void __iomem *bregs = hp->bigmacregs;
-       struct dev_mc_list *dmi;
+       struct netdev_hw_addr *ha;
        char *addrs;
        u32 crc;
  
                u16 hash_table[4];
  
                memset(hash_table, 0, sizeof(hash_table));
-               netdev_for_each_mc_addr(dmi, dev) {
-                       addrs = dmi->dmi_addr;
+               netdev_for_each_mc_addr(ha, dev) {
+                       addrs = ha->addr;
  
                        if (!(*addrs & 1))
                                continue;
@@@ -2483,7 -2481,7 +2481,7 @@@ static void hme_get_drvinfo(struct net_
        else {
                const struct linux_prom_registers *regs;
                struct of_device *op = hp->happy_dev;
 -              regs = of_get_property(op->node, "regs", NULL);
 +              regs = of_get_property(op->dev.of_node, "regs", NULL);
                if (regs)
                        sprintf(info->bus_info, "SBUS:%d",
                                regs->which_io);
@@@ -2643,14 -2641,14 +2641,14 @@@ static const struct net_device_ops hme_
  #ifdef CONFIG_SBUS
  static int __devinit happy_meal_sbus_probe_one(struct of_device *op, int is_qfe)
  {
 -      struct device_node *dp = op->node, *sbus_dp;
 +      struct device_node *dp = op->dev.of_node, *sbus_dp;
        struct quattro *qp = NULL;
        struct happy_meal *hp;
        struct net_device *dev;
        int i, qfe_slot = -1;
        int err = -ENODEV;
  
 -      sbus_dp = to_of_device(op->dev.parent)->node;
 +      sbus_dp = to_of_device(op->dev.parent)->dev.of_node;
  
        /* We can match PCI devices too, do not accept those here. */
        if (strcmp(sbus_dp->name, "sbus"))
@@@ -2945,7 -2943,6 +2943,6 @@@ static void get_hme_mac_nonsparc(struc
        dev_addr[1] = 0x00;
        dev_addr[2] = 0x20;
        get_random_bytes(&dev_addr[3], 3);
-       return;
  }
  #endif /* !(CONFIG_SPARC) */
  
@@@ -3004,7 -3001,6 +3001,6 @@@ static int __devinit happy_meal_pci_pro
        dev->base_addr = (long) pdev;
  
        hp = netdev_priv(dev);
-       memset(hp, 0, sizeof(*hp));
  
        hp->happy_dev = pdev;
        hp->dma_dev = &pdev->dev;
@@@ -3241,7 -3237,7 +3237,7 @@@ static void happy_meal_pci_exit(void
  #ifdef CONFIG_SBUS
  static int __devinit hme_sbus_probe(struct of_device *op, const struct of_device_id *match)
  {
 -      struct device_node *dp = op->node;
 +      struct device_node *dp = op->dev.of_node;
        const char *model = of_get_property(dp, "model", NULL);
        int is_qfe = (match->data != NULL);
  
@@@ -3295,11 -3291,8 +3291,11 @@@ static const struct of_device_id hme_sb
  MODULE_DEVICE_TABLE(of, hme_sbus_match);
  
  static struct of_platform_driver hme_sbus_driver = {
 -      .name           = "hme",
 -      .match_table    = hme_sbus_match,
 +      .driver = {
 +              .name = "hme",
 +              .owner = THIS_MODULE,
 +              .of_match_table = hme_sbus_match,
 +      },
        .probe          = hme_sbus_probe,
        .remove         = __devexit_p(hme_sbus_remove),
  };
diff --combined drivers/net/sunlance.c
index 0fc014ef9e98e8e578f4597896dd2f7cae9cc9b8,386af7bbe6783914f3fd683bc12d28a84b770e1a..7d9c33dd9d1acf8efc6e9925787678f050a0b80c
@@@ -1003,7 -1003,7 +1003,7 @@@ static int lance_reset(struct net_devic
        }
        lp->init_ring(dev);
        load_csrs(lp);
-       dev->trans_start = jiffies;
+       dev->trans_start = jiffies; /* prevent tx timeout */
        status = init_restart_lance(lp);
        return status;
  }
@@@ -1054,7 -1054,7 +1054,7 @@@ static void lance_piocopy_from_skb(voi
                }
                src = (char *) p16;
                break;
-       };
+       }
        if (len >= 2) {
                u16 val = src[0] << 8 | src[1];
                sbus_writew(val, piobuf);
@@@ -1160,7 -1160,6 +1160,6 @@@ static int lance_start_xmit(struct sk_b
  
        spin_unlock_irq(&lp->lock);
  
-       dev->trans_start = jiffies;
        dev_kfree_skb(skb);
  
        return NETDEV_TX_OK;
  static void lance_load_multicast(struct net_device *dev)
  {
        struct lance_private *lp = netdev_priv(dev);
-       struct dev_mc_list *dmi;
+       struct netdev_hw_addr *ha;
        char *addrs;
        u32 crc;
        u32 val;
                return;
  
        /* Add addresses */
-       netdev_for_each_mc_addr(dmi, dev) {
-               addrs = dmi->dmi_addr;
+       netdev_for_each_mc_addr(ha, dev) {
+               addrs = ha->addr;
  
                /* multicast address? */
                if (!(*addrs & 1))
@@@ -1324,7 -1323,7 +1323,7 @@@ static int __devinit sparc_lance_probe_
                                           struct of_device *ledma,
                                           struct of_device *lebuffer)
  {
 -      struct device_node *dp = op->node;
 +      struct device_node *dp = op->dev.of_node;
        static unsigned version_printed;
        struct lance_private *lp;
        struct net_device *dev;
  
        lp->burst_sizes = 0;
        if (lp->ledma) {
 -              struct device_node *ledma_dp = ledma->node;
 +              struct device_node *ledma_dp = ledma->dev.of_node;
                struct device_node *sbus_dp;
                unsigned int sbmask;
                const char *prop;
@@@ -1507,7 -1506,7 +1506,7 @@@ fail
  static int __devinit sunlance_sbus_probe(struct of_device *op, const struct of_device_id *match)
  {
        struct of_device *parent = to_of_device(op->dev.parent);
 -      struct device_node *parent_dp = parent->node;
 +      struct device_node *parent_dp = parent->dev.of_node;
        int err;
  
        if (!strcmp(parent_dp->name, "ledma")) {
@@@ -1546,11 -1545,8 +1545,11 @@@ static const struct of_device_id sunlan
  MODULE_DEVICE_TABLE(of, sunlance_sbus_match);
  
  static struct of_platform_driver sunlance_sbus_driver = {
 -      .name           = "sunlance",
 -      .match_table    = sunlance_sbus_match,
 +      .driver = {
 +              .name = "sunlance",
 +              .owner = THIS_MODULE,
 +              .of_match_table = sunlance_sbus_match,
 +      },
        .probe          = sunlance_sbus_probe,
        .remove         = __devexit_p(sunlance_sbus_remove),
  };
diff --combined drivers/net/sunqe.c
index 8fe86b287e517a52565be46a781df8e0f81d7009,a7542d25c8451f31b0420e586fd96b74e77eced4..72b579c8d8127d4d18c006c22ca631b2be06fe06
@@@ -602,7 -602,6 +602,6 @@@ static int qe_start_xmit(struct sk_buf
        qep->tx_new = NEXT_TX(entry);
  
        /* Get it going. */
-       dev->trans_start = jiffies;
        sbus_writel(CREG_CTRL_TWAKEUP, qep->qcregs + CREG_CTRL);
  
        dev->stats.tx_packets++;
  static void qe_set_multicast(struct net_device *dev)
  {
        struct sunqe *qep = netdev_priv(dev);
-       struct dev_mc_list *dmi;
+       struct netdev_hw_addr *ha;
        u8 new_mconfig = qep->mconfig;
        char *addrs;
        int i;
                u8 *hbytes = (unsigned char *) &hash_table[0];
  
                memset(hash_table, 0, sizeof(hash_table));
-               netdev_for_each_mc_addr(dmi, dev) {
-                       addrs = dmi->dmi_addr;
+               netdev_for_each_mc_addr(ha, dev) {
+                       addrs = ha->addr;
  
                        if (!(*addrs & 1))
                                continue;
@@@ -696,7 -695,7 +695,7 @@@ static void qe_get_drvinfo(struct net_d
        strcpy(info->version, "3.0");
  
        op = qep->op;
 -      regs = of_get_property(op->node, "reg", NULL);
 +      regs = of_get_property(op->dev.of_node, "reg", NULL);
        if (regs)
                sprintf(info->bus_info, "SBUS:%d", regs->which_io);
  
@@@ -800,7 -799,7 +799,7 @@@ static struct sunqec * __devinit get_qe
                        if (qec_global_reset(qecp->gregs))
                                goto fail;
  
 -                      qecp->qec_bursts = qec_get_burst(op->node);
 +                      qecp->qec_bursts = qec_get_burst(op->dev.of_node);
  
                        qec_init_once(qecp, op);
  
@@@ -858,7 -857,7 +857,7 @@@ static int __devinit qec_ether_init(str
  
        res = -ENODEV;
  
 -      i = of_getintprop_default(op->node, "channel#", -1);
 +      i = of_getintprop_default(op->dev.of_node, "channel#", -1);
        if (i == -1)
                goto fail;
        qe->channel = i;
@@@ -978,11 -977,8 +977,11 @@@ static const struct of_device_id qec_sb
  MODULE_DEVICE_TABLE(of, qec_sbus_match);
  
  static struct of_platform_driver qec_sbus_driver = {
 -      .name           = "qec",
 -      .match_table    = qec_sbus_match,
 +      .driver = {
 +              .name = "qec",
 +              .owner = THIS_MODULE,
 +              .of_match_table = qec_sbus_match,
 +      },
        .probe          = qec_sbus_probe,
        .remove         = __devexit_p(qec_sbus_remove),
  };
diff --combined drivers/net/ucc_geth.c
index 0ab51037bf885f02bec39fc7838204bc1d34b98d,932602db54b39c09b1c7bbb9e62e6a663c356903..4a34833b85ddad284c1f19efff1bf9d23ed7f7e1
@@@ -1999,7 -1999,7 +1999,7 @@@ static void ucc_geth_memclean(struct uc
  static void ucc_geth_set_multi(struct net_device *dev)
  {
        struct ucc_geth_private *ugeth;
-       struct dev_mc_list *dmi;
+       struct netdev_hw_addr *ha;
        struct ucc_fast __iomem *uf_regs;
        struct ucc_geth_82xx_address_filtering_pram __iomem *p_82xx_addr_filt;
  
                        out_be32(&p_82xx_addr_filt->gaddr_h, 0x0);
                        out_be32(&p_82xx_addr_filt->gaddr_l, 0x0);
  
-                       netdev_for_each_mc_addr(dmi, dev) {
+                       netdev_for_each_mc_addr(ha, dev) {
                                /* Only support group multicast for now.
                                 */
-                               if (!(dmi->dmi_addr[0] & 1))
+                               if (!(ha->addr[0] & 1))
                                        continue;
  
                                /* Ask CPM to run CRC and set bit in
                                 * filter mask.
                                 */
-                               hw_add_addr_in_hash(ugeth, dmi->dmi_addr);
+                               hw_add_addr_in_hash(ugeth, ha->addr);
                        }
                }
        }
@@@ -3148,8 -3148,6 +3148,6 @@@ static int ucc_geth_start_xmit(struct s
        /* set bd status and length */
        out_be32((u32 __iomem *)bd, bd_status);
  
-       dev->trans_start = jiffies;
        /* Move to next BD in the ring */
        if (!(bd_status & T_W))
                bd += sizeof(struct qe_bd);
@@@ -3721,7 -3719,7 +3719,7 @@@ static const struct net_device_ops ucc_
  static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *match)
  {
        struct device *device = &ofdev->dev;
 -      struct device_node *np = ofdev->node;
 +      struct device_node *np = ofdev->dev.of_node;
        struct net_device *dev = NULL;
        struct ucc_geth_private *ugeth = NULL;
        struct ucc_geth_info *ug_info;
        }
  
        if (netif_msg_probe(&debug))
-               printk(KERN_INFO "ucc_geth: UCC%1d at 0x%8x (irq = %d) \n",
+               printk(KERN_INFO "ucc_geth: UCC%1d at 0x%8x (irq = %d)\n",
                        ug_info->uf_info.ucc_num + 1, ug_info->uf_info.regs,
                        ug_info->uf_info.irq);
  
@@@ -3965,11 -3963,8 +3963,11 @@@ static struct of_device_id ucc_geth_mat
  MODULE_DEVICE_TABLE(of, ucc_geth_match);
  
  static struct of_platform_driver ucc_geth_driver = {
 -      .name           = DRV_NAME,
 -      .match_table    = ucc_geth_match,
 +      .driver = {
 +              .name = DRV_NAME,
 +              .owner = THIS_MODULE,
 +              .of_match_table = ucc_geth_match,
 +      },
        .probe          = ucc_geth_probe,
        .remove         = ucc_geth_remove,
        .suspend        = ucc_geth_suspend,
index 67f9237237dde2a5623ef0ce6a92596610dfb56e,a7db68d37ee98c3e3359507ad31630110a55d8f4..d04c5b262050a9aefef0f48cde2bfa2f700510a7
@@@ -558,7 -558,7 +558,7 @@@ static void xemaclite_tx_timeout(struc
        }
  
        /* To exclude tx timeout */
-       dev->trans_start = 0xffffffff - TX_TIMEOUT - TX_TIMEOUT;
+       dev->trans_start = jiffies; /* prevent tx timeout */
  
        /* We're all ready to go. Start the queue */
        netif_wake_queue(dev);
@@@ -590,7 -590,7 +590,7 @@@ static void xemaclite_tx_handler(struc
                        dev->stats.tx_bytes += lp->deferred_skb->len;
                        dev_kfree_skb_irq(lp->deferred_skb);
                        lp->deferred_skb = NULL;
-                       dev->trans_start = jiffies;
+                       dev->trans_start = jiffies; /* prevent tx timeout */
                        netif_wake_queue(dev);
                }
        }
@@@ -639,7 -639,6 +639,6 @@@ static void xemaclite_rx_handler(struc
        }
  
        skb_put(skb, len);      /* Tell the skb how much data we got */
-       skb->dev = dev;         /* Fill out required meta-data */
  
        skb->protocol = eth_type_trans(skb, dev);
        skb->ip_summed = CHECKSUM_NONE;
@@@ -1055,7 -1054,6 +1054,6 @@@ static int xemaclite_send(struct sk_buf
  
        dev->stats.tx_bytes += len;
        dev_kfree_skb(new_skb);
-       dev->trans_start = jiffies;
  
        return 0;
  }
@@@ -1090,7 -1088,7 +1088,7 @@@ static void xemaclite_remove_ndev(struc
   */
  static bool get_bool(struct of_device *ofdev, const char *s)
  {
 -      u32 *p = (u32 *)of_get_property(ofdev->node, s, NULL);
 +      u32 *p = (u32 *)of_get_property(ofdev->dev.of_node, s, NULL);
  
        if (p) {
                return (bool)*p;
@@@ -1132,14 -1130,14 +1130,14 @@@ static int __devinit xemaclite_of_probe
        dev_info(dev, "Device Tree Probing\n");
  
        /* Get iospace for the device */
 -      rc = of_address_to_resource(ofdev->node, 0, &r_mem);
 +      rc = of_address_to_resource(ofdev->dev.of_node, 0, &r_mem);
        if (rc) {
                dev_err(dev, "invalid address\n");
                return rc;
        }
  
        /* Get IRQ for the device */
 -      rc = of_irq_to_resource(ofdev->node, 0, &r_irq);
 +      rc = of_irq_to_resource(ofdev->dev.of_node, 0, &r_irq);
        if (rc == NO_IRQ) {
                dev_err(dev, "no IRQ found\n");
                return rc;
        }
  
        /* Get the virtual base address for the device */
-       lp->base_addr = ioremap(r_mem.start, r_mem.end - r_mem.start + 1);
+       lp->base_addr = ioremap(r_mem.start, resource_size(&r_mem));
        if (NULL == lp->base_addr) {
                dev_err(dev, "EmacLite: Could not allocate iomem\n");
                rc = -EIO;
        lp->next_rx_buf_to_use = 0x0;
        lp->tx_ping_pong = get_bool(ofdev, "xlnx,tx-ping-pong");
        lp->rx_ping_pong = get_bool(ofdev, "xlnx,rx-ping-pong");
 -      mac_address = of_get_mac_address(ofdev->node);
 +      mac_address = of_get_mac_address(ofdev->dev.of_node);
  
        if (mac_address)
                /* Set the MAC address. */
        /* Set the MAC address in the EmacLite device */
        xemaclite_update_address(lp, ndev->dev_addr);
  
 -      lp->phy_node = of_parse_phandle(ofdev->node, "phy-handle", 0);
 +      lp->phy_node = of_parse_phandle(ofdev->dev.of_node, "phy-handle", 0);
        rc = xemaclite_mdio_setup(lp, &ofdev->dev);
        if (rc)
                dev_warn(&ofdev->dev, "error registering MDIO bus\n");
        return 0;
  
  error1:
-       release_mem_region(ndev->mem_start, r_mem.end - r_mem.start + 1);
+       release_mem_region(ndev->mem_start, resource_size(&r_mem));
  
  error2:
        xemaclite_remove_ndev(ndev);
@@@ -1293,11 -1291,8 +1291,11 @@@ static struct of_device_id xemaclite_of
  MODULE_DEVICE_TABLE(of, xemaclite_of_match);
  
  static struct of_platform_driver xemaclite_of_driver = {
 -      .name           = DRIVER_NAME,
 -      .match_table    = xemaclite_of_match,
 +      .driver = {
 +              .name = DRIVER_NAME,
 +              .owner = THIS_MODULE,
 +              .of_match_table = xemaclite_of_match,
 +      },
        .probe          = xemaclite_of_probe,
        .remove         = __devexit_p(xemaclite_of_remove),
  };
diff --combined drivers/of/of_mdio.c
index 794fbc2ef73d1d668c1cb4cfeceece8f71a94756,b4748337223b43d28aa7fb11d7eb788ec29d6da4..42a6715f8e84287ed2eef40382dc7bc89e181fbf
@@@ -69,7 -69,7 +69,7 @@@ int of_mdiobus_register(struct mii_bus 
                }
  
                phy = get_phy_device(mdio, be32_to_cpup(addr));
-               if (!phy) {
+               if (!phy || IS_ERR(phy)) {
                        dev_err(&mdio->dev, "error probing PHY at address %i\n",
                                *addr);
                        continue;
@@@ -79,7 -79,7 +79,7 @@@
                /* Associate the OF node with the device structure so it
                 * can be looked up later */
                of_node_get(child);
 -              dev_archdata_set_node(&phy->dev.archdata, child);
 +              phy->dev.of_node = child;
  
                /* All data is now stored in the phy struct; register it */
                rc = phy_device_register(phy);
@@@ -100,7 -100,7 +100,7 @@@ EXPORT_SYMBOL(of_mdiobus_register)
  /* Helper function for of_phy_find_device */
  static int of_phy_match(struct device *dev, void *phy_np)
  {
 -      return dev_archdata_get_node(&dev->archdata) == phy_np;
 +      return dev->of_node == phy_np;
  }
  
  /**
@@@ -166,7 -166,7 +166,7 @@@ struct phy_device *of_phy_connect_fixed
        if (!dev->dev.parent)
                return NULL;
  
 -      net_np = dev_archdata_get_node(&dev->dev.parent->archdata);
 +      net_np = dev->dev.parent->of_node;
        if (!net_np)
                return NULL;
  
index 0427e586975f38ffb620453fa06cb2978606c9de,d3b62eb0fba7abf2f9547de5a410179e27fa81bf..368d66294d831ea8fdba4ef0e1e66c92b7f5fd87
@@@ -105,9 -105,9 +105,9 @@@ static ssize_
  flash_read(struct file * file, char __user * buf,
           size_t count, loff_t *ppos)
  {
-       unsigned long p = file->f_pos;
+       loff_t p = *ppos;
        int i;
-       
        if (count > flash.read_size - p)
                count = flash.read_size - p;
  
                buf++;
        }
  
-       file->f_pos += count;
+       *ppos += count;
        return count;
  }
  
@@@ -162,7 -162,7 +162,7 @@@ static struct miscdevice flash_dev = { 
  static int __devinit flash_probe(struct of_device *op,
                                 const struct of_device_id *match)
  {
 -      struct device_node *dp = op->node;
 +      struct device_node *dp = op->dev.of_node;
        struct device_node *parent;
  
        parent = dp->parent;
        flash.busy = 0;
  
        printk(KERN_INFO "%s: OBP Flash, RD %lx[%lx] WR %lx[%lx]\n",
 -             op->node->full_name,
 +             op->dev.of_node->full_name,
               flash.read_base, flash.read_size,
               flash.write_base, flash.write_size);
  
@@@ -207,11 -207,8 +207,11 @@@ static const struct of_device_id flash_
  MODULE_DEVICE_TABLE(of, flash_match);
  
  static struct of_platform_driver flash_driver = {
 -      .name           = "flash",
 -      .match_table    = flash_match,
 +      .driver = {
 +              .name = "flash",
 +              .owner = THIS_MODULE,
 +              .of_match_table = flash_match,
 +      },
        .probe          = flash_probe,
        .remove         = __devexit_p(flash_remove),
  };
index 60cd4ec51eae9090bd9b2279511a59fc73d43f4c,3eb2b7b3d8b0ec7e1e0860495b14ac7167bade7f..fef49521cbc3f6888684789f4bd50a67f1b5a3bb
@@@ -1157,7 -1157,7 +1157,7 @@@ static void ibmvfc_gather_partition_inf
  static void ibmvfc_set_login_info(struct ibmvfc_host *vhost)
  {
        struct ibmvfc_npiv_login *login_info = &vhost->login_info;
 -      struct device_node *of_node = vhost->dev->archdata.of_node;
 +      struct device_node *of_node = vhost->dev->of_node;
        const char *location;
  
        memset(login_info, 0, sizeof(*login_info));
@@@ -2245,7 -2245,7 +2245,7 @@@ static int ibmvfc_wait_for_ops(struct i
        DECLARE_COMPLETION_ONSTACK(comp);
        int wait;
        unsigned long flags;
-       signed long timeout = init_timeout * HZ;
+       signed long timeout = IBMVFC_ABORT_WAIT_TIMEOUT * HZ;
  
        ENTER;
        do {
@@@ -2919,6 -2919,7 +2919,7 @@@ static DEVICE_ATTR(log_level, S_IRUGO 
  #ifdef CONFIG_SCSI_IBMVFC_TRACE
  /**
   * ibmvfc_read_trace - Dump the adapter trace
+  * @filp:             open sysfs file
   * @kobj:             kobject struct
   * @bin_attr: bin_attribute struct
   * @buf:              buffer
   * Return value:
   *    number of bytes printed to buffer
   **/
- static ssize_t ibmvfc_read_trace(struct kobject *kobj,
+ static ssize_t ibmvfc_read_trace(struct file *filp, struct kobject *kobj,
                                 struct bin_attribute *bin_attr,
                                 char *buf, loff_t off, size_t count)
  {
@@@ -3013,6 -3014,7 +3014,7 @@@ static struct ibmvfc_async_crq *ibmvfc_
        if (crq->valid & 0x80) {
                if (++async_crq->cur == async_crq->size)
                        async_crq->cur = 0;
+               rmb();
        } else
                crq = NULL;
  
@@@ -3035,6 -3037,7 +3037,7 @@@ static struct ibmvfc_crq *ibmvfc_next_c
        if (crq->valid & 0x80) {
                if (++queue->cur == queue->size)
                        queue->cur = 0;
+               rmb();
        } else
                crq = NULL;
  
@@@ -3083,12 -3086,14 +3086,14 @@@ static void ibmvfc_tasklet(void *data
                while ((async = ibmvfc_next_async_crq(vhost)) != NULL) {
                        ibmvfc_handle_async(async, vhost);
                        async->valid = 0;
+                       wmb();
                }
  
                /* Pull all the valid messages off the CRQ */
                while ((crq = ibmvfc_next_crq(vhost)) != NULL) {
                        ibmvfc_handle_crq(crq, vhost);
                        crq->valid = 0;
+                       wmb();
                }
  
                vio_enable_interrupts(vdev);
                        vio_disable_interrupts(vdev);
                        ibmvfc_handle_async(async, vhost);
                        async->valid = 0;
+                       wmb();
                } else if ((crq = ibmvfc_next_crq(vhost)) != NULL) {
                        vio_disable_interrupts(vdev);
                        ibmvfc_handle_crq(crq, vhost);
                        crq->valid = 0;
+                       wmb();
                } else
                        done = 1;
        }
index cc38fefc26124fea3cbcd4a1b17195b71e2810e6,88bad0e81bdda3b5195396b9e2e6d0d7dc4f26e2..aad35cc41e49bfbfb7d27c3b28b8759dd60962d2
@@@ -323,16 -323,6 +323,6 @@@ static void set_srp_direction(struct sc
                srp_cmd->buf_fmt = fmt;
  }
  
- static void unmap_sg_list(int num_entries,
-               struct device *dev,
-               struct srp_direct_buf *md)
- {
-       int i;
-       for (i = 0; i < num_entries; ++i)
-               dma_unmap_single(dev, md[i].va, md[i].len, DMA_BIDIRECTIONAL);
- }
  /**
   * unmap_cmd_data: - Unmap data pointed in srp_cmd based on the format
   * @cmd:      srp_cmd whose additional_data member will be unmapped
@@@ -350,24 -340,9 +340,9 @@@ static void unmap_cmd_data(struct srp_c
  
        if (out_fmt == SRP_NO_DATA_DESC && in_fmt == SRP_NO_DATA_DESC)
                return;
-       else if (out_fmt == SRP_DATA_DESC_DIRECT ||
-                in_fmt == SRP_DATA_DESC_DIRECT) {
-               struct srp_direct_buf *data =
-                       (struct srp_direct_buf *) cmd->add_data;
-               dma_unmap_single(dev, data->va, data->len, DMA_BIDIRECTIONAL);
-       } else {
-               struct srp_indirect_buf *indirect =
-                       (struct srp_indirect_buf *) cmd->add_data;
-               int num_mapped = indirect->table_desc.len /
-                       sizeof(struct srp_direct_buf);
-               if (num_mapped <= MAX_INDIRECT_BUFS) {
-                       unmap_sg_list(num_mapped, dev, &indirect->desc_list[0]);
-                       return;
-               }
  
-               unmap_sg_list(num_mapped, dev, evt_struct->ext_list);
-       }
+       if (evt_struct->cmnd)
+               scsi_dma_unmap(evt_struct->cmnd);
  }
  
  static int map_sg_list(struct scsi_cmnd *cmd, int nseg,
@@@ -957,7 -932,7 +932,7 @@@ static void send_mad_capabilities(struc
        struct viosrp_capabilities *req;
        struct srp_event_struct *evt_struct;
        unsigned long flags;
 -      struct device_node *of_node = hostdata->dev->archdata.of_node;
 +      struct device_node *of_node = hostdata->dev->of_node;
        const char *location;
  
        evt_struct = get_event_struct(&hostdata->pool);
index 4fb32e3748c207865e5b9edd9277cae3ccbf8689,02469c31bf0b6939f37e96e03ac7e1af98a45a14..beb4710faeee46a89994fde4e3072848590082f0
   * kind, whether express or implied.
   */
  
- /* Platform device Usage :
-  *
-  * Since PSCs can have multiple function, the correct driver for each one
-  * is selected by calling mpc52xx_match_psc_function(...). The function
-  * handled by this driver is "uart".
-  *
-  * The driver init all necessary registers to place the PSC in uart mode without
-  * DCD. However, the pin multiplexing aren't changed and should be set either
-  * by the bootloader or in the platform init code.
-  *
-  * The idx field must be equal to the PSC index (e.g. 0 for PSC1, 1 for PSC2,
-  * and so on). So the PSC1 is mapped to /dev/ttyPSC0, PSC2 to /dev/ttyPSC1 and
-  * so on. But be warned, it's an ABSOLUTE REQUIREMENT ! This is needed mainly
-  * fpr the console code : without this 1:1 mapping, at early boot time, when we
-  * are parsing the kernel args console=ttyPSC?, we wouldn't know which PSC it
-  * will be mapped to.
-  */
- /* OF Platform device Usage :
-  *
-  * This driver is only used for PSCs configured in uart mode.  The device
-  * tree will have a node for each PSC with "mpc52xx-psc-uart" in the compatible
-  * list.
-  *
-  * By default, PSC devices are enumerated in the order they are found.  However
-  * a particular PSC number can be forces by adding 'device_no = <port#>'
-  * to the device node.
-  *
-  * The driver init all necessary registers to place the PSC in uart mode without
-  * DCD. However, the pin multiplexing aren't changed and should be set either
-  * by the bootloader or in the platform init code.
-  */
  #undef DEBUG
  
  #include <linux/device.h>
@@@ -1328,14 -1295,14 +1295,14 @@@ mpc52xx_uart_of_probe(struct of_device 
  
        /* Check validity & presence */
        for (idx = 0; idx < MPC52xx_PSC_MAXNUM; idx++)
 -              if (mpc52xx_uart_nodes[idx] == op->node)
 +              if (mpc52xx_uart_nodes[idx] == op->dev.of_node)
                        break;
        if (idx >= MPC52xx_PSC_MAXNUM)
                return -EINVAL;
        pr_debug("Found %s assigned to ttyPSC%x\n",
                 mpc52xx_uart_nodes[idx]->full_name, idx);
  
 -      uartclk = psc_ops->getuartclk(op->node);
 +      uartclk = psc_ops->getuartclk(op->dev.of_node);
        if (uartclk == 0) {
                dev_dbg(&op->dev, "Could not find uart clock frequency!\n");
                return -EINVAL;
        port->dev       = &op->dev;
  
        /* Search for IRQ and mapbase */
 -      ret = of_address_to_resource(op->node, 0, &res);
 +      ret = of_address_to_resource(op->dev.of_node, 0, &res);
        if (ret)
                return ret;
  
                return -EINVAL;
        }
  
 -      psc_ops->get_irq(port, op->node);
 +      psc_ops->get_irq(port, op->dev.of_node);
        if (port->irq == NO_IRQ) {
                dev_dbg(&op->dev, "Could not get irq\n");
                return -EINVAL;
@@@ -1464,16 -1431,15 +1431,16 @@@ mpc52xx_uart_of_enumerate(void
  MODULE_DEVICE_TABLE(of, mpc52xx_uart_of_match);
  
  static struct of_platform_driver mpc52xx_uart_of_driver = {
 -      .match_table    = mpc52xx_uart_of_match,
        .probe          = mpc52xx_uart_of_probe,
        .remove         = mpc52xx_uart_of_remove,
  #ifdef CONFIG_PM
        .suspend        = mpc52xx_uart_of_suspend,
        .resume         = mpc52xx_uart_of_resume,
  #endif
 -      .driver         = {
 -              .name   = "mpc52xx-psc-uart",
 +      .driver = {
 +              .name = "mpc52xx-psc-uart",
 +              .owner = THIS_MODULE,
 +              .of_match_table = mpc52xx_uart_of_match,
        },
  };
  
@@@ -1501,7 -1467,7 +1468,7 @@@ mpc52xx_uart_init(void
        /*
         * Map the PSC FIFO Controller and init if on MPC512x.
         */
-       if (psc_ops->fifoc_init) {
+       if (psc_ops && psc_ops->fifoc_init) {
                ret = psc_ops->fifoc_init();
                if (ret)
                        return ret;
index 1e43bf59c44d6ad9b8845aa8e1bffe2c01859f7c,700e10833bf98965280491ba49771b1ad7c3d618..cabbdc7ba5838bf62e1fa799a6ed2678eb650864
@@@ -752,8 -752,10 +752,10 @@@ static void pmz_break_ctl(struct uart_p
                uap->curregs[R5] = new_reg;
  
                /* NOTE: Not subject to 'transmitter active' rule. */
-               if (ZS_IS_ASLEEP(uap))
+               if (ZS_IS_ASLEEP(uap)) {
+                       spin_unlock_irqrestore(&port->lock, flags);
                        return;
+               }
                write_zsreg(uap, R5, uap->curregs[R5]);
        }
  
@@@ -1609,7 -1611,7 +1611,7 @@@ static int pmz_attach(struct macio_dev 
        /* Iterate the pmz_ports array to find a matching entry
         */
        for (i = 0; i < MAX_ZS_PORTS; i++)
 -              if (pmz_ports[i].node == mdev->ofdev.node) {
 +              if (pmz_ports[i].node == mdev->ofdev.dev.of_node) {
                        struct uart_pmac_port *uap = &pmz_ports[i];
  
                        uap->dev = mdev;
index 34fb8e84504f74dbdb836090c620a4a525fe89b1,978b3cee02d72f0f1430b952f71b4c25f4499473..f9a24f4ebb3479626073c23ffa906320dcf025a5
@@@ -102,6 -102,8 +102,8 @@@ struct uart_sunzilog_port 
  #endif
  };
  
+ static void sunzilog_putchar(struct uart_port *port, int ch);
  #define ZILOG_CHANNEL_FROM_PORT(PORT) ((struct zilog_channel __iomem *)((PORT)->membase))
  #define UART_ZILOG(PORT)              ((struct uart_sunzilog_port *)(PORT))
  
@@@ -996,6 -998,50 +998,50 @@@ static int sunzilog_verify_port(struct 
        return -EINVAL;
  }
  
+ #ifdef CONFIG_CONSOLE_POLL
+ static int sunzilog_get_poll_char(struct uart_port *port)
+ {
+       unsigned char ch, r1;
+       struct uart_sunzilog_port *up = (struct uart_sunzilog_port *) port;
+       struct zilog_channel __iomem *channel
+               = ZILOG_CHANNEL_FROM_PORT(&up->port);
+       r1 = read_zsreg(channel, R1);
+       if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR)) {
+               writeb(ERR_RES, &channel->control);
+               ZSDELAY();
+               ZS_WSYNC(channel);
+       }
+       ch = readb(&channel->control);
+       ZSDELAY();
+       /* This funny hack depends upon BRK_ABRT not interfering
+        * with the other bits we care about in R1.
+        */
+       if (ch & BRK_ABRT)
+               r1 |= BRK_ABRT;
+       if (!(ch & Rx_CH_AV))
+               return NO_POLL_CHAR;
+       ch = readb(&channel->data);
+       ZSDELAY();
+       ch &= up->parity_mask;
+       return ch;
+ }
+ static void sunzilog_put_poll_char(struct uart_port *port,
+                       unsigned char ch)
+ {
+       struct uart_sunzilog_port *up = (struct uart_sunzilog_port *)port;
+       sunzilog_putchar(&up->port, ch);
+ }
+ #endif /* CONFIG_CONSOLE_POLL */
  static struct uart_ops sunzilog_pops = {
        .tx_empty       =       sunzilog_tx_empty,
        .set_mctrl      =       sunzilog_set_mctrl,
        .request_port   =       sunzilog_request_port,
        .config_port    =       sunzilog_config_port,
        .verify_port    =       sunzilog_verify_port,
+ #ifdef CONFIG_CONSOLE_POLL
+       .poll_get_char  =       sunzilog_get_poll_char,
+       .poll_put_char  =       sunzilog_put_poll_char,
+ #endif
  };
  
  static int uart_chip_count;
@@@ -1180,7 -1230,7 +1230,7 @@@ static int __init sunzilog_console_setu
               (sunzilog_reg.minor - 64) + con->index, con->index);
  
        /* Get firmware console settings.  */
 -      sunserial_console_termios(con, to_of_device(up->port.dev)->node);
 +      sunserial_console_termios(con, to_of_device(up->port.dev)->dev.of_node);
  
        /* Firmware console speed is limited to 150-->38400 baud so
         * this hackish cflag thing is OK.
@@@ -1358,7 -1408,7 +1408,7 @@@ static int __devinit zs_probe(struct of
        int keyboard_mouse = 0;
        int err;
  
 -      if (of_find_property(op->node, "keyboard", NULL))
 +      if (of_find_property(op->dev.of_node, "keyboard", NULL))
                keyboard_mouse = 1;
  
        /* uarts must come before keyboards/mice */
        sunzilog_init_hw(&up[1]);
  
        if (!keyboard_mouse) {
 -              if (sunserial_console_match(SUNZILOG_CONSOLE(), op->node,
 +              if (sunserial_console_match(SUNZILOG_CONSOLE(), op->dev.of_node,
                                            &sunzilog_reg, up[0].port.line,
                                            false))
                        up->flags |= SUNZILOG_FLAG_IS_CONS;
                                   rp, sizeof(struct zilog_layout));
                        return err;
                }
 -              if (sunserial_console_match(SUNZILOG_CONSOLE(), op->node,
 +              if (sunserial_console_match(SUNZILOG_CONSOLE(), op->dev.of_node,
                                            &sunzilog_reg, up[1].port.line,
                                            false))
                        up->flags |= SUNZILOG_FLAG_IS_CONS;
@@@ -1491,11 -1541,8 +1541,11 @@@ static const struct of_device_id zs_mat
  MODULE_DEVICE_TABLE(of, zs_match);
  
  static struct of_platform_driver zs_driver = {
 -      .name           = "zs",
 -      .match_table    = zs_match,
 +      .driver = {
 +              .name = "zs",
 +              .owner = THIS_MODULE,
 +              .of_match_table = zs_match,
 +      },
        .probe          = zs_probe,
        .remove         = __devexit_p(zs_remove),
  };
index 81073e3426e08dc5eaa2f9ade8b9eb02265203cc,e6639a95d2768563ffc87846db8e3232933a95e1..8acccd564378aaa405f2fb04cf1958b532499993
@@@ -86,7 -86,7 +86,7 @@@ static int ulite_receive(struct uart_po
        /* stats */
        if (stat & ULITE_STATUS_RXVALID) {
                port->icount.rx++;
-               ch = readb(port->membase + ULITE_RX);
+               ch = ioread32be(port->membase + ULITE_RX);
  
                if (stat & ULITE_STATUS_PARITY)
                        port->icount.parity++;
@@@ -131,7 -131,7 +131,7 @@@ static int ulite_transmit(struct uart_p
                return 0;
  
        if (port->x_char) {
-               writeb(port->x_char, port->membase + ULITE_TX);
+               iowrite32be(port->x_char, port->membase + ULITE_TX);
                port->x_char = 0;
                port->icount.tx++;
                return 1;
        if (uart_circ_empty(xmit) || uart_tx_stopped(port))
                return 0;
  
-       writeb(xmit->buf[xmit->tail], port->membase + ULITE_TX);
+       iowrite32be(xmit->buf[xmit->tail], port->membase + ULITE_TX);
        xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE-1);
        port->icount.tx++;
  
@@@ -157,7 -157,7 +157,7 @@@ static irqreturn_t ulite_isr(int irq, v
        int busy, n = 0;
  
        do {
-               int stat = readb(port->membase + ULITE_STATUS);
+               int stat = ioread32be(port->membase + ULITE_STATUS);
                busy  = ulite_receive(port, stat);
                busy |= ulite_transmit(port, stat);
                n++;
@@@ -178,7 -178,7 +178,7 @@@ static unsigned int ulite_tx_empty(stru
        unsigned int ret;
  
        spin_lock_irqsave(&port->lock, flags);
-       ret = readb(port->membase + ULITE_STATUS);
+       ret = ioread32be(port->membase + ULITE_STATUS);
        spin_unlock_irqrestore(&port->lock, flags);
  
        return ret & ULITE_STATUS_TXEMPTY ? TIOCSER_TEMT : 0;
@@@ -201,7 -201,7 +201,7 @@@ static void ulite_stop_tx(struct uart_p
  
  static void ulite_start_tx(struct uart_port *port)
  {
-       ulite_transmit(port, readb(port->membase + ULITE_STATUS));
+       ulite_transmit(port, ioread32be(port->membase + ULITE_STATUS));
  }
  
  static void ulite_stop_rx(struct uart_port *port)
@@@ -230,17 -230,17 +230,17 @@@ static int ulite_startup(struct uart_po
        if (ret)
                return ret;
  
-       writeb(ULITE_CONTROL_RST_RX | ULITE_CONTROL_RST_TX,
+       iowrite32be(ULITE_CONTROL_RST_RX | ULITE_CONTROL_RST_TX,
               port->membase + ULITE_CONTROL);
-       writeb(ULITE_CONTROL_IE, port->membase + ULITE_CONTROL);
+       iowrite32be(ULITE_CONTROL_IE, port->membase + ULITE_CONTROL);
  
        return 0;
  }
  
  static void ulite_shutdown(struct uart_port *port)
  {
-       writeb(0, port->membase + ULITE_CONTROL);
-       readb(port->membase + ULITE_CONTROL); /* dummy */
+       iowrite32be(0, port->membase + ULITE_CONTROL);
+       ioread32be(port->membase + ULITE_CONTROL); /* dummy */
        free_irq(port->irq, port);
  }
  
@@@ -352,7 -352,7 +352,7 @@@ static void ulite_console_wait_tx(struc
  
        /* Spin waiting for TX fifo to have space available */
        for (i = 0; i < 100000; i++) {
-               val = readb(port->membase + ULITE_STATUS);
+               val = ioread32be(port->membase + ULITE_STATUS);
                if ((val & ULITE_STATUS_TXFULL) == 0)
                        break;
                cpu_relax();
  static void ulite_console_putchar(struct uart_port *port, int ch)
  {
        ulite_console_wait_tx(port);
-       writeb(ch, port->membase + ULITE_TX);
+       iowrite32be(ch, port->membase + ULITE_TX);
  }
  
  static void ulite_console_write(struct console *co, const char *s,
                spin_lock_irqsave(&port->lock, flags);
  
        /* save and disable interrupt */
-       ier = readb(port->membase + ULITE_STATUS) & ULITE_STATUS_IE;
-       writeb(0, port->membase + ULITE_CONTROL);
+       ier = ioread32be(port->membase + ULITE_STATUS) & ULITE_STATUS_IE;
+       iowrite32be(0, port->membase + ULITE_CONTROL);
  
        uart_console_write(port, s, count, ulite_console_putchar);
  
  
        /* restore interrupt state */
        if (ier)
-               writeb(ULITE_CONTROL_IE, port->membase + ULITE_CONTROL);
+               iowrite32be(ULITE_CONTROL_IE, port->membase + ULITE_CONTROL);
  
        if (locked)
                spin_unlock_irqrestore(&port->lock, flags);
@@@ -591,17 -591,17 +591,17 @@@ ulite_of_probe(struct of_device *op, co
  
        dev_dbg(&op->dev, "%s(%p, %p)\n", __func__, op, match);
  
 -      rc = of_address_to_resource(op->node, 0, &res);
 +      rc = of_address_to_resource(op->dev.of_node, 0, &res);
        if (rc) {
                dev_err(&op->dev, "invalid address\n");
                return rc;
        }
  
 -      irq = irq_of_parse_and_map(op->node, 0);
 +      irq = irq_of_parse_and_map(op->dev.of_node, 0);
  
 -      id = of_get_property(op->node, "port-number", NULL);
 +      id = of_get_property(op->dev.of_node, "port-number", NULL);
  
-       return ulite_assign(&op->dev, id ? *id : -1, res.start+3, irq);
+       return ulite_assign(&op->dev, id ? *id : -1, res.start, irq);
  }
  
  static int __devexit ulite_of_remove(struct of_device *op)
  }
  
  static struct of_platform_driver ulite_of_driver = {
 -      .owner = THIS_MODULE,
 -      .name = "uartlite",
 -      .match_table = ulite_of_match,
        .probe = ulite_of_probe,
        .remove = __devexit_p(ulite_of_remove),
        .driver = {
                .name = "uartlite",
 +              .owner = THIS_MODULE,
 +              .of_match_table = ulite_of_match,
        },
  };
  
index 77ab15e330d03df094af1306175726c3e5267e56,e324627d97a2db99156cc5e848620a493e26b2cd..75b7f8c0babc7c611ae0e7fe13c8f3727f0cbd11
@@@ -640,7 -640,7 +640,7 @@@ static int mpc8xxx_spi_setup(struct spi
        }
        mpc8xxx_spi = spi_master_get_devdata(spi->master);
  
-       hw_mode = cs->hw_mode; /* Save orginal settings */
+       hw_mode = cs->hw_mode; /* Save original settings */
        cs->hw_mode = mpc8xxx_spi_read_reg(&mpc8xxx_spi->base->mode);
        /* mask out bits we are going to set */
        cs->hw_mode &= ~(SPMODE_CP_BEGIN_EDGECLK | SPMODE_CI_INACTIVEHIGH
@@@ -797,7 -797,7 +797,7 @@@ static void mpc8xxx_spi_free_dummy_rx(v
  static unsigned long mpc8xxx_spi_cpm_get_pram(struct mpc8xxx_spi *mspi)
  {
        struct device *dev = mspi->dev;
 -      struct device_node *np = dev_archdata_get_node(&dev->archdata);
 +      struct device_node *np = dev->of_node;
        const u32 *iprop;
        int size;
        unsigned long spi_base_ofs;
  static int mpc8xxx_spi_cpm_init(struct mpc8xxx_spi *mspi)
  {
        struct device *dev = mspi->dev;
 -      struct device_node *np = dev_archdata_get_node(&dev->archdata);
 +      struct device_node *np = dev->of_node;
        const u32 *iprop;
        int size;
        unsigned long pram_ofs;
@@@ -1123,7 -1123,7 +1123,7 @@@ static void mpc8xxx_spi_cs_control(stru
  
  static int of_mpc8xxx_spi_get_chipselects(struct device *dev)
  {
 -      struct device_node *np = dev_archdata_get_node(&dev->archdata);
 +      struct device_node *np = dev->of_node;
        struct fsl_spi_platform_data *pdata = dev->platform_data;
        struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(pdata);
        unsigned int ngpios;
@@@ -1224,7 -1224,7 +1224,7 @@@ static int __devinit of_mpc8xxx_spi_pro
                                          const struct of_device_id *ofid)
  {
        struct device *dev = &ofdev->dev;
 -      struct device_node *np = ofdev->node;
 +      struct device_node *np = ofdev->dev.of_node;
        struct mpc8xxx_spi_probe_info *pinfo;
        struct fsl_spi_platform_data *pdata;
        struct spi_master *master;
@@@ -1312,11 -1312,8 +1312,11 @@@ static const struct of_device_id of_mpc
  MODULE_DEVICE_TABLE(of, of_mpc8xxx_spi_match);
  
  static struct of_platform_driver of_mpc8xxx_spi_driver = {
 -      .name           = "mpc8xxx_spi",
 -      .match_table    = of_mpc8xxx_spi_match,
 +      .driver = {
 +              .name = "mpc8xxx_spi",
 +              .owner = THIS_MODULE,
 +              .of_match_table = of_mpc8xxx_spi_match,
 +      },
        .probe          = of_mpc8xxx_spi_probe,
        .remove         = __devexit_p(of_mpc8xxx_spi_remove),
  };
index 7b5c62654bfd5baaea2f4de0b4b6f839fa4cb678,90453379a43469237c88ecde2ec2b3a0ba5ed94e..c7c8392a88b9ed02c9dc1ebbd61a190c2cac1ccb
  #include <linux/interrupt.h>
  #include <linux/io.h>
  #include <linux/usb.h>
+ #include <linux/usb/hcd.h>
  #include <linux/of_platform.h>
  #include <linux/of_gpio.h>
  #include <linux/slab.h>
  #include <asm/qe.h>
  #include <asm/fsl_gtm.h>
- #include "../core/hcd.h"
  #include "fhci.h"
  
  void fhci_start_sof_timer(struct fhci_hcd *fhci)
@@@ -565,7 -565,7 +565,7 @@@ static int __devinit of_fhci_probe(stru
                                   const struct of_device_id *ofid)
  {
        struct device *dev = &ofdev->dev;
 -      struct device_node *node = ofdev->node;
 +      struct device_node *node = dev->of_node;
        struct usb_hcd *hcd;
        struct fhci_hcd *fhci;
        struct resource usb_regs;
        }
  
        for (j = 0; j < NUM_PINS; j++) {
 -              fhci->pins[j] = qe_pin_request(ofdev->node, j);
 +              fhci->pins[j] = qe_pin_request(node, j);
                if (IS_ERR(fhci->pins[j])) {
                        ret = PTR_ERR(fhci->pins[j]);
                        dev_err(dev, "can't get pin %d: %d\n", j, ret);
@@@ -813,11 -813,8 +813,11 @@@ static const struct of_device_id of_fhc
  MODULE_DEVICE_TABLE(of, of_fhci_match);
  
  static struct of_platform_driver of_fhci_driver = {
 -      .name           = "fsl,usb-fhci",
 -      .match_table    = of_fhci_match,
 +      .driver = {
 +              .name = "fsl,usb-fhci",
 +              .owner = THIS_MODULE,
 +              .of_match_table = of_fhci_match,
 +      },
        .probe          = of_fhci_probe,
        .remove         = __devexit_p(of_fhci_remove),
  };
index 100d5faebe3c02d695df877d48561d3c5782083f,8f0259eaa2c73094bbfcfbcbd6905882d40bd0fa..ec85d0c3cc3e79de60700bd480f41bfdc1448f6e
@@@ -13,8 -13,8 +13,8 @@@
  #include <linux/io.h>
  #include <linux/platform_device.h>
  #include <linux/usb/isp1760.h>
+ #include <linux/usb/hcd.h>
  
- #include "../core/hcd.h"
  #include "isp1760-hcd.h"
  
  #ifdef CONFIG_PPC_OF
@@@ -31,12 -31,12 +31,12 @@@ static int of_isp1760_probe(struct of_d
                const struct of_device_id *match)
  {
        struct usb_hcd *hcd;
 -      struct device_node *dp = dev->node;
 +      struct device_node *dp = dev->dev.of_node;
        struct resource *res;
        struct resource memory;
        struct of_irq oirq;
        int virq;
-       u64 res_len;
+       resource_size_t res_len;
        int ret;
        const unsigned int *prop;
        unsigned int devflags = 0;
        if (ret)
                return -ENXIO;
  
-       res = request_mem_region(memory.start, memory.end - memory.start + 1,
-                       dev_name(&dev->dev));
+       res_len = resource_size(&memory);
+       res = request_mem_region(memory.start, res_len, dev_name(&dev->dev));
        if (!res)
                return -EBUSY;
  
-       res_len = memory.end - memory.start + 1;
        if (of_irq_map_one(dp, 0, &oirq)) {
                ret = -ENODEV;
                goto release_reg;
@@@ -92,7 -91,7 +91,7 @@@
        return ret;
  
  release_reg:
-       release_mem_region(memory.start, memory.end - memory.start + 1);
+       release_mem_region(memory.start, res_len);
        return ret;
  }
  
@@@ -121,11 -120,8 +120,11 @@@ static const struct of_device_id of_isp
  MODULE_DEVICE_TABLE(of, of_isp1760_match);
  
  static struct of_platform_driver isp1760_of_driver = {
 -      .name           = "nxp-isp1760",
 -      .match_table    = of_isp1760_match,
 +      .driver = {
 +              .name = "nxp-isp1760",
 +              .owner = THIS_MODULE,
 +              .of_match_table = of_isp1760_match,
 +      },
        .probe          = of_isp1760_probe,
        .remove         = of_isp1760_remove,
  };
diff --combined include/linux/device.h
index cd7534cc42aba514ae8b75f39ac4bdb1ce11fe86,7bb9f426f3e67c83985c322c2dc26ec8f5edd50f..0713e10571dd61eb0abf1388e0c415ba6d143b6d
@@@ -22,7 -22,6 +22,6 @@@
  #include <linux/types.h>
  #include <linux/module.h>
  #include <linux/pm.h>
- #include <linux/semaphore.h>
  #include <asm/atomic.h>
  #include <asm/device.h>
  
@@@ -34,7 -33,6 +33,7 @@@ struct class
  struct class_private;
  struct bus_type;
  struct bus_type_private;
 +struct device_node;
  
  struct bus_attribute {
        struct attribute        attr;
@@@ -129,10 -127,6 +128,10 @@@ struct device_driver 
  
        bool suppress_bind_attrs;       /* disables bind/unbind via sysfs */
  
 +#if defined(CONFIG_OF)
 +      const struct of_device_id       *of_match_table;
 +#endif
 +
        int (*probe) (struct device *dev);
        int (*remove) (struct device *dev);
        void (*shutdown) (struct device *dev);
@@@ -208,6 -202,9 +207,9 @@@ struct class 
        int (*suspend)(struct device *dev, pm_message_t state);
        int (*resume)(struct device *dev);
  
+       const struct kobj_ns_type_operations *ns_type;
+       const void *(*namespace)(struct device *dev);
        const struct dev_pm_ops *pm;
  
        struct class_private *p;
@@@ -409,7 -406,7 +411,7 @@@ struct device 
        const char              *init_name; /* initial name of the device */
        struct device_type      *type;
  
-       struct semaphore        sem;    /* semaphore to synchronize calls to
+       struct mutex            mutex;  /* mutex to synchronize calls to
                                         * its driver.
                                         */
  
                                             override */
        /* arch specific additions */
        struct dev_archdata     archdata;
 +#ifdef CONFIG_OF
 +      struct device_node      *of_node;
 +#endif
  
        dev_t                   devt;   /* dev_t, creates the sysfs "dev" */
  
  
  static inline const char *dev_name(const struct device *dev)
  {
+       /* Use the init name until the kobject becomes available */
+       if (dev->init_name)
+               return dev->init_name;
        return kobject_name(&dev->kobj);
  }
  
@@@ -518,17 -516,17 +524,17 @@@ static inline bool device_async_suspend
  
  static inline void device_lock(struct device *dev)
  {
-       down(&dev->sem);
+       mutex_lock(&dev->mutex);
  }
  
  static inline int device_trylock(struct device *dev)
  {
-       return down_trylock(&dev->sem);
+       return mutex_trylock(&dev->mutex);
  }
  
  static inline void device_unlock(struct device *dev)
  {
-       up(&dev->sem);
+       mutex_unlock(&dev->mutex);
  }
  
  void driver_init(void);
diff --combined include/linux/i2c.h
index 4f37ff1de7e1c91848dbb6ecd141ac76dbe7af29,6ed1d59bfb1e642789e25d47af65fb36c6921f2e..21067b4185366b419a6c7af504ff1a711642457b
@@@ -34,7 -34,6 +34,7 @@@
  #include <linux/device.h>     /* for struct device */
  #include <linux/sched.h>      /* for completion */
  #include <linux/mutex.h>
 +#include <linux/of.h>         /* for struct device_node */
  
  extern struct bus_type i2c_bus_type;
  
@@@ -252,9 -251,6 +252,9 @@@ struct i2c_board_info 
        unsigned short  addr;
        void            *platform_data;
        struct dev_archdata     *archdata;
 +#ifdef CONFIG_OF
 +      struct device_node *of_node;
 +#endif
        int             irq;
  };
  
@@@ -359,6 -355,8 +359,8 @@@ struct i2c_adapter 
        int nr;
        char name[48];
        struct completion dev_released;
+       struct list_head userspace_clients;
  };
  #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)