--- /dev/null
+From e5fe29c7198a1f6616286dfc8602a69da165cb3f Mon Sep 17 00:00:00 2001
+From: Felipe Contreras <felipe.contreras@gmail.com>
+Date: Thu, 8 Dec 2011 22:23:00 +0200
+Subject: ARM: OMAP: rx51: fix USB
+
+From: Felipe Contreras <felipe.contreras@gmail.com>
+
+commit e5fe29c7198a1f6616286dfc8602a69da165cb3f upstream.
+
+Commit 10299e2e4e3ed3b16503d4e04edd48b33083f4e2 (ARM: RX-51:
+Enable isp1704 power on/off) added power management for isp1704.
+
+However, the transceiver should be powered on by default,
+otherwise USB doesn't work at all for networking during
+boot.
+
+All kernels after v3.0 are affected.
+
+Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
+Reviewed-by: Sebastian Reichel <sre@debian.org>
+[tony@atomide.com: updated comments]
+Signed-off-by: Tony Lindgren <tony@atomide.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ arch/arm/mach-omap2/board-rx51-peripherals.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
++++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
+@@ -133,7 +133,7 @@ static struct platform_device rx51_charg
+ static void __init rx51_charger_init(void)
+ {
+ WARN_ON(gpio_request_one(RX51_USB_TRANSCEIVER_RST_GPIO,
+- GPIOF_OUT_INIT_LOW, "isp1704_reset"));
++ GPIOF_OUT_INIT_HIGH, "isp1704_reset"));
+
+ platform_device_register(&rx51_charger_device);
+ }
--- /dev/null
+From 5eb46851de3904cd1be9192fdacb8d34deadc1fc Mon Sep 17 00:00:00 2001
+From: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
+Date: Fri, 2 Dec 2011 10:07:07 +0100
+Subject: cfq-iosched: fix cfq_cic_link() race confition
+
+From: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
+
+commit 5eb46851de3904cd1be9192fdacb8d34deadc1fc upstream.
+
+cfq_cic_link() has race condition. When some processes which shared ioc
+issue I/O to same block device simultaneously, cfq_cic_link() returns -EEXIST
+sometimes. The race condition might stop I/O by following steps:
+
+step 1: Process A: Issue an I/O to /dev/sda
+step 2: Process A: Get an ioc (iocA here) in get_io_context() which does not
+ linked with a cic for the device
+step 3: Process A: Get a new cic for the device (cicA here) in
+ cfq_alloc_io_context()
+
+step 4: Process B: Issue an I/O to /dev/sda
+step 5: Process B: Get iocA in get_io_context() since process A and B share the
+ same ioc
+step 6: Process B: Get a new cic for the device (cicB here) in
+ cfq_alloc_io_context() since iocA has not been linked with a
+ cic for the device yet
+
+step 7: Process A: Link cicA to iocA in cfq_cic_link()
+step 8: Process A: Dispatch I/O to driver and finish it
+
+step 9: Process B: Try to link cicB to iocA in cfq_cic_link()
+ But it fails with showing "cfq: cic link failed!" kernel
+ message, since iocA has already linked with cicA at step 7.
+step 10: Process B: Wait for finishig I/O in get_request_wait()
+ The function does not wake up, when there is no I/O to the
+ device.
+
+When cfq_cic_link() returns -EEXIST, it means ioc has already linked with cic.
+So when cfq_cic_link() return -EEXIST, retry cfq_cic_lookup().
+
+Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ block/cfq-iosched.c | 11 +++++++++--
+ 1 file changed, 9 insertions(+), 2 deletions(-)
+
+--- a/block/cfq-iosched.c
++++ b/block/cfq-iosched.c
+@@ -3169,7 +3169,7 @@ static int cfq_cic_link(struct cfq_data
+ }
+ }
+
+- if (ret)
++ if (ret && ret != -EEXIST)
+ printk(KERN_ERR "cfq: cic link failed!\n");
+
+ return ret;
+@@ -3185,6 +3185,7 @@ cfq_get_io_context(struct cfq_data *cfqd
+ {
+ struct io_context *ioc = NULL;
+ struct cfq_io_context *cic;
++ int ret;
+
+ might_sleep_if(gfp_mask & __GFP_WAIT);
+
+@@ -3192,6 +3193,7 @@ cfq_get_io_context(struct cfq_data *cfqd
+ if (!ioc)
+ return NULL;
+
++retry:
+ cic = cfq_cic_lookup(cfqd, ioc);
+ if (cic)
+ goto out;
+@@ -3200,7 +3202,12 @@ cfq_get_io_context(struct cfq_data *cfqd
+ if (cic == NULL)
+ goto err;
+
+- if (cfq_cic_link(cfqd, ioc, cic, gfp_mask))
++ ret = cfq_cic_link(cfqd, ioc, cic, gfp_mask);
++ if (ret == -EEXIST) {
++ /* someone has linked cic to ioc already */
++ cfq_cic_free(cic);
++ goto retry;
++ } else if (ret)
+ goto err_free;
+
+ out:
--- /dev/null
+From 2984ff38ccf6cbc02a7a996a36c7d6f69f3c6146 Mon Sep 17 00:00:00 2001
+From: majianpeng <majianpeng@gmail.com>
+Date: Wed, 30 Nov 2011 15:47:48 +0100
+Subject: cfq-iosched: free cic_index if blkio_alloc_blkg_stats fails
+
+From: majianpeng <majianpeng@gmail.com>
+
+commit 2984ff38ccf6cbc02a7a996a36c7d6f69f3c6146 upstream.
+
+If we fail allocating the blkpg stats, we free cfqd and cfgq.
+But we need to free the IDA cfqd->cic_index as well.
+
+Signed-off-by: majianpeng <majianpeng@gmail.com>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ block/cfq-iosched.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/block/cfq-iosched.c
++++ b/block/cfq-iosched.c
+@@ -4015,6 +4015,11 @@ static void *cfq_init_queue(struct reque
+
+ if (blkio_alloc_blkg_stats(&cfqg->blkg)) {
+ kfree(cfqg);
++
++ spin_lock(&cic_index_lock);
++ ida_remove(&cic_index_ida, cfqd->cic_index);
++ spin_unlock(&cic_index_lock);
++
+ kfree(cfqd);
+ return NULL;
+ }
--- /dev/null
+From 4ed0b577457eb6aeb7cdc7e7316576e63d15abb2 Mon Sep 17 00:00:00 2001
+From: Eugeni Dodonov <eugeni.dodonov@intel.com>
+Date: Thu, 10 Nov 2011 13:55:15 -0200
+Subject: drm/i915: prevent division by zero when asking for chipset power
+
+From: Eugeni Dodonov <eugeni.dodonov@intel.com>
+
+commit 4ed0b577457eb6aeb7cdc7e7316576e63d15abb2 upstream.
+
+This prevents an in-kernel division by zero which happens when we are
+asking for i915_chipset_val too quickly, or within a race condition
+between the power monitoring thread and userspace accesses via debugfs.
+
+The issue can be reproduced easily via the following command:
+while ``; do cat /sys/kernel/debug/dri/0/i915_emon_status; done
+
+This is particularly dangerous because it can be triggered by
+a non-privileged user by just reading the debugfs entry.
+
+This issue was also found independently by Konstantin Belousov
+<kostikbel@gmail.com>, who proposed a similar patch.
+
+Reported-by: Konstantin Belousov <kostikbel@gmail.com>
+Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
+Acked-by: Keith Packard <keithp@keithp.com>
+Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
+Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
+Signed-off-by: Keith Packard <keithp@keithp.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/gpu/drm/i915/i915_dma.c | 10 ++++++++++
+ drivers/gpu/drm/i915/i915_drv.h | 1 +
+ 2 files changed, 11 insertions(+)
+
+--- a/drivers/gpu/drm/i915/i915_dma.c
++++ b/drivers/gpu/drm/i915/i915_dma.c
+@@ -1451,6 +1451,14 @@ unsigned long i915_chipset_val(struct dr
+
+ diff1 = now - dev_priv->last_time1;
+
++ /* Prevent division-by-zero if we are asking too fast.
++ * Also, we don't get interesting results if we are polling
++ * faster than once in 10ms, so just return the saved value
++ * in such cases.
++ */
++ if (diff1 <= 10)
++ return dev_priv->chipset_power;
++
+ count1 = I915_READ(DMIEC);
+ count2 = I915_READ(DDREC);
+ count3 = I915_READ(CSIEC);
+@@ -1481,6 +1489,8 @@ unsigned long i915_chipset_val(struct dr
+ dev_priv->last_count1 = total_count;
+ dev_priv->last_time1 = now;
+
++ dev_priv->chipset_power = ret;
++
+ return ret;
+ }
+
+--- a/drivers/gpu/drm/i915/i915_drv.h
++++ b/drivers/gpu/drm/i915/i915_drv.h
+@@ -702,6 +702,7 @@ typedef struct drm_i915_private {
+
+ u64 last_count1;
+ unsigned long last_time1;
++ unsigned long chipset_power;
+ u64 last_count2;
+ struct timespec last_time2;
+ unsigned long gfx_power;
--- /dev/null
+From 72b36015ba43a3cca5303f5534d2c3e1899eae29 Mon Sep 17 00:00:00 2001
+From: Ted Feng <artisdom@gmail.com>
+Date: Thu, 8 Dec 2011 00:46:21 +0000
+Subject: ipip, sit: copy parms.name after register_netdevice
+
+From: Ted Feng <artisdom@gmail.com>
+
+commit 72b36015ba43a3cca5303f5534d2c3e1899eae29 upstream.
+
+Same fix as 731abb9cb2 for ipip and sit tunnel.
+Commit 1c5cae815d removed an explicit call to dev_alloc_name in
+ipip_tunnel_locate and ipip6_tunnel_locate, because register_netdevice
+will now create a valid name, however the tunnel keeps a copy of the
+name in the private parms structure. Fix this by copying the name back
+after register_netdevice has successfully returned.
+
+This shows up if you do a simple tunnel add, followed by a tunnel show:
+
+$ sudo ip tunnel add mode ipip remote 10.2.20.211
+$ ip tunnel
+tunl0: ip/ip remote any local any ttl inherit nopmtudisc
+tunl%d: ip/ip remote 10.2.20.211 local any ttl inherit
+$ sudo ip tunnel add mode sit remote 10.2.20.212
+$ ip tunnel
+sit0: ipv6/ip remote any local any ttl 64 nopmtudisc 6rd-prefix 2002::/16
+sit%d: ioctl 89f8 failed: No such device
+sit%d: ipv6/ip remote 10.2.20.212 local any ttl inherit
+
+Signed-off-by: Ted Feng <artisdom@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ net/ipv4/ipip.c | 7 ++++++-
+ net/ipv6/sit.c | 7 ++++++-
+ 2 files changed, 12 insertions(+), 2 deletions(-)
+
+--- a/net/ipv4/ipip.c
++++ b/net/ipv4/ipip.c
+@@ -285,6 +285,8 @@ static struct ip_tunnel * ipip_tunnel_lo
+ if (register_netdevice(dev) < 0)
+ goto failed_free;
+
++ strcpy(nt->parms.name, dev->name);
++
+ dev_hold(dev);
+ ipip_tunnel_link(ipn, nt);
+ return nt;
+@@ -759,7 +761,6 @@ static int ipip_tunnel_init(struct net_d
+ struct ip_tunnel *tunnel = netdev_priv(dev);
+
+ tunnel->dev = dev;
+- strcpy(tunnel->parms.name, dev->name);
+
+ memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4);
+ memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4);
+@@ -825,6 +826,7 @@ static void ipip_destroy_tunnels(struct
+ static int __net_init ipip_init_net(struct net *net)
+ {
+ struct ipip_net *ipn = net_generic(net, ipip_net_id);
++ struct ip_tunnel *t;
+ int err;
+
+ ipn->tunnels[0] = ipn->tunnels_wc;
+@@ -848,6 +850,9 @@ static int __net_init ipip_init_net(stru
+ if ((err = register_netdev(ipn->fb_tunnel_dev)))
+ goto err_reg_dev;
+
++ t = netdev_priv(ipn->fb_tunnel_dev);
++
++ strcpy(t->parms.name, ipn->fb_tunnel_dev->name);
+ return 0;
+
+ err_reg_dev:
+--- a/net/ipv6/sit.c
++++ b/net/ipv6/sit.c
+@@ -263,6 +263,8 @@ static struct ip_tunnel *ipip6_tunnel_lo
+ if (register_netdevice(dev) < 0)
+ goto failed_free;
+
++ strcpy(nt->parms.name, dev->name);
++
+ dev_hold(dev);
+
+ ipip6_tunnel_link(sitn, nt);
+@@ -1141,7 +1143,6 @@ static int ipip6_tunnel_init(struct net_
+ struct ip_tunnel *tunnel = netdev_priv(dev);
+
+ tunnel->dev = dev;
+- strcpy(tunnel->parms.name, dev->name);
+
+ memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4);
+ memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4);
+@@ -1204,6 +1205,7 @@ static void __net_exit sit_destroy_tunne
+ static int __net_init sit_init_net(struct net *net)
+ {
+ struct sit_net *sitn = net_generic(net, sit_net_id);
++ struct ip_tunnel *t;
+ int err;
+
+ sitn->tunnels[0] = sitn->tunnels_wc;
+@@ -1228,6 +1230,9 @@ static int __net_init sit_init_net(struc
+ if ((err = register_netdev(sitn->fb_tunnel_dev)))
+ goto err_reg_dev;
+
++ t = netdev_priv(sitn->fb_tunnel_dev);
++
++ strcpy(t->parms.name, sitn->fb_tunnel_dev->name);
+ return 0;
+
+ err_reg_dev:
--- /dev/null
+From 93b2ec0128c431148b216b8f7337c1a52131ef03 Mon Sep 17 00:00:00 2001
+From: NeilBrown <neilb@suse.de>
+Date: Fri, 9 Dec 2011 09:39:15 +1100
+Subject: rtc: Expire alarms after the time is set.
+
+From: NeilBrown <neilb@suse.de>
+
+commit 93b2ec0128c431148b216b8f7337c1a52131ef03 upstream.
+
+If the alarm time programming in the rtc is ever in the past, it won't fire,
+and any other alarm will be queued after it so they won't fire either.
+
+So any time that the alarm might be in the past, we need to trigger
+the irq handler to ensure the old alarm is cleared and the timer queue
+is fully in the future.
+
+This can happen:
+ - when we first initialise the alarm
+ - when we set the time in the rtc.
+
+so follow both of these by scheduling the timer work function.
+
+Signed-off-by: NeilBrown <neilb@suse.de>
+[Also catch set_mmss case -jstultz]
+Signed-off-by: John Stultz <john.stultz@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/rtc/interface.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/drivers/rtc/interface.c
++++ b/drivers/rtc/interface.c
+@@ -72,6 +72,8 @@ int rtc_set_time(struct rtc_device *rtc,
+ err = -EINVAL;
+
+ mutex_unlock(&rtc->ops_lock);
++ /* A timer might have just expired */
++ schedule_work(&rtc->irqwork);
+ return err;
+ }
+ EXPORT_SYMBOL_GPL(rtc_set_time);
+@@ -111,6 +113,8 @@ int rtc_set_mmss(struct rtc_device *rtc,
+ err = -EINVAL;
+
+ mutex_unlock(&rtc->ops_lock);
++ /* A timer might have just expired */
++ schedule_work(&rtc->irqwork);
+
+ return err;
+ }
+@@ -402,6 +406,8 @@ int rtc_initialize_alarm(struct rtc_devi
+ timerqueue_add(&rtc->timerqueue, &rtc->aie_timer.node);
+ }
+ mutex_unlock(&rtc->ops_lock);
++ /* maybe that was in the past.*/
++ schedule_work(&rtc->irqwork);
+ return err;
+ }
+ EXPORT_SYMBOL_GPL(rtc_initialize_alarm);
--- /dev/null
+From c3b79770e51ab1fd4201f3b54edf30113b9ce74f Mon Sep 17 00:00:00 2001
+From: John Stultz <john.stultz@linaro.org>
+Date: Mon, 12 Dec 2011 13:57:52 -0800
+Subject: rtc: m41t80: Workaround broken alarm functionality
+
+From: John Stultz <john.stultz@linaro.org>
+
+commit c3b79770e51ab1fd4201f3b54edf30113b9ce74f upstream.
+
+The m41t80 driver can read and set the alarm, but it doesn't
+seem to have a functional alarm irq.
+
+This causes failures when the generic core sees alarm functions,
+but then cannot use them properly for things like UIE mode.
+
+Disabling the alarm functions allows proper error reporting,
+and possible fallback to emulated modes. Once someone fixes
+the alarm irq functionality, this can be restored.
+
+CC: Matt Turner <mattst88@gmail.com>
+CC: Nico Macrionitis <acrux@cruxppc.org>
+CC: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
+Reported-by: Matt Turner <mattst88@gmail.com>
+Reported-by: Nico Macrionitis <acrux@cruxppc.org>
+Tested-by: Nico Macrionitis <acrux@cruxppc.org>
+Signed-off-by: John Stultz <john.stultz@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/rtc/rtc-m41t80.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+--- a/drivers/rtc/rtc-m41t80.c
++++ b/drivers/rtc/rtc-m41t80.c
+@@ -357,10 +357,19 @@ static int m41t80_rtc_read_alarm(struct
+ static struct rtc_class_ops m41t80_rtc_ops = {
+ .read_time = m41t80_rtc_read_time,
+ .set_time = m41t80_rtc_set_time,
++ /*
++ * XXX - m41t80 alarm functionality is reported broken.
++ * until it is fixed, don't register alarm functions.
++ *
+ .read_alarm = m41t80_rtc_read_alarm,
+ .set_alarm = m41t80_rtc_set_alarm,
++ */
+ .proc = m41t80_rtc_proc,
++ /*
++ * See above comment on broken alarm
++ *
+ .alarm_irq_enable = m41t80_rtc_alarm_irq_enable,
++ */
+ };
+
+ #if defined(CONFIG_RTC_INTF_SYSFS) || defined(CONFIG_RTC_INTF_SYSFS_MODULE)
--- /dev/null
+arm-omap-rx51-fix-usb.patch
+ipip-sit-copy-parms.name-after-register_netdevice.patch
+rtc-expire-alarms-after-the-time-is-set.patch
+rtc-m41t80-workaround-broken-alarm-functionality.patch
+drm-i915-prevent-division-by-zero-when-asking-for-chipset-power.patch
+cfq-iosched-free-cic_index-if-blkio_alloc_blkg_stats-fails.patch
+cfq-iosched-fix-cfq_cic_link-race-confition.patch