Imported nokia patch nokia-20091602+0m5.diff
[kernel-power] / kernel-power-2.6.28 / debian / patches / rx51_arm_errata_430973.diff
1 Index: kernel-cssu-2.6.28/arch/arm/mach-omap2/board-rx51.c
2 ===================================================================
3 --- kernel-cssu-2.6.28.orig/arch/arm/mach-omap2/board-rx51.c    2012-05-25 04:12:52.708683352 -0400
4 +++ kernel-cssu-2.6.28/arch/arm/mach-omap2/board-rx51.c 2012-05-25 03:52:23.617140000 -0400
5 @@ -45,6 +45,8 @@
6  #include <mach/prcm.h>
7  #include "cm.h"
8  
9 +#include "board-rx51-secure.h"
10 +
11  #define RX51_USB_TRANSCEIVER_RST_GPIO  67
12  
13  extern int omap_init_fb(void);
14 @@ -162,6 +164,56 @@
15         .set_pm_limits  = rx51_usb_set_pm_limits,
16  };
17  
18 +#ifdef CONFIG_ARM_ERRATA_430973
19 +static ssize_t rx51_errata_430973_show(struct kobject *kobj,
20 +                                      struct kobj_attribute *attr,
21 +                                      char *buf)
22 +{
23 +       u32 acr;
24 +      
25 +       /* Read ACR */
26 +       asm volatile ("mrc p15, 0, %0, c1, c0, 1" : "=r" (acr));
27 +
28 +       return sprintf(buf,"%u\n",(acr >> 6) & 1);
29 +}
30 +
31 +static ssize_t rx51_errata_430973_store(struct kobject *kobj,
32 +                                       struct kobj_attribute *attr,
33 +                                       const char *buf, size_t n)
34 +{
35 +       u32 value;
36 +
37 +       if (sscanf(buf, "%u", &value) != 1) 
38 +       {
39 +               printk(KERN_ERR "errata_430973: Invalid value\n");
40 +               return -EINVAL;
41 +       }
42 +       if(value)
43 +               rx51_secure_update_aux_cr(1 << 6, 0);
44 +       else
45 +               rx51_secure_update_aux_cr(0, 1 << 6);
46 +
47 +       return n;
48 +}
49 +
50 +static struct kobj_attribute rx51_errata_430973 = {
51 +       .attr = {
52 +       .name = __stringify(errata_430973),
53 +       .mode = 0644,
54 +       },
55 +       .show = rx51_errata_430973_show,
56 +       .store = rx51_errata_430973_store,
57 +};
58 +
59 +static void rx51_add_errata_430973_sysfs(void)
60 +{
61 +       int ret = 0;
62 +       ret = sysfs_create_file(kernel_kobj, &rx51_errata_430973.attr);
63 +       if (ret)
64 +               printk(KERN_ERR "sysfs_create_file failed: %d\n", ret);
65 +}
66 +#endif
67 +
68  static void __init rx51_init(void)
69  {
70         rx51_xceiv_init();
71 @@ -176,6 +228,13 @@
72          */
73         omap_init_fb();
74         omap_bt_init(&rx51_bt_config);
75 +
76 +#ifdef CONFIG_ARM_ERRATA_430973
77 +       printk(KERN_INFO "Enabling ARM errata 430973 workaround.\n");
78 +       /* set IBE to 1 */
79 +       rx51_secure_update_aux_cr(1 << 6, 0);
80 +       rx51_add_errata_430973_sysfs();
81 +#endif
82  }
83  
84  static void __init rx51_map_io(void)