aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/filesystems/ubifs.txt7
-rw-r--r--MAINTAINERS2
-rw-r--r--arch/arm/kernel/entry-armv.S1
-rw-r--r--arch/arm/kernel/entry-common.S2
-rw-r--r--arch/arm/kernel/irq.c2
-rw-r--r--arch/arm/mach-msm/board-halibut.c1
-rw-r--r--arch/arm/mach-omap1/devices.c2
-rw-r--r--arch/arm/mach-omap1/mcbsp.c98
-rw-r--r--arch/arm/mach-omap2/devices.c11
-rw-r--r--arch/arm/mach-omap2/id.c6
-rw-r--r--arch/arm/mach-omap2/irq.c1
-rw-r--r--arch/arm/mach-omap2/mcbsp.c145
-rw-r--r--arch/arm/mach-omap2/sleep24xx.S3
-rw-r--r--arch/arm/mach-omap2/timer-gp.c3
-rw-r--r--arch/arm/mach-sa1100/generic.c2
-rw-r--r--arch/arm/mm/fault-armv.c5
-rw-r--r--arch/arm/plat-omap/devices.c7
-rw-r--r--arch/arm/plat-omap/dma.c5
-rw-r--r--arch/arm/plat-omap/include/mach/cpu.h1
-rw-r--r--arch/arm/plat-omap/include/mach/mcbsp.h6
-rw-r--r--arch/arm/plat-omap/include/mach/mmc.h10
-rw-r--r--arch/arm/plat-omap/mcbsp.c52
-rw-r--r--arch/blackfin/Kconfig52
-rw-r--r--arch/blackfin/Makefile106
-rw-r--r--arch/blackfin/configs/BF518F-EZBRD_defconfig9
-rw-r--r--arch/blackfin/configs/BF526-EZBRD_defconfig2
-rw-r--r--arch/blackfin/configs/BF527-EZKIT_defconfig2
-rw-r--r--arch/blackfin/configs/BF533-EZKIT_defconfig2
-rw-r--r--arch/blackfin/configs/BF533-STAMP_defconfig2
-rw-r--r--arch/blackfin/configs/BF537-STAMP_defconfig2
-rw-r--r--arch/blackfin/configs/BF538-EZKIT_defconfig2
-rw-r--r--arch/blackfin/configs/BF548-EZKIT_defconfig2
-rw-r--r--arch/blackfin/configs/BF561-EZKIT_defconfig2
-rw-r--r--arch/blackfin/configs/CM-BF527_defconfig445
-rw-r--r--arch/blackfin/include/asm/checksum.h34
-rw-r--r--arch/blackfin/include/asm/delay.h35
-rw-r--r--arch/blackfin/include/asm/gpio.h58
-rw-r--r--arch/blackfin/include/asm/kgdb.h53
-rw-r--r--arch/blackfin/include/asm/mem_init.h2
-rw-r--r--arch/blackfin/include/asm/pda.h1
-rw-r--r--arch/blackfin/include/asm/reboot.h2
-rw-r--r--arch/blackfin/kernel/Makefile2
-rw-r--r--arch/blackfin/kernel/bfin_dma_5xx.c7
-rw-r--r--arch/blackfin/kernel/bfin_gpio.c578
-rw-r--r--arch/blackfin/kernel/cplb-mpu/cplbinit.c4
-rw-r--r--arch/blackfin/kernel/cplb-nompu/cplbmgr.c12
-rw-r--r--arch/blackfin/kernel/irqchip.c8
-rw-r--r--arch/blackfin/kernel/reboot.c30
-rw-r--r--arch/blackfin/kernel/setup.c12
-rw-r--r--arch/blackfin/kernel/traps.c39
-rw-r--r--arch/blackfin/mach-bf518/boards/ezbrd.c59
-rw-r--r--arch/blackfin/mach-bf518/include/mach/portmux.h2
-rw-r--r--arch/blackfin/mach-bf527/boards/cm_bf527.c18
-rw-r--r--arch/blackfin/mach-bf527/boards/ezbrd.c18
-rw-r--r--arch/blackfin/mach-bf527/boards/ezkit.c18
-rw-r--r--arch/blackfin/mach-bf527/include/mach/portmux.h2
-rw-r--r--arch/blackfin/mach-bf533/boards/blackstamp.c4
-rw-r--r--arch/blackfin/mach-bf533/boards/stamp.c4
-rw-r--r--arch/blackfin/mach-bf533/include/mach/portmux.h5
-rw-r--r--arch/blackfin/mach-bf537/boards/cm_bf537.c6
-rw-r--r--arch/blackfin/mach-bf537/boards/generic_board.c12
-rw-r--r--arch/blackfin/mach-bf537/boards/minotaur.c8
-rw-r--r--arch/blackfin/mach-bf537/boards/pnav10.c10
-rw-r--r--arch/blackfin/mach-bf537/boards/stamp.c14
-rw-r--r--arch/blackfin/mach-bf537/boards/tcm_bf537.c10
-rw-r--r--arch/blackfin/mach-bf537/include/mach/portmux.h1
-rw-r--r--arch/blackfin/mach-bf538/include/mach/portmux.h1
-rw-r--r--arch/blackfin/mach-bf548/boards/ezkit.c4
-rw-r--r--arch/blackfin/mach-bf548/include/mach/anomaly.h1
-rw-r--r--arch/blackfin/mach-bf548/include/mach/bf548.h12
-rw-r--r--arch/blackfin/mach-bf548/include/mach/gpio.h12
-rw-r--r--arch/blackfin/mach-bf548/include/mach/portmux.h1
-rw-r--r--arch/blackfin/mach-bf561/include/mach/defBF561.h2
-rw-r--r--arch/blackfin/mach-bf561/include/mach/portmux.h1
-rw-r--r--arch/blackfin/mach-common/clocks-init.c3
-rw-r--r--arch/blackfin/mach-common/entry.S9
-rw-r--r--arch/blackfin/mach-common/head.S84
-rw-r--r--arch/blackfin/mach-common/interrupt.S2
-rw-r--r--arch/blackfin/mach-common/ints-priority.c11
-rw-r--r--arch/blackfin/mach-common/pm.c11
-rw-r--r--arch/sparc/include/asm/cpudata_64.h2
-rw-r--r--arch/sparc/include/asm/irq_64.h4
-rw-r--r--arch/sparc/include/asm/kdebug_64.h2
-rw-r--r--arch/sparc/include/asm/nmi.h10
-rw-r--r--arch/sparc/include/asm/pcr.h46
-rw-r--r--arch/sparc/include/asm/pil.h1
-rw-r--r--arch/sparc/kernel/Makefile2
-rw-r--r--arch/sparc/kernel/cpu.c33
-rw-r--r--arch/sparc/kernel/irq_64.c68
-rw-r--r--arch/sparc/kernel/kernel.h1
-rw-r--r--arch/sparc/kernel/nmi.c224
-rw-r--r--arch/sparc/kernel/pcr.c153
-rw-r--r--arch/sparc/kernel/process_64.c5
-rw-r--r--arch/sparc/kernel/setup_64.c2
-rw-r--r--arch/sparc/kernel/ttable.S3
-rw-r--r--arch/sparc/mm/fault_64.c44
-rw-r--r--arch/sparc/oprofile/init.c232
-rw-r--r--drivers/ata/ahci.c9
-rw-r--r--drivers/ata/libata-core.c96
-rw-r--r--drivers/ata/libata-eh.c87
-rw-r--r--drivers/ata/libata-pmp.c2
-rw-r--r--drivers/ata/libata-scsi.c1
-rw-r--r--drivers/ata/libata.h4
-rw-r--r--drivers/ata/pata_qdi.c2
-rw-r--r--drivers/ata/sata_mv.c4
-rw-r--r--drivers/ata/sata_nv.c7
-rw-r--r--drivers/ata/sata_sil.c2
-rw-r--r--drivers/char/Kconfig2
-rw-r--r--drivers/dca/dca-core.c51
-rw-r--r--drivers/ide/qd65xx.c2
-rw-r--r--drivers/ide/qd65xx.h2
-rw-r--r--drivers/mfd/pcf50633-core.c1
-rw-r--r--drivers/misc/sgi-xp/xpnet.c3
-rw-r--r--drivers/mtd/maps/sa1100-flash.c4
-rw-r--r--drivers/net/arm/etherh.c2
-rw-r--r--drivers/net/cassini.c4
-rw-r--r--drivers/net/e1000/e1000_main.c2
-rw-r--r--drivers/net/ibm_newemac/phy.c4
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c2
-rw-r--r--drivers/net/qlge/qlge.h10
-rw-r--r--drivers/net/qlge/qlge_main.c25
-rw-r--r--drivers/net/smc911x.c4
-rw-r--r--drivers/net/smsc9420.c12
-rw-r--r--drivers/net/sungem.c2
-rw-r--r--drivers/net/sungem_phy.c2
-rw-r--r--drivers/net/sunqe.c2
-rw-r--r--drivers/net/tsi108_eth.c2
-rw-r--r--drivers/net/tulip/de2104x.c2
-rw-r--r--drivers/net/usb/hso.c4
-rw-r--r--fs/configfs/dir.c59
-rw-r--r--fs/ocfs2/alloc.c3
-rw-r--r--fs/ocfs2/dcache.c42
-rw-r--r--fs/ocfs2/dcache.h9
-rw-r--r--fs/ocfs2/dlmglue.c4
-rw-r--r--fs/ocfs2/ocfs2.h6
-rw-r--r--fs/ocfs2/quota_global.c4
-rw-r--r--fs/ocfs2/super.c3
-rw-r--r--fs/ocfs2/xattr.c17
-rw-r--r--fs/ubifs/budget.c35
-rw-r--r--fs/ubifs/debug.c122
-rw-r--r--fs/ubifs/debug.h36
-rw-r--r--fs/ubifs/dir.c96
-rw-r--r--fs/ubifs/file.c9
-rw-r--r--fs/ubifs/gc.c28
-rw-r--r--fs/ubifs/io.c22
-rw-r--r--fs/ubifs/journal.c2
-rw-r--r--fs/ubifs/lprops.c12
-rw-r--r--fs/ubifs/lpt_commit.c44
-rw-r--r--fs/ubifs/master.c2
-rw-r--r--fs/ubifs/orphan.c38
-rw-r--r--fs/ubifs/super.c195
-rw-r--r--fs/ubifs/tnc.c12
-rw-r--r--fs/ubifs/ubifs.h26
-rw-r--r--fs/xfs/linux-2.6/xfs_sync.c6
-rw-r--r--fs/xfs/xfs_dfrag.c10
-rw-r--r--fs/xfs/xfs_log_recover.c31
-rw-r--r--include/linux/Kbuild2
-rw-r--r--include/linux/ata.h15
-rw-r--r--include/linux/if_tunnel.h3
-rw-r--r--include/linux/libata.h19
-rw-r--r--mm/page-writeback.c21
-rw-r--r--net/ipv4/udp.c4
-rw-r--r--net/packet/af_packet.c8
-rw-r--r--net/sunrpc/Kconfig2
164 files changed, 2516 insertions, 1843 deletions
diff --git a/Documentation/filesystems/ubifs.txt b/Documentation/filesystems/ubifs.txt
index 84da2a4ba25a..12fedb7834c6 100644
--- a/Documentation/filesystems/ubifs.txt
+++ b/Documentation/filesystems/ubifs.txt
@@ -79,13 +79,6 @@ Mount options
79 79
80(*) == default. 80(*) == default.
81 81
82norm_unmount (*) commit on unmount; the journal is committed
83 when the file-system is unmounted so that the
84 next mount does not have to replay the journal
85 and it becomes very fast;
86fast_unmount do not commit on unmount; this option makes
87 unmount faster, but the next mount slower
88 because of the need to replay the journal.
89bulk_read read more in one go to take advantage of flash 82bulk_read read more in one go to take advantage of flash
90 media that read faster sequentially 83 media that read faster sequentially
91no_bulk_read (*) do not bulk-read 84no_bulk_read (*) do not bulk-read
diff --git a/MAINTAINERS b/MAINTAINERS
index 9c3a4f0280f6..829a697f1235 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -911,7 +911,7 @@ S: Maintained
911BLACKFIN ARCHITECTURE 911BLACKFIN ARCHITECTURE
912P: Bryan Wu 912P: Bryan Wu
913M: cooloney@kernel.org 913M: cooloney@kernel.org
914L: uclinux-dist-devel@blackfin.uclinux.org (subscribers-only) 914L: uclinux-dist-devel@blackfin.uclinux.org
915W: http://blackfin.uclinux.org 915W: http://blackfin.uclinux.org
916S: Supported 916S: Supported
917 917
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 77b047475539..85040cfeb5e5 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -650,6 +650,7 @@ ENTRY(fp_enter)
650no_fp: mov pc, lr 650no_fp: mov pc, lr
651 651
652__und_usr_unknown: 652__und_usr_unknown:
653 enable_irq
653 mov r0, sp 654 mov r0, sp
654 adr lr, ret_from_exception 655 adr lr, ret_from_exception
655 b do_undefinstr 656 b do_undefinstr
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 06269ea375c5..49a6ba926c2b 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -136,7 +136,7 @@ ENTRY(mcount)
136 ldmia sp!, {r0-r3, pc} 136 ldmia sp!, {r0-r3, pc}
137 137
138trace: 138trace:
139 ldr r1, [fp, #-4] 139 ldr r1, [fp, #-4] @ lr of instrumented routine
140 mov r0, lr 140 mov r0, lr
141 sub r0, r0, #MCOUNT_INSN_SIZE 141 sub r0, r0, #MCOUNT_INSN_SIZE
142 mov lr, pc 142 mov lr, pc
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index 7141cee1fab7..363db186cb93 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -101,7 +101,7 @@ unlock:
101/* Handle bad interrupts */ 101/* Handle bad interrupts */
102static struct irq_desc bad_irq_desc = { 102static struct irq_desc bad_irq_desc = {
103 .handle_irq = handle_bad_irq, 103 .handle_irq = handle_bad_irq,
104 .lock = SPIN_LOCK_UNLOCKED 104 .lock = __SPIN_LOCK_UNLOCKED(bad_irq_desc.lock),
105}; 105};
106 106
107/* 107/*
diff --git a/arch/arm/mach-msm/board-halibut.c b/arch/arm/mach-msm/board-halibut.c
index c2a96e3965a6..e61967dde9a1 100644
--- a/arch/arm/mach-msm/board-halibut.c
+++ b/arch/arm/mach-msm/board-halibut.c
@@ -27,6 +27,7 @@
27#include <asm/mach/map.h> 27#include <asm/mach/map.h>
28#include <asm/mach/flash.h> 28#include <asm/mach/flash.h>
29 29
30#include <mach/irqs.h>
30#include <mach/board.h> 31#include <mach/board.h>
31#include <mach/msm_iomap.h> 32#include <mach/msm_iomap.h>
32 33
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index 77382d8b6b2f..ba5d7c08dc17 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -181,7 +181,7 @@ void __init omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
181 } 181 }
182 size = OMAP1_MMC_SIZE; 182 size = OMAP1_MMC_SIZE;
183 183
184 omap_mmc_add(i, base, size, irq, mmc_data[i]); 184 omap_mmc_add("mmci-omap", i, base, size, irq, mmc_data[i]);
185 }; 185 };
186} 186}
187 187
diff --git a/arch/arm/mach-omap1/mcbsp.c b/arch/arm/mach-omap1/mcbsp.c
index ca7a0cc1707c..575ba31295cf 100644
--- a/arch/arm/mach-omap1/mcbsp.c
+++ b/arch/arm/mach-omap1/mcbsp.c
@@ -28,81 +28,8 @@
28#define DPS_RSTCT2_PER_EN (1 << 0) 28#define DPS_RSTCT2_PER_EN (1 << 0)
29#define DSP_RSTCT2_WD_PER_EN (1 << 1) 29#define DSP_RSTCT2_WD_PER_EN (1 << 1)
30 30
31struct mcbsp_internal_clk {
32 struct clk clk;
33 struct clk **childs;
34 int n_childs;
35};
36
37#if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX) 31#if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX)
38static void omap_mcbsp_clk_init(struct mcbsp_internal_clk *mclk) 32const char *clk_names[] = { "dsp_ck", "api_ck", "dspxor_ck" };
39{
40 const char *clk_names[] = { "dsp_ck", "api_ck", "dspxor_ck" };
41 int i;
42
43 mclk->n_childs = ARRAY_SIZE(clk_names);
44 mclk->childs = kzalloc(mclk->n_childs * sizeof(struct clk *),
45 GFP_KERNEL);
46
47 for (i = 0; i < mclk->n_childs; i++) {
48 /* We fake a platform device to get correct device id */
49 struct platform_device pdev;
50
51 pdev.dev.bus = &platform_bus_type;
52 pdev.id = mclk->clk.id;
53 mclk->childs[i] = clk_get(&pdev.dev, clk_names[i]);
54 if (IS_ERR(mclk->childs[i]))
55 printk(KERN_ERR "Could not get clock %s (%d).\n",
56 clk_names[i], mclk->clk.id);
57 }
58}
59
60static int omap_mcbsp_clk_enable(struct clk *clk)
61{
62 struct mcbsp_internal_clk *mclk = container_of(clk,
63 struct mcbsp_internal_clk, clk);
64 int i;
65
66 for (i = 0; i < mclk->n_childs; i++)
67 clk_enable(mclk->childs[i]);
68 return 0;
69}
70
71static void omap_mcbsp_clk_disable(struct clk *clk)
72{
73 struct mcbsp_internal_clk *mclk = container_of(clk,
74 struct mcbsp_internal_clk, clk);
75 int i;
76
77 for (i = 0; i < mclk->n_childs; i++)
78 clk_disable(mclk->childs[i]);
79}
80
81static struct mcbsp_internal_clk omap_mcbsp_clks[] = {
82 {
83 .clk = {
84 .name = "mcbsp_clk",
85 .id = 1,
86 .enable = omap_mcbsp_clk_enable,
87 .disable = omap_mcbsp_clk_disable,
88 },
89 },
90 {
91 .clk = {
92 .name = "mcbsp_clk",
93 .id = 3,
94 .enable = omap_mcbsp_clk_enable,
95 .disable = omap_mcbsp_clk_disable,
96 },
97 },
98};
99
100#define omap_mcbsp_clks_size ARRAY_SIZE(omap_mcbsp_clks)
101#else
102#define omap_mcbsp_clks_size 0
103static struct mcbsp_internal_clk __initdata *omap_mcbsp_clks;
104static inline void omap_mcbsp_clk_init(struct mcbsp_internal_clk *mclk)
105{ }
106#endif 33#endif
107 34
108static void omap1_mcbsp_request(unsigned int id) 35static void omap1_mcbsp_request(unsigned int id)
@@ -167,8 +94,9 @@ static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = {
167 .rx_irq = INT_McBSP1RX, 94 .rx_irq = INT_McBSP1RX,
168 .tx_irq = INT_McBSP1TX, 95 .tx_irq = INT_McBSP1TX,
169 .ops = &omap1_mcbsp_ops, 96 .ops = &omap1_mcbsp_ops,
170 .clk_name = "mcbsp_clk", 97 .clk_names = clk_names,
171 }, 98 .num_clks = 3,
99 },
172 { 100 {
173 .phys_base = OMAP1510_MCBSP2_BASE, 101 .phys_base = OMAP1510_MCBSP2_BASE,
174 .dma_rx_sync = OMAP_DMA_MCBSP2_RX, 102 .dma_rx_sync = OMAP_DMA_MCBSP2_RX,
@@ -184,7 +112,8 @@ static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = {
184 .rx_irq = INT_McBSP3RX, 112 .rx_irq = INT_McBSP3RX,
185 .tx_irq = INT_McBSP3TX, 113 .tx_irq = INT_McBSP3TX,
186 .ops = &omap1_mcbsp_ops, 114 .ops = &omap1_mcbsp_ops,
187 .clk_name = "mcbsp_clk", 115 .clk_names = clk_names,
116 .num_clks = 3,
188 }, 117 },
189}; 118};
190#define OMAP15XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap15xx_mcbsp_pdata) 119#define OMAP15XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap15xx_mcbsp_pdata)
@@ -202,7 +131,8 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = {
202 .rx_irq = INT_McBSP1RX, 131 .rx_irq = INT_McBSP1RX,
203 .tx_irq = INT_McBSP1TX, 132 .tx_irq = INT_McBSP1TX,
204 .ops = &omap1_mcbsp_ops, 133 .ops = &omap1_mcbsp_ops,
205 .clk_name = "mcbsp_clk", 134 .clk_names = clk_names,
135 .num_clks = 3,
206 }, 136 },
207 { 137 {
208 .phys_base = OMAP1610_MCBSP2_BASE, 138 .phys_base = OMAP1610_MCBSP2_BASE,
@@ -219,7 +149,8 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = {
219 .rx_irq = INT_McBSP3RX, 149 .rx_irq = INT_McBSP3RX,
220 .tx_irq = INT_McBSP3TX, 150 .tx_irq = INT_McBSP3TX,
221 .ops = &omap1_mcbsp_ops, 151 .ops = &omap1_mcbsp_ops,
222 .clk_name = "mcbsp_clk", 152 .clk_names = clk_names,
153 .num_clks = 3,
223 }, 154 },
224}; 155};
225#define OMAP16XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap16xx_mcbsp_pdata) 156#define OMAP16XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap16xx_mcbsp_pdata)
@@ -230,15 +161,6 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = {
230 161
231int __init omap1_mcbsp_init(void) 162int __init omap1_mcbsp_init(void)
232{ 163{
233 int i;
234
235 for (i = 0; i < omap_mcbsp_clks_size; i++) {
236 if (cpu_is_omap15xx() || cpu_is_omap16xx()) {
237 omap_mcbsp_clk_init(&omap_mcbsp_clks[i]);
238 clk_register(&omap_mcbsp_clks[i].clk);
239 }
240 }
241
242 if (cpu_is_omap730()) 164 if (cpu_is_omap730())
243 omap_mcbsp_count = OMAP730_MCBSP_PDATA_SZ; 165 omap_mcbsp_count = OMAP730_MCBSP_PDATA_SZ;
244 if (cpu_is_omap15xx()) 166 if (cpu_is_omap15xx())
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 9d7216ff6c9f..ce03fa750775 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -421,6 +421,7 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
421 int nr_controllers) 421 int nr_controllers)
422{ 422{
423 int i; 423 int i;
424 char *name;
424 425
425 for (i = 0; i < nr_controllers; i++) { 426 for (i = 0; i < nr_controllers; i++) {
426 unsigned long base, size; 427 unsigned long base, size;
@@ -450,12 +451,14 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
450 continue; 451 continue;
451 } 452 }
452 453
453 if (cpu_is_omap2420()) 454 if (cpu_is_omap2420()) {
454 size = OMAP2420_MMC_SIZE; 455 size = OMAP2420_MMC_SIZE;
455 else 456 name = "mmci-omap";
457 } else {
456 size = HSMMC_SIZE; 458 size = HSMMC_SIZE;
457 459 name = "mmci-omap-hs";
458 omap_mmc_add(i, base, size, irq, mmc_data[i]); 460 }
461 omap_mmc_add(name, i, base, size, irq, mmc_data[i]);
459 }; 462 };
460} 463}
461 464
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index b0f8e7d62798..b52a02fc7cd6 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -172,9 +172,13 @@ void __init omap34xx_check_revision(void)
172 omap_revision = OMAP3430_REV_ES3_0; 172 omap_revision = OMAP3430_REV_ES3_0;
173 rev_name = "ES3.0"; 173 rev_name = "ES3.0";
174 break; 174 break;
175 case 4:
176 omap_revision = OMAP3430_REV_ES3_1;
177 rev_name = "ES3.1";
178 break;
175 default: 179 default:
176 /* Use the latest known revision as default */ 180 /* Use the latest known revision as default */
177 omap_revision = OMAP3430_REV_ES3_0; 181 omap_revision = OMAP3430_REV_ES3_1;
178 rev_name = "Unknown revision\n"; 182 rev_name = "Unknown revision\n";
179 } 183 }
180 } 184 }
diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
index 636e2821af7d..9ba20d985dda 100644
--- a/arch/arm/mach-omap2/irq.c
+++ b/arch/arm/mach-omap2/irq.c
@@ -134,6 +134,7 @@ static struct irq_chip omap_irq_chip = {
134 .ack = omap_mask_ack_irq, 134 .ack = omap_mask_ack_irq,
135 .mask = omap_mask_irq, 135 .mask = omap_mask_irq,
136 .unmask = omap_unmask_irq, 136 .unmask = omap_unmask_irq,
137 .disable = omap_mask_irq,
137}; 138};
138 139
139static void __init omap_irq_bank_init_one(struct omap_irq_bank *bank) 140static void __init omap_irq_bank_init_one(struct omap_irq_bank *bank)
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index e20023c9d15d..a9e631fc1134 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -24,106 +24,7 @@
24#include <mach/cpu.h> 24#include <mach/cpu.h>
25#include <mach/mcbsp.h> 25#include <mach/mcbsp.h>
26 26
27struct mcbsp_internal_clk { 27const char *clk_names[] = { "mcbsp_ick", "mcbsp_fck" };
28 struct clk clk;
29 struct clk **childs;
30 int n_childs;
31};
32
33#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
34static void omap_mcbsp_clk_init(struct mcbsp_internal_clk *mclk)
35{
36 const char *clk_names[] = { "mcbsp_ick", "mcbsp_fck" };
37 int i;
38
39 mclk->n_childs = ARRAY_SIZE(clk_names);
40 mclk->childs = kzalloc(mclk->n_childs * sizeof(struct clk *),
41 GFP_KERNEL);
42
43 for (i = 0; i < mclk->n_childs; i++) {
44 /* We fake a platform device to get correct device id */
45 struct platform_device pdev;
46
47 pdev.dev.bus = &platform_bus_type;
48 pdev.id = mclk->clk.id;
49 mclk->childs[i] = clk_get(&pdev.dev, clk_names[i]);
50 if (IS_ERR(mclk->childs[i]))
51 printk(KERN_ERR "Could not get clock %s (%d).\n",
52 clk_names[i], mclk->clk.id);
53 }
54}
55
56static int omap_mcbsp_clk_enable(struct clk *clk)
57{
58 struct mcbsp_internal_clk *mclk = container_of(clk,
59 struct mcbsp_internal_clk, clk);
60 int i;
61
62 for (i = 0; i < mclk->n_childs; i++)
63 clk_enable(mclk->childs[i]);
64 return 0;
65}
66
67static void omap_mcbsp_clk_disable(struct clk *clk)
68{
69 struct mcbsp_internal_clk *mclk = container_of(clk,
70 struct mcbsp_internal_clk, clk);
71 int i;
72
73 for (i = 0; i < mclk->n_childs; i++)
74 clk_disable(mclk->childs[i]);
75}
76
77static struct mcbsp_internal_clk omap_mcbsp_clks[] = {
78 {
79 .clk = {
80 .name = "mcbsp_clk",
81 .id = 1,
82 .enable = omap_mcbsp_clk_enable,
83 .disable = omap_mcbsp_clk_disable,
84 },
85 },
86 {
87 .clk = {
88 .name = "mcbsp_clk",
89 .id = 2,
90 .enable = omap_mcbsp_clk_enable,
91 .disable = omap_mcbsp_clk_disable,
92 },
93 },
94 {
95 .clk = {
96 .name = "mcbsp_clk",
97 .id = 3,
98 .enable = omap_mcbsp_clk_enable,
99 .disable = omap_mcbsp_clk_disable,
100 },
101 },
102 {
103 .clk = {
104 .name = "mcbsp_clk",
105 .id = 4,
106 .enable = omap_mcbsp_clk_enable,
107 .disable = omap_mcbsp_clk_disable,
108 },
109 },
110 {
111 .clk = {
112 .name = "mcbsp_clk",
113 .id = 5,
114 .enable = omap_mcbsp_clk_enable,
115 .disable = omap_mcbsp_clk_disable,
116 },
117 },
118};
119
120#define omap_mcbsp_clks_size ARRAY_SIZE(omap_mcbsp_clks)
121#else
122#define omap_mcbsp_clks_size 0
123static struct mcbsp_internal_clk __initdata *omap_mcbsp_clks;
124static inline void omap_mcbsp_clk_init(struct clk *clk)
125{ }
126#endif
127 28
128static void omap2_mcbsp2_mux_setup(void) 29static void omap2_mcbsp2_mux_setup(void)
129{ 30{
@@ -156,7 +57,8 @@ static struct omap_mcbsp_platform_data omap2420_mcbsp_pdata[] = {
156 .rx_irq = INT_24XX_MCBSP1_IRQ_RX, 57 .rx_irq = INT_24XX_MCBSP1_IRQ_RX,
157 .tx_irq = INT_24XX_MCBSP1_IRQ_TX, 58 .tx_irq = INT_24XX_MCBSP1_IRQ_TX,
158 .ops = &omap2_mcbsp_ops, 59 .ops = &omap2_mcbsp_ops,
159 .clk_name = "mcbsp_clk", 60 .clk_names = clk_names,
61 .num_clks = 2,
160 }, 62 },
161 { 63 {
162 .phys_base = OMAP24XX_MCBSP2_BASE, 64 .phys_base = OMAP24XX_MCBSP2_BASE,
@@ -165,7 +67,8 @@ static struct omap_mcbsp_platform_data omap2420_mcbsp_pdata[] = {
165 .rx_irq = INT_24XX_MCBSP2_IRQ_RX, 67 .rx_irq = INT_24XX_MCBSP2_IRQ_RX,
166 .tx_irq = INT_24XX_MCBSP2_IRQ_TX, 68 .tx_irq = INT_24XX_MCBSP2_IRQ_TX,
167 .ops = &omap2_mcbsp_ops, 69 .ops = &omap2_mcbsp_ops,
168 .clk_name = "mcbsp_clk", 70 .clk_names = clk_names,
71 .num_clks = 2,
169 }, 72 },
170}; 73};
171#define OMAP2420_MCBSP_PDATA_SZ ARRAY_SIZE(omap2420_mcbsp_pdata) 74#define OMAP2420_MCBSP_PDATA_SZ ARRAY_SIZE(omap2420_mcbsp_pdata)
@@ -183,7 +86,8 @@ static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = {
183 .rx_irq = INT_24XX_MCBSP1_IRQ_RX, 86 .rx_irq = INT_24XX_MCBSP1_IRQ_RX,
184 .tx_irq = INT_24XX_MCBSP1_IRQ_TX, 87 .tx_irq = INT_24XX_MCBSP1_IRQ_TX,
185 .ops = &omap2_mcbsp_ops, 88 .ops = &omap2_mcbsp_ops,
186 .clk_name = "mcbsp_clk", 89 .clk_names = clk_names,
90 .num_clks = 2,
187 }, 91 },
188 { 92 {
189 .phys_base = OMAP24XX_MCBSP2_BASE, 93 .phys_base = OMAP24XX_MCBSP2_BASE,
@@ -192,7 +96,8 @@ static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = {
192 .rx_irq = INT_24XX_MCBSP2_IRQ_RX, 96 .rx_irq = INT_24XX_MCBSP2_IRQ_RX,
193 .tx_irq = INT_24XX_MCBSP2_IRQ_TX, 97 .tx_irq = INT_24XX_MCBSP2_IRQ_TX,
194 .ops = &omap2_mcbsp_ops, 98 .ops = &omap2_mcbsp_ops,
195 .clk_name = "mcbsp_clk", 99 .clk_names = clk_names,
100 .num_clks = 2,
196 }, 101 },
197 { 102 {
198 .phys_base = OMAP2430_MCBSP3_BASE, 103 .phys_base = OMAP2430_MCBSP3_BASE,
@@ -201,7 +106,8 @@ static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = {
201 .rx_irq = INT_24XX_MCBSP3_IRQ_RX, 106 .rx_irq = INT_24XX_MCBSP3_IRQ_RX,
202 .tx_irq = INT_24XX_MCBSP3_IRQ_TX, 107 .tx_irq = INT_24XX_MCBSP3_IRQ_TX,
203 .ops = &omap2_mcbsp_ops, 108 .ops = &omap2_mcbsp_ops,
204 .clk_name = "mcbsp_clk", 109 .clk_names = clk_names,
110 .num_clks = 2,
205 }, 111 },
206 { 112 {
207 .phys_base = OMAP2430_MCBSP4_BASE, 113 .phys_base = OMAP2430_MCBSP4_BASE,
@@ -210,7 +116,8 @@ static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = {
210 .rx_irq = INT_24XX_MCBSP4_IRQ_RX, 116 .rx_irq = INT_24XX_MCBSP4_IRQ_RX,
211 .tx_irq = INT_24XX_MCBSP4_IRQ_TX, 117 .tx_irq = INT_24XX_MCBSP4_IRQ_TX,
212 .ops = &omap2_mcbsp_ops, 118 .ops = &omap2_mcbsp_ops,
213 .clk_name = "mcbsp_clk", 119 .clk_names = clk_names,
120 .num_clks = 2,
214 }, 121 },
215 { 122 {
216 .phys_base = OMAP2430_MCBSP5_BASE, 123 .phys_base = OMAP2430_MCBSP5_BASE,
@@ -219,7 +126,8 @@ static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = {
219 .rx_irq = INT_24XX_MCBSP5_IRQ_RX, 126 .rx_irq = INT_24XX_MCBSP5_IRQ_RX,
220 .tx_irq = INT_24XX_MCBSP5_IRQ_TX, 127 .tx_irq = INT_24XX_MCBSP5_IRQ_TX,
221 .ops = &omap2_mcbsp_ops, 128 .ops = &omap2_mcbsp_ops,
222 .clk_name = "mcbsp_clk", 129 .clk_names = clk_names,
130 .num_clks = 2,
223 }, 131 },
224}; 132};
225#define OMAP2430_MCBSP_PDATA_SZ ARRAY_SIZE(omap2430_mcbsp_pdata) 133#define OMAP2430_MCBSP_PDATA_SZ ARRAY_SIZE(omap2430_mcbsp_pdata)
@@ -237,7 +145,8 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
237 .rx_irq = INT_24XX_MCBSP1_IRQ_RX, 145 .rx_irq = INT_24XX_MCBSP1_IRQ_RX,
238 .tx_irq = INT_24XX_MCBSP1_IRQ_TX, 146 .tx_irq = INT_24XX_MCBSP1_IRQ_TX,
239 .ops = &omap2_mcbsp_ops, 147 .ops = &omap2_mcbsp_ops,
240 .clk_name = "mcbsp_clk", 148 .clk_names = clk_names,
149 .num_clks = 2,
241 }, 150 },
242 { 151 {
243 .phys_base = OMAP34XX_MCBSP2_BASE, 152 .phys_base = OMAP34XX_MCBSP2_BASE,
@@ -246,7 +155,8 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
246 .rx_irq = INT_24XX_MCBSP2_IRQ_RX, 155 .rx_irq = INT_24XX_MCBSP2_IRQ_RX,
247 .tx_irq = INT_24XX_MCBSP2_IRQ_TX, 156 .tx_irq = INT_24XX_MCBSP2_IRQ_TX,
248 .ops = &omap2_mcbsp_ops, 157 .ops = &omap2_mcbsp_ops,
249 .clk_name = "mcbsp_clk", 158 .clk_names = clk_names,
159 .num_clks = 2,
250 }, 160 },
251 { 161 {
252 .phys_base = OMAP34XX_MCBSP3_BASE, 162 .phys_base = OMAP34XX_MCBSP3_BASE,
@@ -255,7 +165,8 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
255 .rx_irq = INT_24XX_MCBSP3_IRQ_RX, 165 .rx_irq = INT_24XX_MCBSP3_IRQ_RX,
256 .tx_irq = INT_24XX_MCBSP3_IRQ_TX, 166 .tx_irq = INT_24XX_MCBSP3_IRQ_TX,
257 .ops = &omap2_mcbsp_ops, 167 .ops = &omap2_mcbsp_ops,
258 .clk_name = "mcbsp_clk", 168 .clk_names = clk_names,
169 .num_clks = 2,
259 }, 170 },
260 { 171 {
261 .phys_base = OMAP34XX_MCBSP4_BASE, 172 .phys_base = OMAP34XX_MCBSP4_BASE,
@@ -264,7 +175,8 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
264 .rx_irq = INT_24XX_MCBSP4_IRQ_RX, 175 .rx_irq = INT_24XX_MCBSP4_IRQ_RX,
265 .tx_irq = INT_24XX_MCBSP4_IRQ_TX, 176 .tx_irq = INT_24XX_MCBSP4_IRQ_TX,
266 .ops = &omap2_mcbsp_ops, 177 .ops = &omap2_mcbsp_ops,
267 .clk_name = "mcbsp_clk", 178 .clk_names = clk_names,
179 .num_clks = 2,
268 }, 180 },
269 { 181 {
270 .phys_base = OMAP34XX_MCBSP5_BASE, 182 .phys_base = OMAP34XX_MCBSP5_BASE,
@@ -273,7 +185,8 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
273 .rx_irq = INT_24XX_MCBSP5_IRQ_RX, 185 .rx_irq = INT_24XX_MCBSP5_IRQ_RX,
274 .tx_irq = INT_24XX_MCBSP5_IRQ_TX, 186 .tx_irq = INT_24XX_MCBSP5_IRQ_TX,
275 .ops = &omap2_mcbsp_ops, 187 .ops = &omap2_mcbsp_ops,
276 .clk_name = "mcbsp_clk", 188 .clk_names = clk_names,
189 .num_clks = 2,
277 }, 190 },
278}; 191};
279#define OMAP34XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap34xx_mcbsp_pdata) 192#define OMAP34XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap34xx_mcbsp_pdata)
@@ -284,14 +197,6 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
284 197
285static int __init omap2_mcbsp_init(void) 198static int __init omap2_mcbsp_init(void)
286{ 199{
287 int i;
288
289 for (i = 0; i < omap_mcbsp_clks_size; i++) {
290 /* Once we call clk_get inside init, we do not register it */
291 omap_mcbsp_clk_init(&omap_mcbsp_clks[i]);
292 clk_register(&omap_mcbsp_clks[i].clk);
293 }
294
295 if (cpu_is_omap2420()) 200 if (cpu_is_omap2420())
296 omap_mcbsp_count = OMAP2420_MCBSP_PDATA_SZ; 201 omap_mcbsp_count = OMAP2420_MCBSP_PDATA_SZ;
297 if (cpu_is_omap2430()) 202 if (cpu_is_omap2430())
diff --git a/arch/arm/mach-omap2/sleep24xx.S b/arch/arm/mach-omap2/sleep24xx.S
index 43336b93b21c..bf9e96105e11 100644
--- a/arch/arm/mach-omap2/sleep24xx.S
+++ b/arch/arm/mach-omap2/sleep24xx.S
@@ -93,9 +93,8 @@ ENTRY(omap24xx_cpu_suspend)
93 orr r4, r4, #0x40 @ enable self refresh on idle req 93 orr r4, r4, #0x40 @ enable self refresh on idle req
94 mov r5, #0x2000 @ set delay (DPLL relock + DLL relock) 94 mov r5, #0x2000 @ set delay (DPLL relock + DLL relock)
95 str r4, [r2] @ make it so 95 str r4, [r2] @ make it so
96 mov r2, #0
97 nop 96 nop
98 mcr p15, 0, r2, c7, c0, 4 @ wait for interrupt 97 mcr p15, 0, r3, c7, c0, 4 @ wait for interrupt
99 nop 98 nop
100loop: 99loop:
101 subs r5, r5, #0x1 @ awake, wait just a bit 100 subs r5, r5, #0x1 @ awake, wait just a bit
diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c
index ae6036300f60..9fc13a2cc3f4 100644
--- a/arch/arm/mach-omap2/timer-gp.c
+++ b/arch/arm/mach-omap2/timer-gp.c
@@ -118,7 +118,8 @@ static void __init omap2_gp_clockevent_init(void)
118 clockevent_gpt.max_delta_ns = 118 clockevent_gpt.max_delta_ns =
119 clockevent_delta2ns(0xffffffff, &clockevent_gpt); 119 clockevent_delta2ns(0xffffffff, &clockevent_gpt);
120 clockevent_gpt.min_delta_ns = 120 clockevent_gpt.min_delta_ns =
121 clockevent_delta2ns(1, &clockevent_gpt); 121 clockevent_delta2ns(3, &clockevent_gpt);
122 /* Timer internal resynch latency. */
122 123
123 clockevent_gpt.cpumask = cpumask_of(0); 124 clockevent_gpt.cpumask = cpumask_of(0);
124 clockevents_register_device(&clockevent_gpt); 125 clockevents_register_device(&clockevent_gpt);
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index c1fbd5b5f9c4..23cfdd593954 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -289,7 +289,7 @@ static struct platform_device sa11x0pcmcia_device = {
289}; 289};
290 290
291static struct platform_device sa11x0mtd_device = { 291static struct platform_device sa11x0mtd_device = {
292 .name = "flash", 292 .name = "sa1100-mtd",
293 .id = -1, 293 .id = -1,
294}; 294};
295 295
diff --git a/arch/arm/mm/fault-armv.c b/arch/arm/mm/fault-armv.c
index 81d0b8772de3..bc0099d5ae85 100644
--- a/arch/arm/mm/fault-armv.c
+++ b/arch/arm/mm/fault-armv.c
@@ -66,7 +66,10 @@ static int adjust_pte(struct vm_area_struct *vma, unsigned long address)
66 * fault (ie, is old), we can safely ignore any issues. 66 * fault (ie, is old), we can safely ignore any issues.
67 */ 67 */
68 if (ret && (pte_val(entry) & L_PTE_MT_MASK) != shared_pte_mask) { 68 if (ret && (pte_val(entry) & L_PTE_MT_MASK) != shared_pte_mask) {
69 flush_cache_page(vma, address, pte_pfn(entry)); 69 unsigned long pfn = pte_pfn(entry);
70 flush_cache_page(vma, address, pfn);
71 outer_flush_range((pfn << PAGE_SHIFT),
72 (pfn << PAGE_SHIFT) + PAGE_SIZE);
70 pte_val(entry) &= ~L_PTE_MT_MASK; 73 pte_val(entry) &= ~L_PTE_MT_MASK;
71 pte_val(entry) |= shared_pte_mask; 74 pte_val(entry) |= shared_pte_mask;
72 set_pte_at(vma->vm_mm, address, pte, entry); 75 set_pte_at(vma->vm_mm, address, pte, entry);
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
index ac15c23fd5da..208dbb121f47 100644
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -200,14 +200,15 @@ void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config,
200/* 200/*
201 * Register MMC devices. Called from mach-omap1 and mach-omap2 device init. 201 * Register MMC devices. Called from mach-omap1 and mach-omap2 device init.
202 */ 202 */
203int __init omap_mmc_add(int id, unsigned long base, unsigned long size, 203int __init omap_mmc_add(const char *name, int id, unsigned long base,
204 unsigned int irq, struct omap_mmc_platform_data *data) 204 unsigned long size, unsigned int irq,
205 struct omap_mmc_platform_data *data)
205{ 206{
206 struct platform_device *pdev; 207 struct platform_device *pdev;
207 struct resource res[OMAP_MMC_NR_RES]; 208 struct resource res[OMAP_MMC_NR_RES];
208 int ret; 209 int ret;
209 210
210 pdev = platform_device_alloc("mmci-omap", id); 211 pdev = platform_device_alloc(name, id);
211 if (!pdev) 212 if (!pdev)
212 return -ENOMEM; 213 return -ENOMEM;
213 214
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index e77373c39f8c..47ec77af4ccb 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -709,6 +709,7 @@ int omap_request_dma(int dev_id, const char *dev_name,
709 chan->dev_name = dev_name; 709 chan->dev_name = dev_name;
710 chan->callback = callback; 710 chan->callback = callback;
711 chan->data = data; 711 chan->data = data;
712 chan->flags = 0;
712 713
713#ifndef CONFIG_ARCH_OMAP1 714#ifndef CONFIG_ARCH_OMAP1
714 if (cpu_class_is_omap2()) { 715 if (cpu_class_is_omap2()) {
@@ -1888,11 +1889,11 @@ static int omap2_dma_handle_ch(int ch)
1888 status = dma_read(CSR(ch)); 1889 status = dma_read(CSR(ch));
1889 } 1890 }
1890 1891
1892 dma_write(status, CSR(ch));
1893
1891 if (likely(dma_chan[ch].callback != NULL)) 1894 if (likely(dma_chan[ch].callback != NULL))
1892 dma_chan[ch].callback(ch, status, dma_chan[ch].data); 1895 dma_chan[ch].callback(ch, status, dma_chan[ch].data);
1893 1896
1894 dma_write(status, CSR(ch));
1895
1896 return 0; 1897 return 0;
1897} 1898}
1898 1899
diff --git a/arch/arm/plat-omap/include/mach/cpu.h b/arch/arm/plat-omap/include/mach/cpu.h
index b2062f1175de..a8e1178a9468 100644
--- a/arch/arm/plat-omap/include/mach/cpu.h
+++ b/arch/arm/plat-omap/include/mach/cpu.h
@@ -339,6 +339,7 @@ IS_OMAP_TYPE(3430, 0x3430)
339#define OMAP3430_REV_ES2_0 0x34301034 339#define OMAP3430_REV_ES2_0 0x34301034
340#define OMAP3430_REV_ES2_1 0x34302034 340#define OMAP3430_REV_ES2_1 0x34302034
341#define OMAP3430_REV_ES3_0 0x34303034 341#define OMAP3430_REV_ES3_0 0x34303034
342#define OMAP3430_REV_ES3_1 0x34304034
342 343
343/* 344/*
344 * omap_chip bits 345 * omap_chip bits
diff --git a/arch/arm/plat-omap/include/mach/mcbsp.h b/arch/arm/plat-omap/include/mach/mcbsp.h
index eef873db3d48..113c2466c86a 100644
--- a/arch/arm/plat-omap/include/mach/mcbsp.h
+++ b/arch/arm/plat-omap/include/mach/mcbsp.h
@@ -344,7 +344,8 @@ struct omap_mcbsp_platform_data {
344 u8 dma_rx_sync, dma_tx_sync; 344 u8 dma_rx_sync, dma_tx_sync;
345 u16 rx_irq, tx_irq; 345 u16 rx_irq, tx_irq;
346 struct omap_mcbsp_ops *ops; 346 struct omap_mcbsp_ops *ops;
347 char const *clk_name; 347 char const **clk_names;
348 int num_clks;
348}; 349};
349 350
350struct omap_mcbsp { 351struct omap_mcbsp {
@@ -376,7 +377,8 @@ struct omap_mcbsp {
376 /* Protect the field .free, while checking if the mcbsp is in use */ 377 /* Protect the field .free, while checking if the mcbsp is in use */
377 spinlock_t lock; 378 spinlock_t lock;
378 struct omap_mcbsp_platform_data *pdata; 379 struct omap_mcbsp_platform_data *pdata;
379 struct clk *clk; 380 struct clk **clks;
381 int num_clks;
380}; 382};
381extern struct omap_mcbsp **mcbsp_ptr; 383extern struct omap_mcbsp **mcbsp_ptr;
382extern int omap_mcbsp_count; 384extern int omap_mcbsp_count;
diff --git a/arch/arm/plat-omap/include/mach/mmc.h b/arch/arm/plat-omap/include/mach/mmc.h
index 031250f02805..73a9e15031b1 100644
--- a/arch/arm/plat-omap/include/mach/mmc.h
+++ b/arch/arm/plat-omap/include/mach/mmc.h
@@ -115,8 +115,9 @@ void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
115 int nr_controllers); 115 int nr_controllers);
116void omap2_init_mmc(struct omap_mmc_platform_data **mmc_data, 116void omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
117 int nr_controllers); 117 int nr_controllers);
118int omap_mmc_add(int id, unsigned long base, unsigned long size, 118int omap_mmc_add(const char *name, int id, unsigned long base,
119 unsigned int irq, struct omap_mmc_platform_data *data); 119 unsigned long size, unsigned int irq,
120 struct omap_mmc_platform_data *data);
120#else 121#else
121static inline void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data, 122static inline void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
122 int nr_controllers) 123 int nr_controllers)
@@ -126,8 +127,9 @@ static inline void omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
126 int nr_controllers) 127 int nr_controllers)
127{ 128{
128} 129}
129static inline int omap_mmc_add(int id, unsigned long base, unsigned long size, 130static inline int omap_mmc_add(const char *name, int id, unsigned long base,
130 unsigned int irq, struct omap_mmc_platform_data *data) 131 unsigned long size, unsigned int irq,
132 struct omap_mmc_platform_data *data)
131{ 133{
132 return 0; 134 return 0;
133} 135}
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index f2401a831f99..e5842e30e534 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -214,6 +214,7 @@ EXPORT_SYMBOL(omap_mcbsp_set_io_type);
214int omap_mcbsp_request(unsigned int id) 214int omap_mcbsp_request(unsigned int id)
215{ 215{
216 struct omap_mcbsp *mcbsp; 216 struct omap_mcbsp *mcbsp;
217 int i;
217 int err; 218 int err;
218 219
219 if (!omap_mcbsp_check_valid_id(id)) { 220 if (!omap_mcbsp_check_valid_id(id)) {
@@ -225,7 +226,8 @@ int omap_mcbsp_request(unsigned int id)
225 if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->request) 226 if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->request)
226 mcbsp->pdata->ops->request(id); 227 mcbsp->pdata->ops->request(id);
227 228
228 clk_enable(mcbsp->clk); 229 for (i = 0; i < mcbsp->num_clks; i++)
230 clk_enable(mcbsp->clks[i]);
229 231
230 spin_lock(&mcbsp->lock); 232 spin_lock(&mcbsp->lock);
231 if (!mcbsp->free) { 233 if (!mcbsp->free) {
@@ -276,6 +278,7 @@ EXPORT_SYMBOL(omap_mcbsp_request);
276void omap_mcbsp_free(unsigned int id) 278void omap_mcbsp_free(unsigned int id)
277{ 279{
278 struct omap_mcbsp *mcbsp; 280 struct omap_mcbsp *mcbsp;
281 int i;
279 282
280 if (!omap_mcbsp_check_valid_id(id)) { 283 if (!omap_mcbsp_check_valid_id(id)) {
281 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); 284 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
@@ -286,7 +289,8 @@ void omap_mcbsp_free(unsigned int id)
286 if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free) 289 if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free)
287 mcbsp->pdata->ops->free(id); 290 mcbsp->pdata->ops->free(id);
288 291
289 clk_disable(mcbsp->clk); 292 for (i = mcbsp->num_clks - 1; i >= 0; i--)
293 clk_disable(mcbsp->clks[i]);
290 294
291 spin_lock(&mcbsp->lock); 295 spin_lock(&mcbsp->lock);
292 if (mcbsp->free) { 296 if (mcbsp->free) {
@@ -872,6 +876,7 @@ static int __devinit omap_mcbsp_probe(struct platform_device *pdev)
872 struct omap_mcbsp_platform_data *pdata = pdev->dev.platform_data; 876 struct omap_mcbsp_platform_data *pdata = pdev->dev.platform_data;
873 struct omap_mcbsp *mcbsp; 877 struct omap_mcbsp *mcbsp;
874 int id = pdev->id - 1; 878 int id = pdev->id - 1;
879 int i;
875 int ret = 0; 880 int ret = 0;
876 881
877 if (!pdata) { 882 if (!pdata) {
@@ -916,14 +921,25 @@ static int __devinit omap_mcbsp_probe(struct platform_device *pdev)
916 mcbsp->dma_rx_sync = pdata->dma_rx_sync; 921 mcbsp->dma_rx_sync = pdata->dma_rx_sync;
917 mcbsp->dma_tx_sync = pdata->dma_tx_sync; 922 mcbsp->dma_tx_sync = pdata->dma_tx_sync;
918 923
919 if (pdata->clk_name) 924 if (pdata->num_clks) {
920 mcbsp->clk = clk_get(&pdev->dev, pdata->clk_name); 925 mcbsp->num_clks = pdata->num_clks;
921 if (IS_ERR(mcbsp->clk)) { 926 mcbsp->clks = kzalloc(mcbsp->num_clks * sizeof(struct clk *),
922 dev_err(&pdev->dev, 927 GFP_KERNEL);
923 "Invalid clock configuration for McBSP%d.\n", 928 if (!mcbsp->clks) {
924 mcbsp->id); 929 ret = -ENOMEM;
925 ret = PTR_ERR(mcbsp->clk); 930 goto exit;
926 goto err_clk; 931 }
932 for (i = 0; i < mcbsp->num_clks; i++) {
933 mcbsp->clks[i] = clk_get(&pdev->dev, pdata->clk_names[i]);
934 if (IS_ERR(mcbsp->clks[i])) {
935 dev_err(&pdev->dev,
936 "Invalid %s configuration for McBSP%d.\n",
937 pdata->clk_names[i], mcbsp->id);
938 ret = PTR_ERR(mcbsp->clks[i]);
939 goto err_clk;
940 }
941 }
942
927 } 943 }
928 944
929 mcbsp->pdata = pdata; 945 mcbsp->pdata = pdata;
@@ -932,6 +948,9 @@ static int __devinit omap_mcbsp_probe(struct platform_device *pdev)
932 return 0; 948 return 0;
933 949
934err_clk: 950err_clk:
951 while (i--)
952 clk_put(mcbsp->clks[i]);
953 kfree(mcbsp->clks);
935 iounmap(mcbsp->io_base); 954 iounmap(mcbsp->io_base);
936err_ioremap: 955err_ioremap:
937 mcbsp->free = 0; 956 mcbsp->free = 0;
@@ -942,6 +961,7 @@ exit:
942static int __devexit omap_mcbsp_remove(struct platform_device *pdev) 961static int __devexit omap_mcbsp_remove(struct platform_device *pdev)
943{ 962{
944 struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev); 963 struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev);
964 int i;
945 965
946 platform_set_drvdata(pdev, NULL); 966 platform_set_drvdata(pdev, NULL);
947 if (mcbsp) { 967 if (mcbsp) {
@@ -950,12 +970,18 @@ static int __devexit omap_mcbsp_remove(struct platform_device *pdev)
950 mcbsp->pdata->ops->free) 970 mcbsp->pdata->ops->free)
951 mcbsp->pdata->ops->free(mcbsp->id); 971 mcbsp->pdata->ops->free(mcbsp->id);
952 972
953 clk_disable(mcbsp->clk); 973 for (i = mcbsp->num_clks - 1; i >= 0; i--) {
954 clk_put(mcbsp->clk); 974 clk_disable(mcbsp->clks[i]);
975 clk_put(mcbsp->clks[i]);
976 }
955 977
956 iounmap(mcbsp->io_base); 978 iounmap(mcbsp->io_base);
957 979
958 mcbsp->clk = NULL; 980 if (mcbsp->num_clks) {
981 kfree(mcbsp->clks);
982 mcbsp->clks = NULL;
983 mcbsp->num_clks = 0;
984 }
959 mcbsp->free = 0; 985 mcbsp->free = 0;
960 mcbsp->dev = NULL; 986 mcbsp->dev = NULL;
961 } 987 }
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index a949c4fbbddd..8f1f97d56e1e 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -169,26 +169,51 @@ config BF542
169 help 169 help
170 BF542 Processor Support. 170 BF542 Processor Support.
171 171
172config BF542M
173 bool "BF542m"
174 help
175 BF542 Processor Support.
176
172config BF544 177config BF544
173 bool "BF544" 178 bool "BF544"
174 help 179 help
175 BF544 Processor Support. 180 BF544 Processor Support.
176 181
182config BF544M
183 bool "BF544m"
184 help
185 BF544 Processor Support.
186
177config BF547 187config BF547
178 bool "BF547" 188 bool "BF547"
179 help 189 help
180 BF547 Processor Support. 190 BF547 Processor Support.
181 191
192config BF547M
193 bool "BF547m"
194 help
195 BF547 Processor Support.
196
182config BF548 197config BF548
183 bool "BF548" 198 bool "BF548"
184 help 199 help
185 BF548 Processor Support. 200 BF548 Processor Support.
186 201
202config BF548M
203 bool "BF548m"
204 help
205 BF548 Processor Support.
206
187config BF549 207config BF549
188 bool "BF549" 208 bool "BF549"
189 help 209 help
190 BF549 Processor Support. 210 BF549 Processor Support.
191 211
212config BF549M
213 bool "BF549m"
214 help
215 BF549 Processor Support.
216
192config BF561 217config BF561
193 bool "BF561" 218 bool "BF561"
194 help 219 help
@@ -224,39 +249,39 @@ config TICK_SOURCE_SYSTMR0
224 249
225config BF_REV_MIN 250config BF_REV_MIN
226 int 251 int
227 default 0 if (BF51x || BF52x || BF54x) 252 default 0 if (BF51x || BF52x || (BF54x && !BF54xM))
228 default 2 if (BF537 || BF536 || BF534) 253 default 2 if (BF537 || BF536 || BF534)
229 default 3 if (BF561 ||BF533 || BF532 || BF531) 254 default 3 if (BF561 || BF533 || BF532 || BF531 || BF54xM)
230 default 4 if (BF538 || BF539) 255 default 4 if (BF538 || BF539)
231 256
232config BF_REV_MAX 257config BF_REV_MAX
233 int 258 int
234 default 2 if (BF51x || BF52x || BF54x) 259 default 2 if (BF51x || BF52x || (BF54x && !BF54xM))
235 default 3 if (BF537 || BF536 || BF534) 260 default 3 if (BF537 || BF536 || BF534 || BF54xM)
236 default 5 if (BF561 || BF538 || BF539) 261 default 5 if (BF561 || BF538 || BF539)
237 default 6 if (BF533 || BF532 || BF531) 262 default 6 if (BF533 || BF532 || BF531)
238 263
239choice 264choice
240 prompt "Silicon Rev" 265 prompt "Silicon Rev"
241 default BF_REV_0_1 if (BF51x || BF52x || BF54x) 266 default BF_REV_0_1 if (BF51x || BF52x || (BF54x && !BF54xM))
242 default BF_REV_0_2 if (BF534 || BF536 || BF537) 267 default BF_REV_0_2 if (BF534 || BF536 || BF537)
243 default BF_REV_0_3 if (BF531 || BF532 || BF533 || BF561) 268 default BF_REV_0_3 if (BF531 || BF532 || BF533 || BF54xM || BF561)
244 269
245config BF_REV_0_0 270config BF_REV_0_0
246 bool "0.0" 271 bool "0.0"
247 depends on (BF51x || BF52x || BF54x) 272 depends on (BF51x || BF52x || (BF54x && !BF54xM))
248 273
249config BF_REV_0_1 274config BF_REV_0_1
250 bool "0.1" 275 bool "0.1"
251 depends on (BF52x || BF54x) 276 depends on (BF52x || (BF54x && !BF54xM))
252 277
253config BF_REV_0_2 278config BF_REV_0_2
254 bool "0.2" 279 bool "0.2"
255 depends on (BF52x || BF537 || BF536 || BF534 || BF54x) 280 depends on (BF52x || BF537 || BF536 || BF534 || (BF54x && !BF54xM))
256 281
257config BF_REV_0_3 282config BF_REV_0_3
258 bool "0.3" 283 bool "0.3"
259 depends on (BF561 || BF537 || BF536 || BF534 || BF533 || BF532 || BF531) 284 depends on (BF54xM || BF561 || BF537 || BF536 || BF534 || BF533 || BF532 || BF531)
260 285
261config BF_REV_0_4 286config BF_REV_0_4
262 bool "0.4" 287 bool "0.4"
@@ -293,9 +318,14 @@ config BF53x
293 depends on (BF531 || BF532 || BF533 || BF534 || BF536 || BF537) 318 depends on (BF531 || BF532 || BF533 || BF534 || BF536 || BF537)
294 default y 319 default y
295 320
321config BF54xM
322 bool
323 depends on (BF542M || BF544M || BF547M || BF548M || BF549M)
324 default y
325
296config BF54x 326config BF54x
297 bool 327 bool
298 depends on (BF542 || BF544 || BF547 || BF548 || BF549) 328 depends on (BF542 || BF544 || BF547 || BF548 || BF549 || BF54xM)
299 default y 329 default y
300 330
301config MEM_GENERIC_BOARD 331config MEM_GENERIC_BOARD
diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile
index e550c8d46066..d54c8283825c 100644
--- a/arch/blackfin/Makefile
+++ b/arch/blackfin/Makefile
@@ -21,57 +21,67 @@ KALLSYMS += --symbol-prefix=_
21KBUILD_DEFCONFIG := BF537-STAMP_defconfig 21KBUILD_DEFCONFIG := BF537-STAMP_defconfig
22 22
23# setup the machine name and the machine dependent settings 23# setup the machine name and the machine dependent settings
24machine-$(CONFIG_BF512) := bf518 24machine-$(CONFIG_BF512) := bf518
25machine-$(CONFIG_BF514) := bf518 25machine-$(CONFIG_BF514) := bf518
26machine-$(CONFIG_BF516) := bf518 26machine-$(CONFIG_BF516) := bf518
27machine-$(CONFIG_BF518) := bf518 27machine-$(CONFIG_BF518) := bf518
28machine-$(CONFIG_BF522) := bf527 28machine-$(CONFIG_BF522) := bf527
29machine-$(CONFIG_BF523) := bf527 29machine-$(CONFIG_BF523) := bf527
30machine-$(CONFIG_BF524) := bf527 30machine-$(CONFIG_BF524) := bf527
31machine-$(CONFIG_BF525) := bf527 31machine-$(CONFIG_BF525) := bf527
32machine-$(CONFIG_BF526) := bf527 32machine-$(CONFIG_BF526) := bf527
33machine-$(CONFIG_BF527) := bf527 33machine-$(CONFIG_BF527) := bf527
34machine-$(CONFIG_BF531) := bf533 34machine-$(CONFIG_BF531) := bf533
35machine-$(CONFIG_BF532) := bf533 35machine-$(CONFIG_BF532) := bf533
36machine-$(CONFIG_BF533) := bf533 36machine-$(CONFIG_BF533) := bf533
37machine-$(CONFIG_BF534) := bf537 37machine-$(CONFIG_BF534) := bf537
38machine-$(CONFIG_BF536) := bf537 38machine-$(CONFIG_BF536) := bf537
39machine-$(CONFIG_BF537) := bf537 39machine-$(CONFIG_BF537) := bf537
40machine-$(CONFIG_BF538) := bf538 40machine-$(CONFIG_BF538) := bf538
41machine-$(CONFIG_BF539) := bf538 41machine-$(CONFIG_BF539) := bf538
42machine-$(CONFIG_BF542) := bf548 42machine-$(CONFIG_BF542) := bf548
43machine-$(CONFIG_BF544) := bf548 43machine-$(CONFIG_BF542M) := bf548
44machine-$(CONFIG_BF547) := bf548 44machine-$(CONFIG_BF544) := bf548
45machine-$(CONFIG_BF548) := bf548 45machine-$(CONFIG_BF544M) := bf548
46machine-$(CONFIG_BF549) := bf548 46machine-$(CONFIG_BF547) := bf548
47machine-$(CONFIG_BF561) := bf561 47machine-$(CONFIG_BF547M) := bf548
48machine-$(CONFIG_BF548) := bf548
49machine-$(CONFIG_BF548M) := bf548
50machine-$(CONFIG_BF549) := bf548
51machine-$(CONFIG_BF549M) := bf548
52machine-$(CONFIG_BF561) := bf561
48MACHINE := $(machine-y) 53MACHINE := $(machine-y)
49export MACHINE 54export MACHINE
50 55
51cpu-$(CONFIG_BF512) := bf512 56cpu-$(CONFIG_BF512) := bf512
52cpu-$(CONFIG_BF514) := bf514 57cpu-$(CONFIG_BF514) := bf514
53cpu-$(CONFIG_BF516) := bf516 58cpu-$(CONFIG_BF516) := bf516
54cpu-$(CONFIG_BF518) := bf518 59cpu-$(CONFIG_BF518) := bf518
55cpu-$(CONFIG_BF522) := bf522 60cpu-$(CONFIG_BF522) := bf522
56cpu-$(CONFIG_BF523) := bf523 61cpu-$(CONFIG_BF523) := bf523
57cpu-$(CONFIG_BF524) := bf524 62cpu-$(CONFIG_BF524) := bf524
58cpu-$(CONFIG_BF525) := bf525 63cpu-$(CONFIG_BF525) := bf525
59cpu-$(CONFIG_BF526) := bf526 64cpu-$(CONFIG_BF526) := bf526
60cpu-$(CONFIG_BF527) := bf527 65cpu-$(CONFIG_BF527) := bf527
61cpu-$(CONFIG_BF531) := bf531 66cpu-$(CONFIG_BF531) := bf531
62cpu-$(CONFIG_BF532) := bf532 67cpu-$(CONFIG_BF532) := bf532
63cpu-$(CONFIG_BF533) := bf533 68cpu-$(CONFIG_BF533) := bf533
64cpu-$(CONFIG_BF534) := bf534 69cpu-$(CONFIG_BF534) := bf534
65cpu-$(CONFIG_BF536) := bf536 70cpu-$(CONFIG_BF536) := bf536
66cpu-$(CONFIG_BF537) := bf537 71cpu-$(CONFIG_BF537) := bf537
67cpu-$(CONFIG_BF538) := bf538 72cpu-$(CONFIG_BF538) := bf538
68cpu-$(CONFIG_BF539) := bf539 73cpu-$(CONFIG_BF539) := bf539
69cpu-$(CONFIG_BF542) := bf542 74cpu-$(CONFIG_BF542) := bf542
70cpu-$(CONFIG_BF544) := bf544 75cpu-$(CONFIG_BF542M) := bf542m
71cpu-$(CONFIG_BF547) := bf547 76cpu-$(CONFIG_BF544) := bf544
72cpu-$(CONFIG_BF548) := bf548 77cpu-$(CONFIG_BF544M) := bf544m
73cpu-$(CONFIG_BF549) := bf549 78cpu-$(CONFIG_BF547) := bf547
74cpu-$(CONFIG_BF561) := bf561 79cpu-$(CONFIG_BF547M) := bf547m
80cpu-$(CONFIG_BF548) := bf548
81cpu-$(CONFIG_BF548M) := bf548m
82cpu-$(CONFIG_BF549) := bf549
83cpu-$(CONFIG_BF549M) := bf549m
84cpu-$(CONFIG_BF561) := bf561
75 85
76rev-$(CONFIG_BF_REV_0_0) := 0.0 86rev-$(CONFIG_BF_REV_0_0) := 0.0
77rev-$(CONFIG_BF_REV_0_1) := 0.1 87rev-$(CONFIG_BF_REV_0_1) := 0.1
diff --git a/arch/blackfin/configs/BF518F-EZBRD_defconfig b/arch/blackfin/configs/BF518F-EZBRD_defconfig
index defb9785c65b..4fdb9e04759f 100644
--- a/arch/blackfin/configs/BF518F-EZBRD_defconfig
+++ b/arch/blackfin/configs/BF518F-EZBRD_defconfig
@@ -1,6 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.28-rc2 3# Linux kernel version: 2.6.28-rc2
4# Fri Jan 9 17:58:41 2009
4# 5#
5# CONFIG_MMU is not set 6# CONFIG_MMU is not set
6# CONFIG_FPU is not set 7# CONFIG_FPU is not set
@@ -149,6 +150,7 @@ CONFIG_BF_REV_0_0=y
149# CONFIG_BF_REV_ANY is not set 150# CONFIG_BF_REV_ANY is not set
150# CONFIG_BF_REV_NONE is not set 151# CONFIG_BF_REV_NONE is not set
151CONFIG_BF51x=y 152CONFIG_BF51x=y
153CONFIG_MEM_MT48LC32M8A2_75=y
152CONFIG_BFIN518F_EZBRD=y 154CONFIG_BFIN518F_EZBRD=y
153 155
154# 156#
@@ -598,7 +600,10 @@ CONFIG_PHYLIB=y
598# CONFIG_MDIO_BITBANG is not set 600# CONFIG_MDIO_BITBANG is not set
599CONFIG_NET_ETHERNET=y 601CONFIG_NET_ETHERNET=y
600CONFIG_MII=y 602CONFIG_MII=y
601# CONFIG_BFIN_MAC is not set 603CONFIG_BFIN_MAC=y
604CONFIG_BFIN_TX_DESC_NUM=10
605CONFIG_BFIN_RX_DESC_NUM=20
606# CONFIG_BFIN_MAC_RMII is not set
602# CONFIG_SMC91X is not set 607# CONFIG_SMC91X is not set
603# CONFIG_SMSC911X is not set 608# CONFIG_SMSC911X is not set
604# CONFIG_DM9000 is not set 609# CONFIG_DM9000 is not set
@@ -679,7 +684,7 @@ CONFIG_VT_CONSOLE=y
679CONFIG_HW_CONSOLE=y 684CONFIG_HW_CONSOLE=y
680# CONFIG_VT_HW_CONSOLE_BINDING is not set 685# CONFIG_VT_HW_CONSOLE_BINDING is not set
681# CONFIG_DEVKMEM is not set 686# CONFIG_DEVKMEM is not set
682# CONFIG_BFIN_JTAG_COMM is not set 687CONFIG_BFIN_JTAG_COMM=m
683# CONFIG_SERIAL_NONSTANDARD is not set 688# CONFIG_SERIAL_NONSTANDARD is not set
684 689
685# 690#
diff --git a/arch/blackfin/configs/BF526-EZBRD_defconfig b/arch/blackfin/configs/BF526-EZBRD_defconfig
index 992424ff3153..8e2b855b8db7 100644
--- a/arch/blackfin/configs/BF526-EZBRD_defconfig
+++ b/arch/blackfin/configs/BF526-EZBRD_defconfig
@@ -723,7 +723,7 @@ CONFIG_VT_CONSOLE=y
723CONFIG_HW_CONSOLE=y 723CONFIG_HW_CONSOLE=y
724# CONFIG_VT_HW_CONSOLE_BINDING is not set 724# CONFIG_VT_HW_CONSOLE_BINDING is not set
725# CONFIG_DEVKMEM is not set 725# CONFIG_DEVKMEM is not set
726# CONFIG_BFIN_JTAG_COMM is not set 726CONFIG_BFIN_JTAG_COMM=m
727# CONFIG_SERIAL_NONSTANDARD is not set 727# CONFIG_SERIAL_NONSTANDARD is not set
728 728
729# 729#
diff --git a/arch/blackfin/configs/BF527-EZKIT_defconfig b/arch/blackfin/configs/BF527-EZKIT_defconfig
index 21e3c1af55ba..833128b39724 100644
--- a/arch/blackfin/configs/BF527-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF527-EZKIT_defconfig
@@ -767,7 +767,7 @@ CONFIG_VT_CONSOLE=y
767CONFIG_HW_CONSOLE=y 767CONFIG_HW_CONSOLE=y
768# CONFIG_VT_HW_CONSOLE_BINDING is not set 768# CONFIG_VT_HW_CONSOLE_BINDING is not set
769# CONFIG_DEVKMEM is not set 769# CONFIG_DEVKMEM is not set
770# CONFIG_BFIN_JTAG_COMM is not set 770CONFIG_BFIN_JTAG_COMM=m
771# CONFIG_SERIAL_NONSTANDARD is not set 771# CONFIG_SERIAL_NONSTANDARD is not set
772 772
773# 773#
diff --git a/arch/blackfin/configs/BF533-EZKIT_defconfig b/arch/blackfin/configs/BF533-EZKIT_defconfig
index 0bdf20a1af61..334c94b51c40 100644
--- a/arch/blackfin/configs/BF533-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF533-EZKIT_defconfig
@@ -672,7 +672,7 @@ CONFIG_BFIN_DMA_INTERFACE=m
672CONFIG_SIMPLE_GPIO=m 672CONFIG_SIMPLE_GPIO=m
673# CONFIG_VT is not set 673# CONFIG_VT is not set
674# CONFIG_DEVKMEM is not set 674# CONFIG_DEVKMEM is not set
675# CONFIG_BFIN_JTAG_COMM is not set 675CONFIG_BFIN_JTAG_COMM=m
676# CONFIG_SERIAL_NONSTANDARD is not set 676# CONFIG_SERIAL_NONSTANDARD is not set
677 677
678# 678#
diff --git a/arch/blackfin/configs/BF533-STAMP_defconfig b/arch/blackfin/configs/BF533-STAMP_defconfig
index 2f747d6e97e2..9d733436e300 100644
--- a/arch/blackfin/configs/BF533-STAMP_defconfig
+++ b/arch/blackfin/configs/BF533-STAMP_defconfig
@@ -679,7 +679,7 @@ CONFIG_BFIN_DMA_INTERFACE=m
679CONFIG_SIMPLE_GPIO=m 679CONFIG_SIMPLE_GPIO=m
680# CONFIG_VT is not set 680# CONFIG_VT is not set
681# CONFIG_DEVKMEM is not set 681# CONFIG_DEVKMEM is not set
682# CONFIG_BFIN_JTAG_COMM is not set 682CONFIG_BFIN_JTAG_COMM=m
683# CONFIG_SERIAL_NONSTANDARD is not set 683# CONFIG_SERIAL_NONSTANDARD is not set
684 684
685# 685#
diff --git a/arch/blackfin/configs/BF537-STAMP_defconfig b/arch/blackfin/configs/BF537-STAMP_defconfig
index 8b0a81294e65..4fb4108d3103 100644
--- a/arch/blackfin/configs/BF537-STAMP_defconfig
+++ b/arch/blackfin/configs/BF537-STAMP_defconfig
@@ -722,7 +722,7 @@ CONFIG_BFIN_DMA_INTERFACE=m
722CONFIG_SIMPLE_GPIO=m 722CONFIG_SIMPLE_GPIO=m
723# CONFIG_VT is not set 723# CONFIG_VT is not set
724# CONFIG_DEVKMEM is not set 724# CONFIG_DEVKMEM is not set
725# CONFIG_BFIN_JTAG_COMM is not set 725CONFIG_BFIN_JTAG_COMM=m
726# CONFIG_SERIAL_NONSTANDARD is not set 726# CONFIG_SERIAL_NONSTANDARD is not set
727 727
728# 728#
diff --git a/arch/blackfin/configs/BF538-EZKIT_defconfig b/arch/blackfin/configs/BF538-EZKIT_defconfig
index a1f766bf7d9b..cb32f5624a1b 100644
--- a/arch/blackfin/configs/BF538-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF538-EZKIT_defconfig
@@ -726,7 +726,7 @@ CONFIG_BFIN_DMA_INTERFACE=m
726CONFIG_SIMPLE_GPIO=m 726CONFIG_SIMPLE_GPIO=m
727# CONFIG_VT is not set 727# CONFIG_VT is not set
728# CONFIG_DEVKMEM is not set 728# CONFIG_DEVKMEM is not set
729# CONFIG_BFIN_JTAG_COMM is not set 729CONFIG_BFIN_JTAG_COMM=m
730# CONFIG_SERIAL_NONSTANDARD is not set 730# CONFIG_SERIAL_NONSTANDARD is not set
731 731
732# 732#
diff --git a/arch/blackfin/configs/BF548-EZKIT_defconfig b/arch/blackfin/configs/BF548-EZKIT_defconfig
index cd2da6b7692c..0f8697618aa5 100644
--- a/arch/blackfin/configs/BF548-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF548-EZKIT_defconfig
@@ -856,7 +856,7 @@ CONFIG_VT_CONSOLE=y
856CONFIG_HW_CONSOLE=y 856CONFIG_HW_CONSOLE=y
857# CONFIG_VT_HW_CONSOLE_BINDING is not set 857# CONFIG_VT_HW_CONSOLE_BINDING is not set
858# CONFIG_DEVKMEM is not set 858# CONFIG_DEVKMEM is not set
859# CONFIG_BFIN_JTAG_COMM is not set 859CONFIG_BFIN_JTAG_COMM=m
860# CONFIG_SERIAL_NONSTANDARD is not set 860# CONFIG_SERIAL_NONSTANDARD is not set
861 861
862# 862#
diff --git a/arch/blackfin/configs/BF561-EZKIT_defconfig b/arch/blackfin/configs/BF561-EZKIT_defconfig
index b398ca202dbd..042c7adfccfa 100644
--- a/arch/blackfin/configs/BF561-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF561-EZKIT_defconfig
@@ -709,7 +709,7 @@ CONFIG_BFIN_DMA_INTERFACE=m
709CONFIG_SIMPLE_GPIO=m 709CONFIG_SIMPLE_GPIO=m
710# CONFIG_VT is not set 710# CONFIG_VT is not set
711# CONFIG_DEVKMEM is not set 711# CONFIG_DEVKMEM is not set
712# CONFIG_BFIN_JTAG_COMM is not set 712CONFIG_BFIN_JTAG_COMM=m
713# CONFIG_SERIAL_NONSTANDARD is not set 713# CONFIG_SERIAL_NONSTANDARD is not set
714 714
715# 715#
diff --git a/arch/blackfin/configs/CM-BF527_defconfig b/arch/blackfin/configs/CM-BF527_defconfig
index 95146948166f..865ed85a5760 100644
--- a/arch/blackfin/configs/CM-BF527_defconfig
+++ b/arch/blackfin/configs/CM-BF527_defconfig
@@ -1,7 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.24.7 3# Linux kernel version: 2.6.28
4# Fri Jul 18 18:00:41 2008
5# 4#
6# CONFIG_MMU is not set 5# CONFIG_MMU is not set
7# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -9,7 +8,6 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
9# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
10CONFIG_BLACKFIN=y 9CONFIG_BLACKFIN=y
11CONFIG_ZONE_DMA=y 10CONFIG_ZONE_DMA=y
12CONFIG_SEMAPHORE_SLEEPERS=y
13CONFIG_GENERIC_FIND_NEXT_BIT=y 11CONFIG_GENERIC_FIND_NEXT_BIT=y
14CONFIG_GENERIC_HWEIGHT=y 12CONFIG_GENERIC_HWEIGHT=y
15CONFIG_GENERIC_HARDIRQS=y 13CONFIG_GENERIC_HARDIRQS=y
@@ -32,18 +30,16 @@ CONFIG_SYSVIPC_SYSCTL=y
32# CONFIG_POSIX_MQUEUE is not set 30# CONFIG_POSIX_MQUEUE is not set
33# CONFIG_BSD_PROCESS_ACCT is not set 31# CONFIG_BSD_PROCESS_ACCT is not set
34# CONFIG_TASKSTATS is not set 32# CONFIG_TASKSTATS is not set
35# CONFIG_USER_NS is not set
36# CONFIG_PID_NS is not set
37# CONFIG_AUDIT is not set 33# CONFIG_AUDIT is not set
38CONFIG_IKCONFIG=y 34CONFIG_IKCONFIG=y
39CONFIG_IKCONFIG_PROC=y 35CONFIG_IKCONFIG_PROC=y
40CONFIG_LOG_BUF_SHIFT=14 36CONFIG_LOG_BUF_SHIFT=14
41# CONFIG_CGROUPS is not set 37# CONFIG_CGROUPS is not set
42CONFIG_FAIR_GROUP_SCHED=y 38# CONFIG_GROUP_SCHED is not set
43CONFIG_FAIR_USER_SCHED=y 39CONFIG_SYSFS_DEPRECATED=y
44# CONFIG_FAIR_CGROUP_SCHED is not set 40CONFIG_SYSFS_DEPRECATED_V2=y
45# CONFIG_SYSFS_DEPRECATED is not set
46# CONFIG_RELAY is not set 41# CONFIG_RELAY is not set
42# CONFIG_NAMESPACES is not set
47CONFIG_BLK_DEV_INITRD=y 43CONFIG_BLK_DEV_INITRD=y
48CONFIG_INITRAMFS_SOURCE="" 44CONFIG_INITRAMFS_SOURCE=""
49# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 45# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -52,26 +48,35 @@ CONFIG_EMBEDDED=y
52CONFIG_UID16=y 48CONFIG_UID16=y
53CONFIG_SYSCTL_SYSCALL=y 49CONFIG_SYSCTL_SYSCALL=y
54CONFIG_KALLSYMS=y 50CONFIG_KALLSYMS=y
51# CONFIG_KALLSYMS_ALL is not set
55# CONFIG_KALLSYMS_EXTRA_PASS is not set 52# CONFIG_KALLSYMS_EXTRA_PASS is not set
56CONFIG_HOTPLUG=y 53CONFIG_HOTPLUG=y
57CONFIG_PRINTK=y 54CONFIG_PRINTK=y
58CONFIG_BUG=y 55CONFIG_BUG=y
59# CONFIG_ELF_CORE is not set 56# CONFIG_ELF_CORE is not set
57CONFIG_COMPAT_BRK=y
60CONFIG_BASE_FULL=y 58CONFIG_BASE_FULL=y
61CONFIG_FUTEX=y 59CONFIG_FUTEX=y
62CONFIG_ANON_INODES=y 60CONFIG_ANON_INODES=y
63CONFIG_EPOLL=y 61CONFIG_EPOLL=y
64CONFIG_SIGNALFD=y 62CONFIG_SIGNALFD=y
63CONFIG_TIMERFD=y
65CONFIG_EVENTFD=y 64CONFIG_EVENTFD=y
65CONFIG_AIO=y
66CONFIG_VM_EVENT_COUNTERS=y 66CONFIG_VM_EVENT_COUNTERS=y
67CONFIG_SLAB=y 67CONFIG_SLAB=y
68# CONFIG_SLUB is not set 68# CONFIG_SLUB is not set
69# CONFIG_SLOB is not set 69# CONFIG_SLOB is not set
70# CONFIG_PROFILING is not set
71# CONFIG_MARKERS is not set
72CONFIG_HAVE_OPROFILE=y
73# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
70CONFIG_SLABINFO=y 74CONFIG_SLABINFO=y
71CONFIG_RT_MUTEXES=y 75CONFIG_RT_MUTEXES=y
72CONFIG_TINY_SHMEM=y 76CONFIG_TINY_SHMEM=y
73CONFIG_BASE_SMALL=0 77CONFIG_BASE_SMALL=0
74CONFIG_MODULES=y 78CONFIG_MODULES=y
79# CONFIG_MODULE_FORCE_LOAD is not set
75CONFIG_MODULE_UNLOAD=y 80CONFIG_MODULE_UNLOAD=y
76# CONFIG_MODULE_FORCE_UNLOAD is not set 81# CONFIG_MODULE_FORCE_UNLOAD is not set
77# CONFIG_MODVERSIONS is not set 82# CONFIG_MODVERSIONS is not set
@@ -82,6 +87,7 @@ CONFIG_BLOCK=y
82# CONFIG_BLK_DEV_IO_TRACE is not set 87# CONFIG_BLK_DEV_IO_TRACE is not set
83# CONFIG_LSF is not set 88# CONFIG_LSF is not set
84# CONFIG_BLK_DEV_BSG is not set 89# CONFIG_BLK_DEV_BSG is not set
90# CONFIG_BLK_DEV_INTEGRITY is not set
85 91
86# 92#
87# IO Schedulers 93# IO Schedulers
@@ -95,9 +101,11 @@ CONFIG_IOSCHED_CFQ=y
95CONFIG_DEFAULT_CFQ=y 101CONFIG_DEFAULT_CFQ=y
96# CONFIG_DEFAULT_NOOP is not set 102# CONFIG_DEFAULT_NOOP is not set
97CONFIG_DEFAULT_IOSCHED="cfq" 103CONFIG_DEFAULT_IOSCHED="cfq"
104CONFIG_CLASSIC_RCU=y
98# CONFIG_PREEMPT_NONE is not set 105# CONFIG_PREEMPT_NONE is not set
99CONFIG_PREEMPT_VOLUNTARY=y 106CONFIG_PREEMPT_VOLUNTARY=y
100# CONFIG_PREEMPT is not set 107# CONFIG_PREEMPT is not set
108# CONFIG_FREEZER is not set
101 109
102# 110#
103# Blackfin Processor Options 111# Blackfin Processor Options
@@ -106,6 +114,10 @@ CONFIG_PREEMPT_VOLUNTARY=y
106# 114#
107# Processor and Board Settings 115# Processor and Board Settings
108# 116#
117# CONFIG_BF512 is not set
118# CONFIG_BF514 is not set
119# CONFIG_BF516 is not set
120# CONFIG_BF518 is not set
109# CONFIG_BF522 is not set 121# CONFIG_BF522 is not set
110# CONFIG_BF523 is not set 122# CONFIG_BF523 is not set
111# CONFIG_BF524 is not set 123# CONFIG_BF524 is not set
@@ -118,48 +130,32 @@ CONFIG_BF527=y
118# CONFIG_BF534 is not set 130# CONFIG_BF534 is not set
119# CONFIG_BF536 is not set 131# CONFIG_BF536 is not set
120# CONFIG_BF537 is not set 132# CONFIG_BF537 is not set
133# CONFIG_BF538 is not set
134# CONFIG_BF539 is not set
121# CONFIG_BF542 is not set 135# CONFIG_BF542 is not set
136# CONFIG_BF542M is not set
122# CONFIG_BF544 is not set 137# CONFIG_BF544 is not set
138# CONFIG_BF544M is not set
123# CONFIG_BF547 is not set 139# CONFIG_BF547 is not set
140# CONFIG_BF547M is not set
124# CONFIG_BF548 is not set 141# CONFIG_BF548 is not set
142# CONFIG_BF548M is not set
125# CONFIG_BF549 is not set 143# CONFIG_BF549 is not set
144# CONFIG_BF549M is not set
126# CONFIG_BF561 is not set 145# CONFIG_BF561 is not set
146CONFIG_BF_REV_MIN=0
147CONFIG_BF_REV_MAX=2
127# CONFIG_BF_REV_0_0 is not set 148# CONFIG_BF_REV_0_0 is not set
128CONFIG_BF_REV_0_1=y 149CONFIG_BF_REV_0_1=y
129# CONFIG_BF_REV_0_2 is not set 150# CONFIG_BF_REV_0_2 is not set
130# CONFIG_BF_REV_0_3 is not set 151# CONFIG_BF_REV_0_3 is not set
131# CONFIG_BF_REV_0_4 is not set 152# CONFIG_BF_REV_0_4 is not set
132# CONFIG_BF_REV_0_5 is not set 153# CONFIG_BF_REV_0_5 is not set
154# CONFIG_BF_REV_0_6 is not set
133# CONFIG_BF_REV_ANY is not set 155# CONFIG_BF_REV_ANY is not set
134# CONFIG_BF_REV_NONE is not set 156# CONFIG_BF_REV_NONE is not set
135CONFIG_BF52x=y 157CONFIG_BF52x=y
136CONFIG_MEM_MT48LC16M16A2TG_75=y 158CONFIG_MEM_MT48LC16M16A2TG_75=y
137# CONFIG_BFIN527_EZKIT is not set
138CONFIG_BFIN527_BLUETECHNIX_CM=y
139
140#
141# BF527 Specific Configuration
142#
143
144#
145# Alternative Multiplexing Scheme
146#
147# CONFIG_BF527_SPORT0_PORTF is not set
148CONFIG_BF527_SPORT0_PORTG=y
149CONFIG_BF527_SPORT0_TSCLK_PG10=y
150# CONFIG_BF527_SPORT0_TSCLK_PG14 is not set
151CONFIG_BF527_UART1_PORTF=y
152# CONFIG_BF527_UART1_PORTG is not set
153# CONFIG_BF527_NAND_D_PORTF is not set
154CONFIG_BF527_NAND_D_PORTH=y
155
156#
157# Interrupt Priority Assignment
158#
159
160#
161# Priority
162#
163CONFIG_IRQ_PLL_WAKEUP=7 159CONFIG_IRQ_PLL_WAKEUP=7
164CONFIG_IRQ_DMA0_ERROR=7 160CONFIG_IRQ_DMA0_ERROR=7
165CONFIG_IRQ_DMAR0_BLK=7 161CONFIG_IRQ_DMAR0_BLK=7
@@ -179,7 +175,6 @@ CONFIG_IRQ_SPORT0_TX=9
179CONFIG_IRQ_SPORT1_RX=9 175CONFIG_IRQ_SPORT1_RX=9
180CONFIG_IRQ_SPORT1_TX=9 176CONFIG_IRQ_SPORT1_TX=9
181CONFIG_IRQ_TWI=10 177CONFIG_IRQ_TWI=10
182CONFIG_IRQ_SPI=10
183CONFIG_IRQ_UART0_RX=10 178CONFIG_IRQ_UART0_RX=10
184CONFIG_IRQ_UART0_TX=10 179CONFIG_IRQ_UART0_TX=10
185CONFIG_IRQ_UART1_RX=10 180CONFIG_IRQ_UART1_RX=10
@@ -205,6 +200,34 @@ CONFIG_IRQ_MEM_DMA1=13
205CONFIG_IRQ_WATCH=13 200CONFIG_IRQ_WATCH=13
206CONFIG_IRQ_PORTF_INTA=13 201CONFIG_IRQ_PORTF_INTA=13
207CONFIG_IRQ_PORTF_INTB=13 202CONFIG_IRQ_PORTF_INTB=13
203# CONFIG_BFIN527_EZKIT is not set
204CONFIG_BFIN527_BLUETECHNIX_CM=y
205# CONFIG_BFIN526_EZBRD is not set
206
207#
208# BF527 Specific Configuration
209#
210
211#
212# Alternative Multiplexing Scheme
213#
214# CONFIG_BF527_SPORT0_PORTF is not set
215CONFIG_BF527_SPORT0_PORTG=y
216CONFIG_BF527_SPORT0_TSCLK_PG10=y
217# CONFIG_BF527_SPORT0_TSCLK_PG14 is not set
218CONFIG_BF527_UART1_PORTF=y
219# CONFIG_BF527_UART1_PORTG is not set
220# CONFIG_BF527_NAND_D_PORTF is not set
221CONFIG_BF527_NAND_D_PORTH=y
222
223#
224# Interrupt Priority Assignment
225#
226
227#
228# Priority
229#
230CONFIG_IRQ_SPI=10
208CONFIG_IRQ_SPI_ERROR=7 231CONFIG_IRQ_SPI_ERROR=7
209CONFIG_IRQ_NFC_ERROR=7 232CONFIG_IRQ_NFC_ERROR=7
210CONFIG_IRQ_HDMA_ERROR=7 233CONFIG_IRQ_HDMA_ERROR=7
@@ -226,7 +249,6 @@ CONFIG_BOOT_LOAD=0x1000
226# 249#
227CONFIG_CLKIN_HZ=25000000 250CONFIG_CLKIN_HZ=25000000
228# CONFIG_BFIN_KERNEL_CLOCK is not set 251# CONFIG_BFIN_KERNEL_CLOCK is not set
229CONFIG_MAX_MEM_SIZE=512
230CONFIG_MAX_VCO_HZ=600000000 252CONFIG_MAX_VCO_HZ=600000000
231CONFIG_MIN_VCO_HZ=50000000 253CONFIG_MIN_VCO_HZ=50000000
232CONFIG_MAX_SCLK_HZ=133333333 254CONFIG_MAX_SCLK_HZ=133333333
@@ -240,10 +262,10 @@ CONFIG_HZ_250=y
240# CONFIG_HZ_300 is not set 262# CONFIG_HZ_300 is not set
241# CONFIG_HZ_1000 is not set 263# CONFIG_HZ_1000 is not set
242CONFIG_HZ=250 264CONFIG_HZ=250
265# CONFIG_SCHED_HRTICK is not set
243CONFIG_GENERIC_TIME=y 266CONFIG_GENERIC_TIME=y
244CONFIG_GENERIC_CLOCKEVENTS=y 267CONFIG_GENERIC_CLOCKEVENTS=y
245# CONFIG_CYCLES_CLOCKSOURCE is not set 268# CONFIG_CYCLES_CLOCKSOURCE is not set
246# CONFIG_TICK_ONESHOT is not set
247# CONFIG_NO_HZ is not set 269# CONFIG_NO_HZ is not set
248# CONFIG_HIGH_RES_TIMERS is not set 270# CONFIG_HIGH_RES_TIMERS is not set
249CONFIG_GENERIC_CLOCKEVENTS_BUILD=y 271CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
@@ -277,6 +299,12 @@ CONFIG_ACCESS_OK_L1=y
277CONFIG_CACHELINE_ALIGNED_L1=y 299CONFIG_CACHELINE_ALIGNED_L1=y
278# CONFIG_SYSCALL_TAB_L1 is not set 300# CONFIG_SYSCALL_TAB_L1 is not set
279# CONFIG_CPLB_SWITCH_TAB_L1 is not set 301# CONFIG_CPLB_SWITCH_TAB_L1 is not set
302CONFIG_APP_STACK_L1=y
303
304#
305# Speed Optimizations
306#
307CONFIG_BFIN_INS_LOWOVERHEAD=y
280CONFIG_RAMKERNEL=y 308CONFIG_RAMKERNEL=y
281# CONFIG_ROMKERNEL is not set 309# CONFIG_ROMKERNEL is not set
282CONFIG_SELECT_MEMORY_MODEL=y 310CONFIG_SELECT_MEMORY_MODEL=y
@@ -285,10 +313,10 @@ CONFIG_FLATMEM_MANUAL=y
285# CONFIG_SPARSEMEM_MANUAL is not set 313# CONFIG_SPARSEMEM_MANUAL is not set
286CONFIG_FLATMEM=y 314CONFIG_FLATMEM=y
287CONFIG_FLAT_NODE_MEM_MAP=y 315CONFIG_FLAT_NODE_MEM_MAP=y
288# CONFIG_SPARSEMEM_STATIC is not set 316CONFIG_PAGEFLAGS_EXTENDED=y
289# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
290CONFIG_SPLIT_PTLOCK_CPUS=4 317CONFIG_SPLIT_PTLOCK_CPUS=4
291# CONFIG_RESOURCES_64BIT is not set 318# CONFIG_RESOURCES_64BIT is not set
319# CONFIG_PHYS_ADDR_T_64BIT is not set
292CONFIG_ZONE_DMA_FLAG=1 320CONFIG_ZONE_DMA_FLAG=1
293CONFIG_VIRT_TO_BUS=y 321CONFIG_VIRT_TO_BUS=y
294CONFIG_BFIN_GPTIMERS=y 322CONFIG_BFIN_GPTIMERS=y
@@ -334,7 +362,6 @@ CONFIG_BANK_3=0xFFC0
334# 362#
335# Bus options (PCI, PCMCIA, EISA, MCA, ISA) 363# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
336# 364#
337# CONFIG_PCI is not set
338# CONFIG_ARCH_SUPPORTS_MSI is not set 365# CONFIG_ARCH_SUPPORTS_MSI is not set
339# CONFIG_PCCARD is not set 366# CONFIG_PCCARD is not set
340 367
@@ -345,25 +372,20 @@ CONFIG_BINFMT_ELF_FDPIC=y
345CONFIG_BINFMT_FLAT=y 372CONFIG_BINFMT_FLAT=y
346CONFIG_BINFMT_ZFLAT=y 373CONFIG_BINFMT_ZFLAT=y
347# CONFIG_BINFMT_SHARED_FLAT is not set 374# CONFIG_BINFMT_SHARED_FLAT is not set
375# CONFIG_HAVE_AOUT is not set
348# CONFIG_BINFMT_MISC is not set 376# CONFIG_BINFMT_MISC is not set
349 377
350# 378#
351# Power management options 379# Power management options
352# 380#
353# CONFIG_PM is not set 381# CONFIG_PM is not set
354CONFIG_SUSPEND_UP_POSSIBLE=y 382CONFIG_ARCH_SUSPEND_POSSIBLE=y
355# CONFIG_PM_BFIN_SLEEP_DEEPER is not set
356# CONFIG_PM_BFIN_SLEEP is not set
357# CONFIG_PM_WAKEUP_BY_GPIO is not set 383# CONFIG_PM_WAKEUP_BY_GPIO is not set
358 384
359# 385#
360# CPU Frequency scaling 386# CPU Frequency scaling
361# 387#
362# CONFIG_CPU_FREQ is not set 388# CONFIG_CPU_FREQ is not set
363
364#
365# Networking
366#
367CONFIG_NET=y 389CONFIG_NET=y
368 390
369# 391#
@@ -376,6 +398,7 @@ CONFIG_XFRM=y
376# CONFIG_XFRM_USER is not set 398# CONFIG_XFRM_USER is not set
377# CONFIG_XFRM_SUB_POLICY is not set 399# CONFIG_XFRM_SUB_POLICY is not set
378# CONFIG_XFRM_MIGRATE is not set 400# CONFIG_XFRM_MIGRATE is not set
401# CONFIG_XFRM_STATISTICS is not set
379# CONFIG_NET_KEY is not set 402# CONFIG_NET_KEY is not set
380CONFIG_INET=y 403CONFIG_INET=y
381# CONFIG_IP_MULTICAST is not set 404# CONFIG_IP_MULTICAST is not set
@@ -405,8 +428,6 @@ CONFIG_TCP_CONG_CUBIC=y
405CONFIG_DEFAULT_TCP_CONG="cubic" 428CONFIG_DEFAULT_TCP_CONG="cubic"
406# CONFIG_TCP_MD5SIG is not set 429# CONFIG_TCP_MD5SIG is not set
407# CONFIG_IPV6 is not set 430# CONFIG_IPV6 is not set
408# CONFIG_INET6_XFRM_TUNNEL is not set
409# CONFIG_INET6_TUNNEL is not set
410# CONFIG_NETLABEL is not set 431# CONFIG_NETLABEL is not set
411# CONFIG_NETWORK_SECMARK is not set 432# CONFIG_NETWORK_SECMARK is not set
412# CONFIG_NETFILTER is not set 433# CONFIG_NETFILTER is not set
@@ -415,6 +436,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
415# CONFIG_TIPC is not set 436# CONFIG_TIPC is not set
416# CONFIG_ATM is not set 437# CONFIG_ATM is not set
417# CONFIG_BRIDGE is not set 438# CONFIG_BRIDGE is not set
439# CONFIG_NET_DSA is not set
418# CONFIG_VLAN_8021Q is not set 440# CONFIG_VLAN_8021Q is not set
419# CONFIG_DECNET is not set 441# CONFIG_DECNET is not set
420# CONFIG_LLC2 is not set 442# CONFIG_LLC2 is not set
@@ -431,14 +453,14 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
431# 453#
432# CONFIG_NET_PKTGEN is not set 454# CONFIG_NET_PKTGEN is not set
433# CONFIG_HAMRADIO is not set 455# CONFIG_HAMRADIO is not set
456# CONFIG_CAN is not set
434# CONFIG_IRDA is not set 457# CONFIG_IRDA is not set
435# CONFIG_BT is not set 458# CONFIG_BT is not set
436# CONFIG_AF_RXRPC is not set 459# CONFIG_AF_RXRPC is not set
437 460# CONFIG_PHONET is not set
438# 461CONFIG_WIRELESS=y
439# Wireless
440#
441# CONFIG_CFG80211 is not set 462# CONFIG_CFG80211 is not set
463CONFIG_WIRELESS_OLD_REGULATORY=y
442# CONFIG_WIRELESS_EXT is not set 464# CONFIG_WIRELESS_EXT is not set
443# CONFIG_MAC80211 is not set 465# CONFIG_MAC80211 is not set
444# CONFIG_IEEE80211 is not set 466# CONFIG_IEEE80211 is not set
@@ -456,6 +478,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
456CONFIG_STANDALONE=y 478CONFIG_STANDALONE=y
457CONFIG_PREVENT_FIRMWARE_BUILD=y 479CONFIG_PREVENT_FIRMWARE_BUILD=y
458# CONFIG_FW_LOADER is not set 480# CONFIG_FW_LOADER is not set
481# CONFIG_DEBUG_DRIVER is not set
482# CONFIG_DEBUG_DEVRES is not set
459# CONFIG_SYS_HYPERVISOR is not set 483# CONFIG_SYS_HYPERVISOR is not set
460# CONFIG_CONNECTOR is not set 484# CONFIG_CONNECTOR is not set
461CONFIG_MTD=y 485CONFIG_MTD=y
@@ -464,6 +488,7 @@ CONFIG_MTD=y
464CONFIG_MTD_PARTITIONS=y 488CONFIG_MTD_PARTITIONS=y
465# CONFIG_MTD_REDBOOT_PARTS is not set 489# CONFIG_MTD_REDBOOT_PARTS is not set
466# CONFIG_MTD_CMDLINE_PARTS is not set 490# CONFIG_MTD_CMDLINE_PARTS is not set
491# CONFIG_MTD_AR7_PARTS is not set
467 492
468# 493#
469# User Modules And Translation Layers 494# User Modules And Translation Layers
@@ -507,6 +532,7 @@ CONFIG_MTD_ROM=m
507# 532#
508CONFIG_MTD_COMPLEX_MAPPINGS=y 533CONFIG_MTD_COMPLEX_MAPPINGS=y
509# CONFIG_MTD_PHYSMAP is not set 534# CONFIG_MTD_PHYSMAP is not set
535# CONFIG_MTD_GPIO_ADDR is not set
510# CONFIG_MTD_UCLINUX is not set 536# CONFIG_MTD_UCLINUX is not set
511# CONFIG_MTD_PLATRAM is not set 537# CONFIG_MTD_PLATRAM is not set
512 538
@@ -542,10 +568,12 @@ CONFIG_BLK_DEV=y
542CONFIG_BLK_DEV_RAM=y 568CONFIG_BLK_DEV_RAM=y
543CONFIG_BLK_DEV_RAM_COUNT=16 569CONFIG_BLK_DEV_RAM_COUNT=16
544CONFIG_BLK_DEV_RAM_SIZE=4096 570CONFIG_BLK_DEV_RAM_SIZE=4096
545CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 571# CONFIG_BLK_DEV_XIP is not set
546# CONFIG_CDROM_PKTCDVD is not set 572# CONFIG_CDROM_PKTCDVD is not set
547# CONFIG_ATA_OVER_ETH is not set 573# CONFIG_ATA_OVER_ETH is not set
574# CONFIG_BLK_DEV_HD is not set
548# CONFIG_MISC_DEVICES is not set 575# CONFIG_MISC_DEVICES is not set
576CONFIG_HAVE_IDE=y
549# CONFIG_IDE is not set 577# CONFIG_IDE is not set
550 578
551# 579#
@@ -558,7 +586,6 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
558# CONFIG_ATA is not set 586# CONFIG_ATA is not set
559# CONFIG_MD is not set 587# CONFIG_MD is not set
560CONFIG_NETDEVICES=y 588CONFIG_NETDEVICES=y
561# CONFIG_NETDEVICES_MULTIQUEUE is not set
562# CONFIG_DUMMY is not set 589# CONFIG_DUMMY is not set
563# CONFIG_BONDING is not set 590# CONFIG_BONDING is not set
564# CONFIG_MACVLAN is not set 591# CONFIG_MACVLAN is not set
@@ -579,6 +606,7 @@ CONFIG_PHYLIB=y
579# CONFIG_SMSC_PHY is not set 606# CONFIG_SMSC_PHY is not set
580# CONFIG_BROADCOM_PHY is not set 607# CONFIG_BROADCOM_PHY is not set
581# CONFIG_ICPLUS_PHY is not set 608# CONFIG_ICPLUS_PHY is not set
609# CONFIG_REALTEK_PHY is not set
582# CONFIG_FIXED_PHY is not set 610# CONFIG_FIXED_PHY is not set
583# CONFIG_MDIO_BITBANG is not set 611# CONFIG_MDIO_BITBANG is not set
584CONFIG_NET_ETHERNET=y 612CONFIG_NET_ETHERNET=y
@@ -591,11 +619,14 @@ CONFIG_BFIN_MAC_RMII=y
591# CONFIG_SMC91X is not set 619# CONFIG_SMC91X is not set
592# CONFIG_SMSC911X is not set 620# CONFIG_SMSC911X is not set
593# CONFIG_DM9000 is not set 621# CONFIG_DM9000 is not set
622# CONFIG_ENC28J60 is not set
594# CONFIG_IBM_NEW_EMAC_ZMII is not set 623# CONFIG_IBM_NEW_EMAC_ZMII is not set
595# CONFIG_IBM_NEW_EMAC_RGMII is not set 624# CONFIG_IBM_NEW_EMAC_RGMII is not set
596# CONFIG_IBM_NEW_EMAC_TAH is not set 625# CONFIG_IBM_NEW_EMAC_TAH is not set
597# CONFIG_IBM_NEW_EMAC_EMAC4 is not set 626# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
598# CONFIG_B44 is not set 627# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
628# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
629# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
599# CONFIG_NETDEV_1000 is not set 630# CONFIG_NETDEV_1000 is not set
600# CONFIG_NETDEV_10000 is not set 631# CONFIG_NETDEV_10000 is not set
601 632
@@ -604,6 +635,7 @@ CONFIG_BFIN_MAC_RMII=y
604# 635#
605# CONFIG_WLAN_PRE80211 is not set 636# CONFIG_WLAN_PRE80211 is not set
606# CONFIG_WLAN_80211 is not set 637# CONFIG_WLAN_80211 is not set
638# CONFIG_IWLWIFI_LEDS is not set
607 639
608# 640#
609# USB Network Adapters 641# USB Network Adapters
@@ -616,7 +648,6 @@ CONFIG_BFIN_MAC_RMII=y
616# CONFIG_WAN is not set 648# CONFIG_WAN is not set
617# CONFIG_PPP is not set 649# CONFIG_PPP is not set
618# CONFIG_SLIP is not set 650# CONFIG_SLIP is not set
619# CONFIG_SHAPER is not set
620# CONFIG_NETCONSOLE is not set 651# CONFIG_NETCONSOLE is not set
621# CONFIG_NETPOLL is not set 652# CONFIG_NETPOLL is not set
622# CONFIG_NET_POLL_CONTROLLER is not set 653# CONFIG_NET_POLL_CONTROLLER is not set
@@ -642,14 +673,15 @@ CONFIG_BFIN_MAC_RMII=y
642# CONFIG_BF5xx_PPIFCD is not set 673# CONFIG_BF5xx_PPIFCD is not set
643# CONFIG_BFIN_SIMPLE_TIMER is not set 674# CONFIG_BFIN_SIMPLE_TIMER is not set
644# CONFIG_BF5xx_PPI is not set 675# CONFIG_BF5xx_PPI is not set
645CONFIG_BFIN_OTP=y 676# CONFIG_BF5xx_EPPI is not set
646# CONFIG_BFIN_OTP_WRITE_ENABLE is not set
647# CONFIG_BFIN_SPORT is not set 677# CONFIG_BFIN_SPORT is not set
648# CONFIG_BFIN_TIMER_LATENCY is not set 678# CONFIG_BFIN_TIMER_LATENCY is not set
649# CONFIG_TWI_LCD is not set 679# CONFIG_TWI_LCD is not set
680CONFIG_BFIN_DMA_INTERFACE=m
650CONFIG_SIMPLE_GPIO=m 681CONFIG_SIMPLE_GPIO=m
651# CONFIG_VT is not set 682# CONFIG_VT is not set
652# CONFIG_DEVKMEM is not set 683# CONFIG_DEVKMEM is not set
684# CONFIG_BFIN_JTAG_COMM is not set
653# CONFIG_SERIAL_NONSTANDARD is not set 685# CONFIG_SERIAL_NONSTANDARD is not set
654 686
655# 687#
@@ -673,6 +705,8 @@ CONFIG_SERIAL_CORE_CONSOLE=y
673# CONFIG_SERIAL_BFIN_SPORT is not set 705# CONFIG_SERIAL_BFIN_SPORT is not set
674CONFIG_UNIX98_PTYS=y 706CONFIG_UNIX98_PTYS=y
675# CONFIG_LEGACY_PTYS is not set 707# CONFIG_LEGACY_PTYS is not set
708CONFIG_BFIN_OTP=y
709# CONFIG_BFIN_OTP_WRITE_ENABLE is not set
676 710
677# 711#
678# CAN, the car bus and industrial fieldbus 712# CAN, the car bus and industrial fieldbus
@@ -680,44 +714,49 @@ CONFIG_UNIX98_PTYS=y
680# CONFIG_CAN4LINUX is not set 714# CONFIG_CAN4LINUX is not set
681# CONFIG_IPMI_HANDLER is not set 715# CONFIG_IPMI_HANDLER is not set
682# CONFIG_HW_RANDOM is not set 716# CONFIG_HW_RANDOM is not set
683# CONFIG_GEN_RTC is not set
684# CONFIG_R3964 is not set 717# CONFIG_R3964 is not set
685# CONFIG_RAW_DRIVER is not set 718# CONFIG_RAW_DRIVER is not set
686# CONFIG_TCG_TPM is not set 719# CONFIG_TCG_TPM is not set
687CONFIG_I2C=y 720CONFIG_I2C=y
688CONFIG_I2C_BOARDINFO=y 721CONFIG_I2C_BOARDINFO=y
689CONFIG_I2C_CHARDEV=m 722CONFIG_I2C_CHARDEV=m
723CONFIG_I2C_HELPER_AUTO=y
690 724
691# 725#
692# I2C Algorithms 726# I2C Hardware Bus support
693# 727#
694# CONFIG_I2C_ALGOBIT is not set
695# CONFIG_I2C_ALGOPCF is not set
696# CONFIG_I2C_ALGOPCA is not set
697 728
698# 729#
699# I2C Hardware Bus support 730# I2C system bus drivers (mostly embedded / system-on-chip)
700# 731#
701CONFIG_I2C_BLACKFIN_TWI=m 732CONFIG_I2C_BLACKFIN_TWI=m
702CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=100 733CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=100
703# CONFIG_I2C_GPIO is not set 734# CONFIG_I2C_GPIO is not set
704# CONFIG_I2C_OCORES is not set 735# CONFIG_I2C_OCORES is not set
705# CONFIG_I2C_PARPORT_LIGHT is not set
706# CONFIG_I2C_SIMTEC is not set 736# CONFIG_I2C_SIMTEC is not set
737
738#
739# External I2C/SMBus adapter drivers
740#
741# CONFIG_I2C_PARPORT_LIGHT is not set
707# CONFIG_I2C_TAOS_EVM is not set 742# CONFIG_I2C_TAOS_EVM is not set
708# CONFIG_I2C_STUB is not set
709# CONFIG_I2C_TINY_USB is not set 743# CONFIG_I2C_TINY_USB is not set
710 744
711# 745#
746# Other I2C/SMBus bus drivers
747#
748# CONFIG_I2C_PCA_PLATFORM is not set
749# CONFIG_I2C_STUB is not set
750
751#
712# Miscellaneous I2C Chip support 752# Miscellaneous I2C Chip support
713# 753#
714# CONFIG_SENSORS_DS1337 is not set
715# CONFIG_SENSORS_DS1374 is not set
716# CONFIG_DS1682 is not set 754# CONFIG_DS1682 is not set
755# CONFIG_AT24 is not set
717# CONFIG_SENSORS_AD5252 is not set 756# CONFIG_SENSORS_AD5252 is not set
718# CONFIG_EEPROM_LEGACY is not set 757# CONFIG_SENSORS_EEPROM is not set
719# CONFIG_SENSORS_PCF8574 is not set 758# CONFIG_SENSORS_PCF8574 is not set
720# CONFIG_SENSORS_PCF8575 is not set 759# CONFIG_PCF8575 is not set
721# CONFIG_SENSORS_PCA9539 is not set 760# CONFIG_SENSORS_PCA9539 is not set
722# CONFIG_SENSORS_PCF8591 is not set 761# CONFIG_SENSORS_PCF8591 is not set
723# CONFIG_SENSORS_MAX6875 is not set 762# CONFIG_SENSORS_MAX6875 is not set
@@ -726,37 +765,41 @@ CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=100
726# CONFIG_I2C_DEBUG_ALGO is not set 765# CONFIG_I2C_DEBUG_ALGO is not set
727# CONFIG_I2C_DEBUG_BUS is not set 766# CONFIG_I2C_DEBUG_BUS is not set
728# CONFIG_I2C_DEBUG_CHIP is not set 767# CONFIG_I2C_DEBUG_CHIP is not set
729
730#
731# SPI support
732#
733CONFIG_SPI=y 768CONFIG_SPI=y
769# CONFIG_SPI_DEBUG is not set
734CONFIG_SPI_MASTER=y 770CONFIG_SPI_MASTER=y
735 771
736# 772#
737# SPI Master Controller Drivers 773# SPI Master Controller Drivers
738# 774#
739CONFIG_SPI_BFIN=y 775CONFIG_SPI_BFIN=y
776# CONFIG_SPI_BFIN_LOCK is not set
740# CONFIG_SPI_BITBANG is not set 777# CONFIG_SPI_BITBANG is not set
741 778
742# 779#
743# SPI Protocol Masters 780# SPI Protocol Masters
744# 781#
745# CONFIG_EEPROM_AT25 is not set 782# CONFIG_SPI_AT25 is not set
746# CONFIG_SPI_SPIDEV is not set 783# CONFIG_SPI_SPIDEV is not set
747# CONFIG_SPI_TLE62X0 is not set 784# CONFIG_SPI_TLE62X0 is not set
785CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
786# CONFIG_GPIOLIB is not set
748# CONFIG_W1 is not set 787# CONFIG_W1 is not set
749# CONFIG_POWER_SUPPLY is not set 788# CONFIG_POWER_SUPPLY is not set
750CONFIG_HWMON=y 789CONFIG_HWMON=y
751# CONFIG_HWMON_VID is not set 790# CONFIG_HWMON_VID is not set
791# CONFIG_SENSORS_AD7414 is not set
752# CONFIG_SENSORS_AD7418 is not set 792# CONFIG_SENSORS_AD7418 is not set
793# CONFIG_SENSORS_ADCXX is not set
753# CONFIG_SENSORS_ADM1021 is not set 794# CONFIG_SENSORS_ADM1021 is not set
754# CONFIG_SENSORS_ADM1025 is not set 795# CONFIG_SENSORS_ADM1025 is not set
755# CONFIG_SENSORS_ADM1026 is not set 796# CONFIG_SENSORS_ADM1026 is not set
756# CONFIG_SENSORS_ADM1029 is not set 797# CONFIG_SENSORS_ADM1029 is not set
757# CONFIG_SENSORS_ADM1031 is not set 798# CONFIG_SENSORS_ADM1031 is not set
758# CONFIG_SENSORS_ADM9240 is not set 799# CONFIG_SENSORS_ADM9240 is not set
800# CONFIG_SENSORS_ADT7462 is not set
759# CONFIG_SENSORS_ADT7470 is not set 801# CONFIG_SENSORS_ADT7470 is not set
802# CONFIG_SENSORS_ADT7473 is not set
760# CONFIG_SENSORS_ATXP1 is not set 803# CONFIG_SENSORS_ATXP1 is not set
761# CONFIG_SENSORS_DS1621 is not set 804# CONFIG_SENSORS_DS1621 is not set
762# CONFIG_SENSORS_F71805F is not set 805# CONFIG_SENSORS_F71805F is not set
@@ -777,6 +820,7 @@ CONFIG_HWMON=y
777# CONFIG_SENSORS_LM90 is not set 820# CONFIG_SENSORS_LM90 is not set
778# CONFIG_SENSORS_LM92 is not set 821# CONFIG_SENSORS_LM92 is not set
779# CONFIG_SENSORS_LM93 is not set 822# CONFIG_SENSORS_LM93 is not set
823# CONFIG_SENSORS_MAX1111 is not set
780# CONFIG_SENSORS_MAX1619 is not set 824# CONFIG_SENSORS_MAX1619 is not set
781# CONFIG_SENSORS_MAX6650 is not set 825# CONFIG_SENSORS_MAX6650 is not set
782# CONFIG_SENSORS_PC87360 is not set 826# CONFIG_SENSORS_PC87360 is not set
@@ -785,6 +829,7 @@ CONFIG_HWMON=y
785# CONFIG_SENSORS_SMSC47M1 is not set 829# CONFIG_SENSORS_SMSC47M1 is not set
786# CONFIG_SENSORS_SMSC47M192 is not set 830# CONFIG_SENSORS_SMSC47M192 is not set
787# CONFIG_SENSORS_SMSC47B397 is not set 831# CONFIG_SENSORS_SMSC47B397 is not set
832# CONFIG_SENSORS_ADS7828 is not set
788# CONFIG_SENSORS_THMC50 is not set 833# CONFIG_SENSORS_THMC50 is not set
789# CONFIG_SENSORS_VT1211 is not set 834# CONFIG_SENSORS_VT1211 is not set
790# CONFIG_SENSORS_W83781D is not set 835# CONFIG_SENSORS_W83781D is not set
@@ -792,9 +837,12 @@ CONFIG_HWMON=y
792# CONFIG_SENSORS_W83792D is not set 837# CONFIG_SENSORS_W83792D is not set
793# CONFIG_SENSORS_W83793 is not set 838# CONFIG_SENSORS_W83793 is not set
794# CONFIG_SENSORS_W83L785TS is not set 839# CONFIG_SENSORS_W83L785TS is not set
840# CONFIG_SENSORS_W83L786NG is not set
795# CONFIG_SENSORS_W83627HF is not set 841# CONFIG_SENSORS_W83627HF is not set
796# CONFIG_SENSORS_W83627EHF is not set 842# CONFIG_SENSORS_W83627EHF is not set
797# CONFIG_HWMON_DEBUG_CHIP is not set 843# CONFIG_HWMON_DEBUG_CHIP is not set
844# CONFIG_THERMAL is not set
845# CONFIG_THERMAL_HWMON is not set
798CONFIG_WATCHDOG=y 846CONFIG_WATCHDOG=y
799# CONFIG_WATCHDOG_NOWAYOUT is not set 847# CONFIG_WATCHDOG_NOWAYOUT is not set
800 848
@@ -810,21 +858,31 @@ CONFIG_BFIN_WDT=y
810# CONFIG_USBPCWATCHDOG is not set 858# CONFIG_USBPCWATCHDOG is not set
811 859
812# 860#
813# Sonics Silicon Backplane
814#
815CONFIG_SSB_POSSIBLE=y
816# CONFIG_SSB is not set
817
818#
819# Multifunction device drivers 861# Multifunction device drivers
820# 862#
863# CONFIG_MFD_CORE is not set
821# CONFIG_MFD_SM501 is not set 864# CONFIG_MFD_SM501 is not set
865# CONFIG_HTC_PASIC3 is not set
866# CONFIG_MFD_TMIO is not set
867# CONFIG_PMIC_DA903X is not set
868# CONFIG_MFD_WM8400 is not set
869# CONFIG_MFD_WM8350_I2C is not set
870# CONFIG_REGULATOR is not set
822 871
823# 872#
824# Multimedia devices 873# Multimedia devices
825# 874#
875
876#
877# Multimedia core support
878#
826# CONFIG_VIDEO_DEV is not set 879# CONFIG_VIDEO_DEV is not set
827# CONFIG_DVB_CORE is not set 880# CONFIG_DVB_CORE is not set
881# CONFIG_VIDEO_MEDIA is not set
882
883#
884# Multimedia drivers
885#
828# CONFIG_DAB is not set 886# CONFIG_DAB is not set
829 887
830# 888#
@@ -839,10 +897,6 @@ CONFIG_SSB_POSSIBLE=y
839# Display device support 897# Display device support
840# 898#
841# CONFIG_DISPLAY_SUPPORT is not set 899# CONFIG_DISPLAY_SUPPORT is not set
842
843#
844# Sound
845#
846# CONFIG_SOUND is not set 900# CONFIG_SOUND is not set
847CONFIG_USB_SUPPORT=y 901CONFIG_USB_SUPPORT=y
848CONFIG_USB_ARCH_HAS_HCD=y 902CONFIG_USB_ARCH_HAS_HCD=y
@@ -850,6 +904,7 @@ CONFIG_USB_ARCH_HAS_HCD=y
850# CONFIG_USB_ARCH_HAS_EHCI is not set 904# CONFIG_USB_ARCH_HAS_EHCI is not set
851CONFIG_USB=y 905CONFIG_USB=y
852# CONFIG_USB_DEBUG is not set 906# CONFIG_USB_DEBUG is not set
907# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
853 908
854# 909#
855# Miscellaneous USB options 910# Miscellaneous USB options
@@ -860,40 +915,48 @@ CONFIG_USB_DEVICE_CLASS=y
860# CONFIG_USB_OTG is not set 915# CONFIG_USB_OTG is not set
861# CONFIG_USB_OTG_WHITELIST is not set 916# CONFIG_USB_OTG_WHITELIST is not set
862CONFIG_USB_OTG_BLACKLIST_HUB=y 917CONFIG_USB_OTG_BLACKLIST_HUB=y
918CONFIG_USB_MON=y
919# CONFIG_USB_WUSB is not set
920# CONFIG_USB_WUSB_CBAF is not set
863 921
864# 922#
865# USB Host Controller Drivers 923# USB Host Controller Drivers
866# 924#
925# CONFIG_USB_C67X00_HCD is not set
867# CONFIG_USB_ISP116X_HCD is not set 926# CONFIG_USB_ISP116X_HCD is not set
868# CONFIG_USB_ISP1362_HCD is not set
869# CONFIG_USB_ISP1760_HCD is not set 927# CONFIG_USB_ISP1760_HCD is not set
928# CONFIG_USB_ISP1362_HCD is not set
870# CONFIG_USB_SL811_HCD is not set 929# CONFIG_USB_SL811_HCD is not set
871# CONFIG_USB_R8A66597_HCD is not set 930# CONFIG_USB_R8A66597_HCD is not set
931# CONFIG_USB_HWA_HCD is not set
872CONFIG_USB_MUSB_HDRC=y 932CONFIG_USB_MUSB_HDRC=y
873CONFIG_USB_MUSB_SOC=y 933CONFIG_USB_MUSB_SOC=y
874 934
875# 935#
876# Blackfin high speed USB support 936# Blackfin high speed USB Support
877# 937#
878CONFIG_USB_MUSB_HOST=y 938CONFIG_USB_MUSB_HOST=y
879# CONFIG_USB_MUSB_PERIPHERAL is not set 939# CONFIG_USB_MUSB_PERIPHERAL is not set
880# CONFIG_USB_MUSB_OTG is not set 940# CONFIG_USB_MUSB_OTG is not set
881CONFIG_USB_MUSB_HDRC_HCD=y 941CONFIG_USB_MUSB_HDRC_HCD=y
882CONFIG_MUSB_PIO_ONLY=y 942CONFIG_MUSB_PIO_ONLY=y
883CONFIG_USB_MUSB_LOGLEVEL=0 943CONFIG_MUSB_DMA_POLL=y
944# CONFIG_USB_MUSB_DEBUG is not set
884 945
885# 946#
886# USB Device Class drivers 947# USB Device Class drivers
887# 948#
888# CONFIG_USB_ACM is not set 949# CONFIG_USB_ACM is not set
889# CONFIG_USB_PRINTER is not set 950# CONFIG_USB_PRINTER is not set
951# CONFIG_USB_WDM is not set
952# CONFIG_USB_TMC is not set
890 953
891# 954#
892# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 955# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
893# 956#
894 957
895# 958#
896# may also be needed; see USB_STORAGE Help for more information 959# see USB_STORAGE Help for more information
897# 960#
898# CONFIG_USB_LIBUSUAL is not set 961# CONFIG_USB_LIBUSUAL is not set
899 962
@@ -901,15 +964,10 @@ CONFIG_USB_MUSB_LOGLEVEL=0
901# USB Imaging devices 964# USB Imaging devices
902# 965#
903# CONFIG_USB_MDC800 is not set 966# CONFIG_USB_MDC800 is not set
904CONFIG_USB_MON=y
905 967
906# 968#
907# USB port drivers 969# USB port drivers
908# 970#
909
910#
911# USB Serial Converter support
912#
913# CONFIG_USB_SERIAL is not set 971# CONFIG_USB_SERIAL is not set
914 972
915# 973#
@@ -918,7 +976,7 @@ CONFIG_USB_MON=y
918# CONFIG_USB_EMI62 is not set 976# CONFIG_USB_EMI62 is not set
919# CONFIG_USB_EMI26 is not set 977# CONFIG_USB_EMI26 is not set
920# CONFIG_USB_ADUTUX is not set 978# CONFIG_USB_ADUTUX is not set
921# CONFIG_USB_AUERSWALD is not set 979# CONFIG_USB_SEVSEG is not set
922# CONFIG_USB_RIO500 is not set 980# CONFIG_USB_RIO500 is not set
923# CONFIG_USB_LEGOTOWER is not set 981# CONFIG_USB_LEGOTOWER is not set
924# CONFIG_USB_LCD is not set 982# CONFIG_USB_LCD is not set
@@ -934,17 +992,13 @@ CONFIG_USB_MON=y
934# CONFIG_USB_LD is not set 992# CONFIG_USB_LD is not set
935# CONFIG_USB_TRANCEVIBRATOR is not set 993# CONFIG_USB_TRANCEVIBRATOR is not set
936# CONFIG_USB_IOWARRIOR is not set 994# CONFIG_USB_IOWARRIOR is not set
937 995# CONFIG_USB_ISIGHTFW is not set
938# 996# CONFIG_USB_VST is not set
939# USB DSL modem support
940#
941
942#
943# USB Gadget Support
944#
945# CONFIG_USB_GADGET is not set 997# CONFIG_USB_GADGET is not set
946# CONFIG_MMC is not set 998# CONFIG_MMC is not set
999# CONFIG_MEMSTICK is not set
947# CONFIG_NEW_LEDS is not set 1000# CONFIG_NEW_LEDS is not set
1001# CONFIG_ACCESSIBILITY is not set
948CONFIG_RTC_LIB=y 1002CONFIG_RTC_LIB=y
949CONFIG_RTC_CLASS=y 1003CONFIG_RTC_CLASS=y
950CONFIG_RTC_HCTOSYS=y 1004CONFIG_RTC_HCTOSYS=y
@@ -973,51 +1027,59 @@ CONFIG_RTC_INTF_DEV=y
973# CONFIG_RTC_DRV_PCF8563 is not set 1027# CONFIG_RTC_DRV_PCF8563 is not set
974# CONFIG_RTC_DRV_PCF8583 is not set 1028# CONFIG_RTC_DRV_PCF8583 is not set
975# CONFIG_RTC_DRV_M41T80 is not set 1029# CONFIG_RTC_DRV_M41T80 is not set
1030# CONFIG_RTC_DRV_S35390A is not set
1031# CONFIG_RTC_DRV_FM3130 is not set
1032# CONFIG_RTC_DRV_RX8581 is not set
976 1033
977# 1034#
978# SPI RTC drivers 1035# SPI RTC drivers
979# 1036#
980# CONFIG_RTC_DRV_RS5C348 is not set 1037# CONFIG_RTC_DRV_M41T94 is not set
1038# CONFIG_RTC_DRV_DS1305 is not set
1039# CONFIG_RTC_DRV_DS1390 is not set
981# CONFIG_RTC_DRV_MAX6902 is not set 1040# CONFIG_RTC_DRV_MAX6902 is not set
1041# CONFIG_RTC_DRV_R9701 is not set
1042# CONFIG_RTC_DRV_RS5C348 is not set
1043# CONFIG_RTC_DRV_DS3234 is not set
982 1044
983# 1045#
984# Platform RTC drivers 1046# Platform RTC drivers
985# 1047#
1048# CONFIG_RTC_DRV_DS1286 is not set
1049# CONFIG_RTC_DRV_DS1511 is not set
986# CONFIG_RTC_DRV_DS1553 is not set 1050# CONFIG_RTC_DRV_DS1553 is not set
987# CONFIG_RTC_DRV_STK17TA8 is not set
988# CONFIG_RTC_DRV_DS1742 is not set 1051# CONFIG_RTC_DRV_DS1742 is not set
1052# CONFIG_RTC_DRV_STK17TA8 is not set
989# CONFIG_RTC_DRV_M48T86 is not set 1053# CONFIG_RTC_DRV_M48T86 is not set
1054# CONFIG_RTC_DRV_M48T35 is not set
990# CONFIG_RTC_DRV_M48T59 is not set 1055# CONFIG_RTC_DRV_M48T59 is not set
1056# CONFIG_RTC_DRV_BQ4802 is not set
991# CONFIG_RTC_DRV_V3020 is not set 1057# CONFIG_RTC_DRV_V3020 is not set
992 1058
993# 1059#
994# on-CPU RTC drivers 1060# on-CPU RTC drivers
995# 1061#
996CONFIG_RTC_DRV_BFIN=y 1062CONFIG_RTC_DRV_BFIN=y
997 1063# CONFIG_DMADEVICES is not set
998#
999# Userspace I/O
1000#
1001# CONFIG_UIO is not set 1064# CONFIG_UIO is not set
1065# CONFIG_STAGING is not set
1002 1066
1003# 1067#
1004# File systems 1068# File systems
1005# 1069#
1006# CONFIG_EXT2_FS is not set 1070# CONFIG_EXT2_FS is not set
1007# CONFIG_EXT3_FS is not set 1071# CONFIG_EXT3_FS is not set
1008# CONFIG_EXT4DEV_FS is not set 1072# CONFIG_EXT4_FS is not set
1009# CONFIG_REISERFS_FS is not set 1073# CONFIG_REISERFS_FS is not set
1010# CONFIG_JFS_FS is not set 1074# CONFIG_JFS_FS is not set
1011# CONFIG_FS_POSIX_ACL is not set 1075# CONFIG_FS_POSIX_ACL is not set
1076CONFIG_FILE_LOCKING=y
1012# CONFIG_XFS_FS is not set 1077# CONFIG_XFS_FS is not set
1013# CONFIG_GFS2_FS is not set
1014# CONFIG_OCFS2_FS is not set 1078# CONFIG_OCFS2_FS is not set
1015# CONFIG_MINIX_FS is not set 1079# CONFIG_DNOTIFY is not set
1016# CONFIG_ROMFS_FS is not set
1017CONFIG_INOTIFY=y 1080CONFIG_INOTIFY=y
1018CONFIG_INOTIFY_USER=y 1081CONFIG_INOTIFY_USER=y
1019# CONFIG_QUOTA is not set 1082# CONFIG_QUOTA is not set
1020# CONFIG_DNOTIFY is not set
1021# CONFIG_AUTOFS_FS is not set 1083# CONFIG_AUTOFS_FS is not set
1022# CONFIG_AUTOFS4_FS is not set 1084# CONFIG_AUTOFS4_FS is not set
1023# CONFIG_FUSE_FS is not set 1085# CONFIG_FUSE_FS is not set
@@ -1059,8 +1121,11 @@ CONFIG_SYSFS=y
1059# CONFIG_JFFS2_FS is not set 1121# CONFIG_JFFS2_FS is not set
1060# CONFIG_CRAMFS is not set 1122# CONFIG_CRAMFS is not set
1061# CONFIG_VXFS_FS is not set 1123# CONFIG_VXFS_FS is not set
1124# CONFIG_MINIX_FS is not set
1125# CONFIG_OMFS_FS is not set
1062# CONFIG_HPFS_FS is not set 1126# CONFIG_HPFS_FS is not set
1063# CONFIG_QNX4FS_FS is not set 1127# CONFIG_QNX4FS_FS is not set
1128# CONFIG_ROMFS_FS is not set
1064# CONFIG_SYSV_FS is not set 1129# CONFIG_SYSV_FS is not set
1065# CONFIG_UFS_FS is not set 1130# CONFIG_UFS_FS is not set
1066CONFIG_NETWORK_FILESYSTEMS=y 1131CONFIG_NETWORK_FILESYSTEMS=y
@@ -1068,13 +1133,12 @@ CONFIG_NFS_FS=m
1068CONFIG_NFS_V3=y 1133CONFIG_NFS_V3=y
1069# CONFIG_NFS_V3_ACL is not set 1134# CONFIG_NFS_V3_ACL is not set
1070# CONFIG_NFS_V4 is not set 1135# CONFIG_NFS_V4 is not set
1071# CONFIG_NFS_DIRECTIO is not set
1072# CONFIG_NFSD is not set 1136# CONFIG_NFSD is not set
1073CONFIG_LOCKD=m 1137CONFIG_LOCKD=m
1074CONFIG_LOCKD_V4=y 1138CONFIG_LOCKD_V4=y
1075CONFIG_NFS_COMMON=y 1139CONFIG_NFS_COMMON=y
1076CONFIG_SUNRPC=m 1140CONFIG_SUNRPC=m
1077# CONFIG_SUNRPC_BIND34 is not set 1141# CONFIG_SUNRPC_REGISTER_V4 is not set
1078# CONFIG_RPCSEC_GSS_KRB5 is not set 1142# CONFIG_RPCSEC_GSS_KRB5 is not set
1079# CONFIG_RPCSEC_GSS_SPKM3 is not set 1143# CONFIG_RPCSEC_GSS_SPKM3 is not set
1080CONFIG_SMB_FS=m 1144CONFIG_SMB_FS=m
@@ -1130,7 +1194,6 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1130# CONFIG_NLS_KOI8_U is not set 1194# CONFIG_NLS_KOI8_U is not set
1131# CONFIG_NLS_UTF8 is not set 1195# CONFIG_NLS_UTF8 is not set
1132# CONFIG_DLM is not set 1196# CONFIG_DLM is not set
1133# CONFIG_INSTRUMENTATION is not set
1134 1197
1135# 1198#
1136# Kernel hacking 1199# Kernel hacking
@@ -1138,14 +1201,61 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1138# CONFIG_PRINTK_TIME is not set 1201# CONFIG_PRINTK_TIME is not set
1139CONFIG_ENABLE_WARN_DEPRECATED=y 1202CONFIG_ENABLE_WARN_DEPRECATED=y
1140CONFIG_ENABLE_MUST_CHECK=y 1203CONFIG_ENABLE_MUST_CHECK=y
1204CONFIG_FRAME_WARN=1024
1141# CONFIG_MAGIC_SYSRQ is not set 1205# CONFIG_MAGIC_SYSRQ is not set
1142# CONFIG_UNUSED_SYMBOLS is not set 1206# CONFIG_UNUSED_SYMBOLS is not set
1143CONFIG_DEBUG_FS=y 1207CONFIG_DEBUG_FS=y
1144# CONFIG_HEADERS_CHECK is not set 1208# CONFIG_HEADERS_CHECK is not set
1145# CONFIG_DEBUG_KERNEL is not set 1209CONFIG_DEBUG_KERNEL=y
1210# CONFIG_DEBUG_SHIRQ is not set
1211CONFIG_DETECT_SOFTLOCKUP=y
1212# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1213CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1214# CONFIG_SCHED_DEBUG is not set
1215# CONFIG_SCHEDSTATS is not set
1216# CONFIG_TIMER_STATS is not set
1217# CONFIG_DEBUG_OBJECTS is not set
1218# CONFIG_DEBUG_SLAB is not set
1219# CONFIG_DEBUG_RT_MUTEXES is not set
1220# CONFIG_RT_MUTEX_TESTER is not set
1221# CONFIG_DEBUG_SPINLOCK is not set
1222# CONFIG_DEBUG_MUTEXES is not set
1223# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1224# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1225# CONFIG_DEBUG_KOBJECT is not set
1146# CONFIG_DEBUG_BUGVERBOSE is not set 1226# CONFIG_DEBUG_BUGVERBOSE is not set
1227# CONFIG_DEBUG_INFO is not set
1228# CONFIG_DEBUG_VM is not set
1229# CONFIG_DEBUG_WRITECOUNT is not set
1230# CONFIG_DEBUG_MEMORY_INIT is not set
1231# CONFIG_DEBUG_LIST is not set
1232# CONFIG_DEBUG_SG is not set
1233# CONFIG_FRAME_POINTER is not set
1234# CONFIG_BOOT_PRINTK_DELAY is not set
1235# CONFIG_RCU_TORTURE_TEST is not set
1236# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1237# CONFIG_BACKTRACE_SELF_TEST is not set
1238# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1239# CONFIG_FAULT_INJECTION is not set
1240# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1241
1242#
1243# Tracers
1244#
1245# CONFIG_SCHED_TRACER is not set
1246# CONFIG_CONTEXT_SWITCH_TRACER is not set
1247# CONFIG_BOOT_TRACER is not set
1248# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
1147# CONFIG_SAMPLES is not set 1249# CONFIG_SAMPLES is not set
1250CONFIG_HAVE_ARCH_KGDB=y
1251# CONFIG_KGDB is not set
1252# CONFIG_DEBUG_STACKOVERFLOW is not set
1253# CONFIG_DEBUG_STACK_USAGE is not set
1254# CONFIG_KGDB_TESTCASE is not set
1255CONFIG_DEBUG_VERBOSE=y
1148CONFIG_DEBUG_MMRS=y 1256CONFIG_DEBUG_MMRS=y
1257# CONFIG_DEBUG_HWERR is not set
1258# CONFIG_DEBUG_DOUBLEFAULT is not set
1149CONFIG_DEBUG_HUNT_FOR_ZERO=y 1259CONFIG_DEBUG_HUNT_FOR_ZERO=y
1150CONFIG_DEBUG_BFIN_HWTRACE_ON=y 1260CONFIG_DEBUG_BFIN_HWTRACE_ON=y
1151CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y 1261CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y
@@ -1154,7 +1264,7 @@ CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y
1154CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION=0 1264CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION=0
1155# CONFIG_DEBUG_BFIN_HWTRACE_EXPAND is not set 1265# CONFIG_DEBUG_BFIN_HWTRACE_EXPAND is not set
1156# CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE is not set 1266# CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE is not set
1157CONFIG_EARLY_PRINTK=y 1267# CONFIG_EARLY_PRINTK is not set
1158# CONFIG_CPLB_INFO is not set 1268# CONFIG_CPLB_INFO is not set
1159CONFIG_ACCESS_CHECK=y 1269CONFIG_ACCESS_CHECK=y
1160 1270
@@ -1163,10 +1273,96 @@ CONFIG_ACCESS_CHECK=y
1163# 1273#
1164# CONFIG_KEYS is not set 1274# CONFIG_KEYS is not set
1165CONFIG_SECURITY=y 1275CONFIG_SECURITY=y
1276# CONFIG_SECURITYFS is not set
1166# CONFIG_SECURITY_NETWORK is not set 1277# CONFIG_SECURITY_NETWORK is not set
1167# CONFIG_SECURITY_CAPABILITIES is not set 1278# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1168# CONFIG_SECURITY_ROOTPLUG is not set 1279# CONFIG_SECURITY_ROOTPLUG is not set
1169# CONFIG_CRYPTO is not set 1280CONFIG_SECURITY_DEFAULT_MMAP_MIN_ADDR=0
1281CONFIG_CRYPTO=y
1282
1283#
1284# Crypto core or helper
1285#
1286# CONFIG_CRYPTO_FIPS is not set
1287# CONFIG_CRYPTO_MANAGER is not set
1288# CONFIG_CRYPTO_MANAGER2 is not set
1289# CONFIG_CRYPTO_GF128MUL is not set
1290# CONFIG_CRYPTO_NULL is not set
1291# CONFIG_CRYPTO_CRYPTD is not set
1292# CONFIG_CRYPTO_AUTHENC is not set
1293# CONFIG_CRYPTO_TEST is not set
1294
1295#
1296# Authenticated Encryption with Associated Data
1297#
1298# CONFIG_CRYPTO_CCM is not set
1299# CONFIG_CRYPTO_GCM is not set
1300# CONFIG_CRYPTO_SEQIV is not set
1301
1302#
1303# Block modes
1304#
1305# CONFIG_CRYPTO_CBC is not set
1306# CONFIG_CRYPTO_CTR is not set
1307# CONFIG_CRYPTO_CTS is not set
1308# CONFIG_CRYPTO_ECB is not set
1309# CONFIG_CRYPTO_LRW is not set
1310# CONFIG_CRYPTO_PCBC is not set
1311# CONFIG_CRYPTO_XTS is not set
1312
1313#
1314# Hash modes
1315#
1316# CONFIG_CRYPTO_HMAC is not set
1317# CONFIG_CRYPTO_XCBC is not set
1318
1319#
1320# Digest
1321#
1322# CONFIG_CRYPTO_CRC32C is not set
1323# CONFIG_CRYPTO_MD4 is not set
1324# CONFIG_CRYPTO_MD5 is not set
1325# CONFIG_CRYPTO_MICHAEL_MIC is not set
1326# CONFIG_CRYPTO_RMD128 is not set
1327# CONFIG_CRYPTO_RMD160 is not set
1328# CONFIG_CRYPTO_RMD256 is not set
1329# CONFIG_CRYPTO_RMD320 is not set
1330# CONFIG_CRYPTO_SHA1 is not set
1331# CONFIG_CRYPTO_SHA256 is not set
1332# CONFIG_CRYPTO_SHA512 is not set
1333# CONFIG_CRYPTO_TGR192 is not set
1334# CONFIG_CRYPTO_WP512 is not set
1335
1336#
1337# Ciphers
1338#
1339# CONFIG_CRYPTO_AES is not set
1340# CONFIG_CRYPTO_ANUBIS is not set
1341# CONFIG_CRYPTO_ARC4 is not set
1342# CONFIG_CRYPTO_BLOWFISH is not set
1343# CONFIG_CRYPTO_CAMELLIA is not set
1344# CONFIG_CRYPTO_CAST5 is not set
1345# CONFIG_CRYPTO_CAST6 is not set
1346# CONFIG_CRYPTO_DES is not set
1347# CONFIG_CRYPTO_FCRYPT is not set
1348# CONFIG_CRYPTO_KHAZAD is not set
1349# CONFIG_CRYPTO_SALSA20 is not set
1350# CONFIG_CRYPTO_SEED is not set
1351# CONFIG_CRYPTO_SERPENT is not set
1352# CONFIG_CRYPTO_TEA is not set
1353# CONFIG_CRYPTO_TWOFISH is not set
1354
1355#
1356# Compression
1357#
1358# CONFIG_CRYPTO_DEFLATE is not set
1359# CONFIG_CRYPTO_LZO is not set
1360
1361#
1362# Random Number Generation
1363#
1364# CONFIG_CRYPTO_ANSI_CPRNG is not set
1365CONFIG_CRYPTO_HW=y
1170 1366
1171# 1367#
1172# Library routines 1368# Library routines
@@ -1174,6 +1370,7 @@ CONFIG_SECURITY=y
1174CONFIG_BITREVERSE=y 1370CONFIG_BITREVERSE=y
1175CONFIG_CRC_CCITT=m 1371CONFIG_CRC_CCITT=m
1176# CONFIG_CRC16 is not set 1372# CONFIG_CRC16 is not set
1373# CONFIG_CRC_T10DIF is not set
1177# CONFIG_CRC_ITU_T is not set 1374# CONFIG_CRC_ITU_T is not set
1178CONFIG_CRC32=y 1375CONFIG_CRC32=y
1179# CONFIG_CRC7 is not set 1376# CONFIG_CRC7 is not set
diff --git a/arch/blackfin/include/asm/checksum.h b/arch/blackfin/include/asm/checksum.h
index f67289a0d8d2..793581fc9556 100644
--- a/arch/blackfin/include/asm/checksum.h
+++ b/arch/blackfin/include/asm/checksum.h
@@ -63,23 +63,23 @@ static inline __wsum
63csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 63csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
64 unsigned short proto, __wsum sum) 64 unsigned short proto, __wsum sum)
65{ 65{
66 66 unsigned int carry;
67 __asm__ ("%0 = %0 + %1;\n\t" 67
68 "CC = AC0;\n\t" 68 __asm__ ("%0 = %0 + %2;\n\t"
69 "if !CC jump 4;\n\t" 69 "CC = AC0;\n\t"
70 "%0 = %0 + %4;\n\t" 70 "%1 = CC;\n\t"
71 "%0 = %0 + %2;\n\t" 71 "%0 = %0 + %1;\n\t"
72 "CC = AC0;\n\t" 72 "%0 = %0 + %3;\n\t"
73 "if !CC jump 4;\n\t" 73 "CC = AC0;\n\t"
74 "%0 = %0 + %4;\n\t" 74 "%1 = CC;\n\t"
75 "%0 = %0 + %3;\n\t" 75 "%0 = %0 + %1;\n\t"
76 "CC = AC0;\n\t" 76 "%0 = %0 + %4;\n\t"
77 "if !CC jump 4;\n\t" 77 "CC = AC0;\n\t"
78 "%0 = %0 + %4;\n\t" 78 "%1 = CC;\n\t"
79 "NOP;\n\t" 79 "%0 = %0 + %1;\n\t"
80 : "=d" (sum) 80 : "=d" (sum), "=&d" (carry)
81 : "d" (daddr), "d" (saddr), "d" ((ntohs(len)<<16)+proto*256), "d" (1), "0"(sum) 81 : "d" (daddr), "d" (saddr), "d" ((len + proto) << 8), "0"(sum)
82 : "CC"); 82 : "CC");
83 83
84 return (sum); 84 return (sum);
85} 85}
diff --git a/arch/blackfin/include/asm/delay.h b/arch/blackfin/include/asm/delay.h
index 0889c3abb593..c31f91cc1d5d 100644
--- a/arch/blackfin/include/asm/delay.h
+++ b/arch/blackfin/include/asm/delay.h
@@ -13,29 +13,7 @@
13 13
14static inline void __delay(unsigned long loops) 14static inline void __delay(unsigned long loops)
15{ 15{
16 if (ANOMALY_05000312) { 16__asm__ __volatile__ (
17 /* Interrupted loads to loop registers -> bad */
18 unsigned long tmp;
19 __asm__ __volatile__(
20 "[--SP] = LC0;"
21 "[--SP] = LT0;"
22 "[--SP] = LB0;"
23 "LSETUP (1f,1f) LC0 = %1;"
24 "1: NOP;"
25 /* We take advantage of the fact that LC0 is 0 at
26 * the end of the loop. Otherwise we'd need some
27 * NOPs after the CLI here.
28 */
29 "CLI %0;"
30 "LB0 = [SP++];"
31 "LT0 = [SP++];"
32 "LC0 = [SP++];"
33 "STI %0;"
34 : "=d" (tmp)
35 : "a" (loops)
36 );
37 } else
38 __asm__ __volatile__ (
39 "LSETUP(1f, 1f) LC0 = %0;" 17 "LSETUP(1f, 1f) LC0 = %0;"
40 "1: NOP;" 18 "1: NOP;"
41 : 19 :
@@ -47,16 +25,15 @@ static inline void __delay(unsigned long loops)
47#include <linux/param.h> /* needed for HZ */ 25#include <linux/param.h> /* needed for HZ */
48 26
49/* 27/*
50 * Use only for very small delays ( < 1 msec). Should probably use a 28 * close approximation borrowed from m68knommu to avoid 64-bit math
51 * lookup table, really, as the multiplications take much too long with
52 * short delays. This is a "reasonable" implementation, though (and the
53 * first constant multiplications gets optimized away if the delay is
54 * a constant)
55 */ 29 */
30
31#define HZSCALE (268435456 / (1000000/HZ))
32
56static inline void udelay(unsigned long usecs) 33static inline void udelay(unsigned long usecs)
57{ 34{
58 extern unsigned long loops_per_jiffy; 35 extern unsigned long loops_per_jiffy;
59 __delay(usecs * loops_per_jiffy / (1000000 / HZ)); 36 __delay((((usecs * HZSCALE) >> 11) * (loops_per_jiffy >> 11)) >> 6);
60} 37}
61 38
62#endif 39#endif
diff --git a/arch/blackfin/include/asm/gpio.h b/arch/blackfin/include/asm/gpio.h
index 9477d82fcad2..d4a082ef75b4 100644
--- a/arch/blackfin/include/asm/gpio.h
+++ b/arch/blackfin/include/asm/gpio.h
@@ -27,60 +27,6 @@
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */ 28 */
29 29
30/*
31* Number BF537/6/4 BF561 BF533/2/1
32* BF527/5/2
33*
34* GPIO_0 PF0 PF0 PF0
35* GPIO_1 PF1 PF1 PF1
36* GPIO_2 PF2 PF2 PF2
37* GPIO_3 PF3 PF3 PF3
38* GPIO_4 PF4 PF4 PF4
39* GPIO_5 PF5 PF5 PF5
40* GPIO_6 PF6 PF6 PF6
41* GPIO_7 PF7 PF7 PF7
42* GPIO_8 PF8 PF8 PF8
43* GPIO_9 PF9 PF9 PF9
44* GPIO_10 PF10 PF10 PF10
45* GPIO_11 PF11 PF11 PF11
46* GPIO_12 PF12 PF12 PF12
47* GPIO_13 PF13 PF13 PF13
48* GPIO_14 PF14 PF14 PF14
49* GPIO_15 PF15 PF15 PF15
50* GPIO_16 PG0 PF16
51* GPIO_17 PG1 PF17
52* GPIO_18 PG2 PF18
53* GPIO_19 PG3 PF19
54* GPIO_20 PG4 PF20
55* GPIO_21 PG5 PF21
56* GPIO_22 PG6 PF22
57* GPIO_23 PG7 PF23
58* GPIO_24 PG8 PF24
59* GPIO_25 PG9 PF25
60* GPIO_26 PG10 PF26
61* GPIO_27 PG11 PF27
62* GPIO_28 PG12 PF28
63* GPIO_29 PG13 PF29
64* GPIO_30 PG14 PF30
65* GPIO_31 PG15 PF31
66* GPIO_32 PH0 PF32
67* GPIO_33 PH1 PF33
68* GPIO_34 PH2 PF34
69* GPIO_35 PH3 PF35
70* GPIO_36 PH4 PF36
71* GPIO_37 PH5 PF37
72* GPIO_38 PH6 PF38
73* GPIO_39 PH7 PF39
74* GPIO_40 PH8 PF40
75* GPIO_41 PH9 PF41
76* GPIO_42 PH10 PF42
77* GPIO_43 PH11 PF43
78* GPIO_44 PH12 PF44
79* GPIO_45 PH13 PF45
80* GPIO_46 PH14 PF46
81* GPIO_47 PH15 PF47
82*/
83
84#ifndef __ARCH_BLACKFIN_GPIO_H__ 30#ifndef __ARCH_BLACKFIN_GPIO_H__
85#define __ARCH_BLACKFIN_GPIO_H__ 31#define __ARCH_BLACKFIN_GPIO_H__
86 32
@@ -295,10 +241,6 @@ int bfin_gpio_direction_output(unsigned gpio, int value);
295int bfin_gpio_get_value(unsigned gpio); 241int bfin_gpio_get_value(unsigned gpio);
296void bfin_gpio_set_value(unsigned gpio, int value); 242void bfin_gpio_set_value(unsigned gpio, int value);
297 243
298#ifndef BF548_FAMILY
299#define bfin_gpio_set_value(gpio, value) set_gpio_data(gpio, value)
300#endif
301
302#ifdef CONFIG_GPIOLIB 244#ifdef CONFIG_GPIOLIB
303#include <asm-generic/gpio.h> /* cansleep wrappers */ 245#include <asm-generic/gpio.h> /* cansleep wrappers */
304 246
diff --git a/arch/blackfin/include/asm/kgdb.h b/arch/blackfin/include/asm/kgdb.h
index 26ebac6646d8..c8b256d2ea30 100644
--- a/arch/blackfin/include/asm/kgdb.h
+++ b/arch/blackfin/include/asm/kgdb.h
@@ -1,32 +1,8 @@
1/* 1/* Blackfin KGDB header
2 * File: include/asm-blackfin/kgdb.h
3 * Based on:
4 * Author: Sonic Zhang
5 *
6 * Created:
7 * Description:
8 *
9 * Rev: $Id: kgdb_bfin_linux-2.6.x.patch 4934 2007-02-13 09:32:11Z sonicz $
10 *
11 * Modified:
12 * Copyright 2005-2006 Analog Devices Inc.
13 *
14 * Bugs: Enter bugs at http://blackfin.uclinux.org/
15 * 2 *
16 * This program is free software; you can redistribute it and/or modify 3 * Copyright 2005-2009 Analog Devices Inc.
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 * 4 *
21 * This program is distributed in the hope that it will be useful, 5 * Licensed under the GPL-2 or later.
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, see the file COPYING, or write
28 * to the Free Software Foundation, Inc.,
29 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 */ 6 */
31 7
32#ifndef __ASM_BLACKFIN_KGDB_H__ 8#ifndef __ASM_BLACKFIN_KGDB_H__
@@ -37,17 +13,18 @@
37/* gdb locks */ 13/* gdb locks */
38#define KGDB_MAX_NO_CPUS 8 14#define KGDB_MAX_NO_CPUS 8
39 15
40/************************************************************************/ 16/*
41/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/ 17 * BUFMAX defines the maximum number of characters in inbound/outbound buffers.
42/* at least NUMREGBYTES*2 are needed for register packets */ 18 * At least NUMREGBYTES*2 are needed for register packets.
43/* Longer buffer is needed to list all threads */ 19 * Longer buffer is needed to list all threads.
20 */
44#define BUFMAX 2048 21#define BUFMAX 2048
45 22
46/* 23/*
47 * Note that this register image is different from 24 * Note that this register image is different from
48 * the register image that Linux produces at interrupt time. 25 * the register image that Linux produces at interrupt time.
49 * 26 *
50 * Linux's register image is defined by struct pt_regs in ptrace.h. 27 * Linux's register image is defined by struct pt_regs in ptrace.h.
51 */ 28 */
52enum regnames { 29enum regnames {
53 /* Core Registers */ 30 /* Core Registers */
@@ -104,14 +81,14 @@ enum regnames {
104 BFIN_RETX, 81 BFIN_RETX,
105 BFIN_RETN, 82 BFIN_RETN,
106 BFIN_RETE, 83 BFIN_RETE,
107 84
108 /* Pseudo Registers */ 85 /* Pseudo Registers */
109 BFIN_PC, 86 BFIN_PC,
110 BFIN_CC, 87 BFIN_CC,
111 BFIN_EXTRA1, /* Address of .text section. */ 88 BFIN_EXTRA1, /* Address of .text section. */
112 BFIN_EXTRA2, /* Address of .data section. */ 89 BFIN_EXTRA2, /* Address of .data section. */
113 BFIN_EXTRA3, /* Address of .bss section. */ 90 BFIN_EXTRA3, /* Address of .bss section. */
114 BFIN_FDPIC_EXEC, 91 BFIN_FDPIC_EXEC,
115 BFIN_FDPIC_INTERP, 92 BFIN_FDPIC_INTERP,
116 93
117 /* MMRs */ 94 /* MMRs */
@@ -126,7 +103,7 @@ enum regnames {
126 103
127static inline void arch_kgdb_breakpoint(void) 104static inline void arch_kgdb_breakpoint(void)
128{ 105{
129 asm(" EXCPT 2;"); 106 asm("EXCPT 2;");
130} 107}
131#define BREAK_INSTR_SIZE 2 108#define BREAK_INSTR_SIZE 2
132#define CACHE_FLUSH_IS_SAFE 1 109#define CACHE_FLUSH_IS_SAFE 1
diff --git a/arch/blackfin/include/asm/mem_init.h b/arch/blackfin/include/asm/mem_init.h
index 255a9316ad36..61f7487fbf12 100644
--- a/arch/blackfin/include/asm/mem_init.h
+++ b/arch/blackfin/include/asm/mem_init.h
@@ -115,7 +115,7 @@
115#define mem_SDRRC (((CONFIG_SCLK_HZ / 1000) * SDRAM_Tref) / SDRAM_NRA) - (SDRAM_tRAS_num + SDRAM_tRP_num) 115#define mem_SDRRC (((CONFIG_SCLK_HZ / 1000) * SDRAM_Tref) / SDRAM_NRA) - (SDRAM_tRAS_num + SDRAM_tRP_num)
116 116
117/* Enable SCLK Out */ 117/* Enable SCLK Out */
118#define mem_SDGCTL (0x80000000 | SCTLE | SDRAM_CL | SDRAM_tRAS | SDRAM_tRP | SDRAM_tRCD | SDRAM_tWR | PSS) 118#define mem_SDGCTL (SCTLE | SDRAM_CL | SDRAM_tRAS | SDRAM_tRP | SDRAM_tRCD | SDRAM_tWR | PSS)
119#else 119#else
120#define mem_SDRRC CONFIG_MEM_SDRRC 120#define mem_SDRRC CONFIG_MEM_SDRRC
121#define mem_SDGCTL CONFIG_MEM_SDGCTL 121#define mem_SDGCTL CONFIG_MEM_SDGCTL
diff --git a/arch/blackfin/include/asm/pda.h b/arch/blackfin/include/asm/pda.h
index bd8d4a7efeb2..a67142740df0 100644
--- a/arch/blackfin/include/asm/pda.h
+++ b/arch/blackfin/include/asm/pda.h
@@ -59,6 +59,7 @@ struct blackfin_pda { /* Per-processor Data Area */
59 unsigned long icplb_fault_addr; 59 unsigned long icplb_fault_addr;
60 unsigned long retx; 60 unsigned long retx;
61 unsigned long seqstat; 61 unsigned long seqstat;
62 unsigned int __nmi_count; /* number of times NMI asserted on this CPU */
62}; 63};
63 64
64extern struct blackfin_pda cpu_pda[]; 65extern struct blackfin_pda cpu_pda[];
diff --git a/arch/blackfin/include/asm/reboot.h b/arch/blackfin/include/asm/reboot.h
index 4856d62b7467..ae1e36329bec 100644
--- a/arch/blackfin/include/asm/reboot.h
+++ b/arch/blackfin/include/asm/reboot.h
@@ -15,6 +15,6 @@ extern void native_machine_halt(void);
15extern void native_machine_power_off(void); 15extern void native_machine_power_off(void);
16 16
17/* common reboot workarounds */ 17/* common reboot workarounds */
18extern void bfin_gpio_reset_spi0_ssel1(void); 18extern void bfin_reset_boot_spi_cs(unsigned short pin);
19 19
20#endif 20#endif
diff --git a/arch/blackfin/kernel/Makefile b/arch/blackfin/kernel/Makefile
index 38a233374f07..4a92a86824b7 100644
--- a/arch/blackfin/kernel/Makefile
+++ b/arch/blackfin/kernel/Makefile
@@ -15,6 +15,8 @@ else
15 obj-y += time.o 15 obj-y += time.o
16endif 16endif
17 17
18CFLAGS_kgdb_test.o := -mlong-calls -O0
19
18obj-$(CONFIG_IPIPE) += ipipe.o 20obj-$(CONFIG_IPIPE) += ipipe.o
19obj-$(CONFIG_IPIPE_TRACE_MCOUNT) += mcount.o 21obj-$(CONFIG_IPIPE_TRACE_MCOUNT) += mcount.o
20obj-$(CONFIG_BFIN_GPTIMERS) += gptimers.o 22obj-$(CONFIG_BFIN_GPTIMERS) += gptimers.o
diff --git a/arch/blackfin/kernel/bfin_dma_5xx.c b/arch/blackfin/kernel/bfin_dma_5xx.c
index 07e02c0d1c07..8531693fb48d 100644
--- a/arch/blackfin/kernel/bfin_dma_5xx.c
+++ b/arch/blackfin/kernel/bfin_dma_5xx.c
@@ -249,6 +249,13 @@ static void __dma_memcpy(u32 daddr, s16 dmod, u32 saddr, s16 smod, size_t cnt, u
249 249
250 spin_lock_irqsave(&mdma_lock, flags); 250 spin_lock_irqsave(&mdma_lock, flags);
251 251
252 /* Force a sync in case a previous config reset on this channel
253 * occurred. This is needed so subsequent writes to DMA registers
254 * are not spuriously lost/corrupted. Do it under irq lock and
255 * without the anomaly version (because we are atomic already).
256 */
257 __builtin_bfin_ssync();
258
252 if (bfin_read_MDMA_S0_CONFIG()) 259 if (bfin_read_MDMA_S0_CONFIG())
253 while (!(bfin_read_MDMA_D0_IRQ_STATUS() & DMA_DONE)) 260 while (!(bfin_read_MDMA_D0_IRQ_STATUS() & DMA_DONE))
254 continue; 261 continue;
diff --git a/arch/blackfin/kernel/bfin_gpio.c b/arch/blackfin/kernel/bfin_gpio.c
index 4c14331978f6..51dac55c524a 100644
--- a/arch/blackfin/kernel/bfin_gpio.c
+++ b/arch/blackfin/kernel/bfin_gpio.c
@@ -27,59 +27,6 @@
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */ 28 */
29 29
30/*
31* Number BF537/6/4 BF561 BF533/2/1 BF549/8/4/2
32*
33* GPIO_0 PF0 PF0 PF0 PA0...PJ13
34* GPIO_1 PF1 PF1 PF1
35* GPIO_2 PF2 PF2 PF2
36* GPIO_3 PF3 PF3 PF3
37* GPIO_4 PF4 PF4 PF4
38* GPIO_5 PF5 PF5 PF5
39* GPIO_6 PF6 PF6 PF6
40* GPIO_7 PF7 PF7 PF7
41* GPIO_8 PF8 PF8 PF8
42* GPIO_9 PF9 PF9 PF9
43* GPIO_10 PF10 PF10 PF10
44* GPIO_11 PF11 PF11 PF11
45* GPIO_12 PF12 PF12 PF12
46* GPIO_13 PF13 PF13 PF13
47* GPIO_14 PF14 PF14 PF14
48* GPIO_15 PF15 PF15 PF15
49* GPIO_16 PG0 PF16
50* GPIO_17 PG1 PF17
51* GPIO_18 PG2 PF18
52* GPIO_19 PG3 PF19
53* GPIO_20 PG4 PF20
54* GPIO_21 PG5 PF21
55* GPIO_22 PG6 PF22
56* GPIO_23 PG7 PF23
57* GPIO_24 PG8 PF24
58* GPIO_25 PG9 PF25
59* GPIO_26 PG10 PF26
60* GPIO_27 PG11 PF27
61* GPIO_28 PG12 PF28
62* GPIO_29 PG13 PF29
63* GPIO_30 PG14 PF30
64* GPIO_31 PG15 PF31
65* GPIO_32 PH0 PF32
66* GPIO_33 PH1 PF33
67* GPIO_34 PH2 PF34
68* GPIO_35 PH3 PF35
69* GPIO_36 PH4 PF36
70* GPIO_37 PH5 PF37
71* GPIO_38 PH6 PF38
72* GPIO_39 PH7 PF39
73* GPIO_40 PH8 PF40
74* GPIO_41 PH9 PF41
75* GPIO_42 PH10 PF42
76* GPIO_43 PH11 PF43
77* GPIO_44 PH12 PF44
78* GPIO_45 PH13 PF45
79* GPIO_46 PH14 PF46
80* GPIO_47 PH15 PF47
81*/
82
83#include <linux/delay.h> 30#include <linux/delay.h>
84#include <linux/module.h> 31#include <linux/module.h>
85#include <linux/err.h> 32#include <linux/err.h>
@@ -119,62 +66,61 @@ enum {
119#define AWA_DUMMY_READ(...) do { } while (0) 66#define AWA_DUMMY_READ(...) do { } while (0)
120#endif 67#endif
121 68
69static struct gpio_port_t * const gpio_array[] = {
122#if defined(BF533_FAMILY) || defined(BF538_FAMILY) 70#if defined(BF533_FAMILY) || defined(BF538_FAMILY)
123static struct gpio_port_t *gpio_bankb[] = {
124 (struct gpio_port_t *) FIO_FLAG_D, 71 (struct gpio_port_t *) FIO_FLAG_D,
125}; 72#elif defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY)
126#endif
127
128#if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY)
129static struct gpio_port_t *gpio_bankb[] = {
130 (struct gpio_port_t *) PORTFIO, 73 (struct gpio_port_t *) PORTFIO,
131 (struct gpio_port_t *) PORTGIO, 74 (struct gpio_port_t *) PORTGIO,
132 (struct gpio_port_t *) PORTHIO, 75 (struct gpio_port_t *) PORTHIO,
76#elif defined(BF561_FAMILY)
77 (struct gpio_port_t *) FIO0_FLAG_D,
78 (struct gpio_port_t *) FIO1_FLAG_D,
79 (struct gpio_port_t *) FIO2_FLAG_D,
80#elif defined(BF548_FAMILY)
81 (struct gpio_port_t *)PORTA_FER,
82 (struct gpio_port_t *)PORTB_FER,
83 (struct gpio_port_t *)PORTC_FER,
84 (struct gpio_port_t *)PORTD_FER,
85 (struct gpio_port_t *)PORTE_FER,
86 (struct gpio_port_t *)PORTF_FER,
87 (struct gpio_port_t *)PORTG_FER,
88 (struct gpio_port_t *)PORTH_FER,
89 (struct gpio_port_t *)PORTI_FER,
90 (struct gpio_port_t *)PORTJ_FER,
91#else
92# error no gpio arrays defined
93#endif
133}; 94};
134 95
135static unsigned short *port_fer[] = { 96#if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY)
97static unsigned short * const port_fer[] = {
136 (unsigned short *) PORTF_FER, 98 (unsigned short *) PORTF_FER,
137 (unsigned short *) PORTG_FER, 99 (unsigned short *) PORTG_FER,
138 (unsigned short *) PORTH_FER, 100 (unsigned short *) PORTH_FER,
139}; 101};
140#endif
141 102
142#if defined(BF527_FAMILY) || defined(BF518_FAMILY) 103# if !defined(BF537_FAMILY)
143static unsigned short *port_mux[] = { 104static unsigned short * const port_mux[] = {
144 (unsigned short *) PORTF_MUX, 105 (unsigned short *) PORTF_MUX,
145 (unsigned short *) PORTG_MUX, 106 (unsigned short *) PORTG_MUX,
146 (unsigned short *) PORTH_MUX, 107 (unsigned short *) PORTH_MUX,
147}; 108};
148 109
149static const 110static const
150u8 pmux_offset[][16] = 111u8 pmux_offset[][16] = {
151 {{ 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 4, 6, 8, 8, 10, 10 }, /* PORTF */ 112# if defined(BF527_FAMILY)
152 { 0, 0, 0, 0, 0, 2, 2, 4, 4, 6, 8, 10, 10, 10, 12, 12 }, /* PORTG */ 113 { 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 4, 6, 8, 8, 10, 10 }, /* PORTF */
153 { 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 4, 4, 4, 4, 4 }, /* PORTH */ 114 { 0, 0, 0, 0, 0, 2, 2, 4, 4, 6, 8, 10, 10, 10, 12, 12 }, /* PORTG */
154 }; 115 { 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 4, 4, 4, 4, 4 }, /* PORTH */
155#endif 116# elif defined(BF518_FAMILY)
156 117 { 0, 2, 2, 2, 2, 2, 2, 4, 6, 6, 6, 8, 8, 8, 8, 10 }, /* PORTF */
157#ifdef BF561_FAMILY 118 { 0, 0, 0, 2, 4, 6, 6, 6, 8, 10, 10, 12, 14, 14, 14, 14 }, /* PORTG */
158static struct gpio_port_t *gpio_bankb[] = { 119 { 0, 0, 0, 0, 2, 2, 4, 6, 10, 10, 10, 10, 10, 10, 10, 10 }, /* PORTH */
159 (struct gpio_port_t *) FIO0_FLAG_D, 120# endif
160 (struct gpio_port_t *) FIO1_FLAG_D,
161 (struct gpio_port_t *) FIO2_FLAG_D,
162}; 121};
163#endif 122# endif
164 123
165#ifdef BF548_FAMILY
166static struct gpio_port_t *gpio_array[] = {
167 (struct gpio_port_t *)PORTA_FER,
168 (struct gpio_port_t *)PORTB_FER,
169 (struct gpio_port_t *)PORTC_FER,
170 (struct gpio_port_t *)PORTD_FER,
171 (struct gpio_port_t *)PORTE_FER,
172 (struct gpio_port_t *)PORTF_FER,
173 (struct gpio_port_t *)PORTG_FER,
174 (struct gpio_port_t *)PORTH_FER,
175 (struct gpio_port_t *)PORTI_FER,
176 (struct gpio_port_t *)PORTJ_FER,
177};
178#endif 124#endif
179 125
180static unsigned short reserved_gpio_map[GPIO_BANK_NUM]; 126static unsigned short reserved_gpio_map[GPIO_BANK_NUM];
@@ -188,35 +134,9 @@ static struct str_ident {
188} str_ident[MAX_RESOURCES]; 134} str_ident[MAX_RESOURCES];
189 135
190#if defined(CONFIG_PM) 136#if defined(CONFIG_PM)
191#if defined(CONFIG_BF54x)
192static struct gpio_port_s gpio_bank_saved[GPIO_BANK_NUM];
193#else
194static unsigned short wakeup_map[GPIO_BANK_NUM];
195static unsigned char wakeup_flags_map[MAX_BLACKFIN_GPIOS];
196static struct gpio_port_s gpio_bank_saved[GPIO_BANK_NUM]; 137static struct gpio_port_s gpio_bank_saved[GPIO_BANK_NUM];
197
198#ifdef BF533_FAMILY
199static unsigned int sic_iwr_irqs[] = {IRQ_PROG_INTB};
200#endif
201
202#ifdef BF537_FAMILY
203static unsigned int sic_iwr_irqs[] = {IRQ_PROG_INTB, IRQ_PORTG_INTB, IRQ_MAC_TX};
204#endif
205
206#ifdef BF538_FAMILY
207static unsigned int sic_iwr_irqs[] = {IRQ_PORTF_INTB};
208#endif 138#endif
209 139
210#if defined(BF527_FAMILY) || defined(BF518_FAMILY)
211static unsigned int sic_iwr_irqs[] = {IRQ_PORTF_INTB, IRQ_PORTG_INTB, IRQ_PORTH_INTB};
212#endif
213
214#ifdef BF561_FAMILY
215static unsigned int sic_iwr_irqs[] = {IRQ_PROG0_INTB, IRQ_PROG1_INTB, IRQ_PROG2_INTB};
216#endif
217#endif
218#endif /* CONFIG_PM */
219
220inline int check_gpio(unsigned gpio) 140inline int check_gpio(unsigned gpio)
221{ 141{
222#if defined(BF548_FAMILY) 142#if defined(BF548_FAMILY)
@@ -330,9 +250,10 @@ static struct {
330 {.res = P_SPI0_SSEL3, .offset = 0}, 250 {.res = P_SPI0_SSEL3, .offset = 0},
331}; 251};
332 252
333static void portmux_setup(unsigned short per, unsigned short function) 253static void portmux_setup(unsigned short per)
334{ 254{
335 u16 y, offset, muxreg; 255 u16 y, offset, muxreg;
256 u16 function = P_FUNCT2MUX(per);
336 257
337 for (y = 0; y < ARRAY_SIZE(port_mux_lut); y++) { 258 for (y = 0; y < ARRAY_SIZE(port_mux_lut); y++) {
338 if (port_mux_lut[y].res == per) { 259 if (port_mux_lut[y].res == per) {
@@ -353,30 +274,33 @@ static void portmux_setup(unsigned short per, unsigned short function)
353 } 274 }
354} 275}
355#elif defined(BF548_FAMILY) 276#elif defined(BF548_FAMILY)
356inline void portmux_setup(unsigned short portno, unsigned short function) 277inline void portmux_setup(unsigned short per)
357{ 278{
358 u32 pmux; 279 u32 pmux;
280 u16 ident = P_IDENT(per);
281 u16 function = P_FUNCT2MUX(per);
359 282
360 pmux = gpio_array[gpio_bank(portno)]->port_mux; 283 pmux = gpio_array[gpio_bank(ident)]->port_mux;
361 284
362 pmux &= ~(0x3 << (2 * gpio_sub_n(portno))); 285 pmux &= ~(0x3 << (2 * gpio_sub_n(ident)));
363 pmux |= (function & 0x3) << (2 * gpio_sub_n(portno)); 286 pmux |= (function & 0x3) << (2 * gpio_sub_n(ident));
364 287
365 gpio_array[gpio_bank(portno)]->port_mux = pmux; 288 gpio_array[gpio_bank(ident)]->port_mux = pmux;
366} 289}
367 290
368inline u16 get_portmux(unsigned short portno) 291inline u16 get_portmux(unsigned short per)
369{ 292{
370 u32 pmux; 293 u32 pmux;
294 u16 ident = P_IDENT(per);
371 295
372 pmux = gpio_array[gpio_bank(portno)]->port_mux; 296 pmux = gpio_array[gpio_bank(ident)]->port_mux;
373 297
374 return (pmux >> (2 * gpio_sub_n(portno)) & 0x3); 298 return (pmux >> (2 * gpio_sub_n(ident)) & 0x3);
375} 299}
376#elif defined(BF527_FAMILY) || defined(BF518_FAMILY) 300#elif defined(BF527_FAMILY) || defined(BF518_FAMILY)
377inline void portmux_setup(unsigned short portno, unsigned short function) 301inline void portmux_setup(unsigned short per)
378{ 302{
379 u16 pmux, ident = P_IDENT(portno); 303 u16 pmux, ident = P_IDENT(per), function = P_FUNCT2MUX(per);
380 u8 offset = pmux_offset[gpio_bank(ident)][gpio_sub_n(ident)]; 304 u8 offset = pmux_offset[gpio_bank(ident)][gpio_sub_n(ident)];
381 305
382 pmux = *port_mux[gpio_bank(ident)]; 306 pmux = *port_mux[gpio_bank(ident)];
@@ -424,90 +348,71 @@ void set_gpio_ ## name(unsigned gpio, unsigned short arg) \
424 unsigned long flags; \ 348 unsigned long flags; \
425 local_irq_save_hw(flags); \ 349 local_irq_save_hw(flags); \
426 if (arg) \ 350 if (arg) \
427 gpio_bankb[gpio_bank(gpio)]->name |= gpio_bit(gpio); \ 351 gpio_array[gpio_bank(gpio)]->name |= gpio_bit(gpio); \
428 else \ 352 else \
429 gpio_bankb[gpio_bank(gpio)]->name &= ~gpio_bit(gpio); \ 353 gpio_array[gpio_bank(gpio)]->name &= ~gpio_bit(gpio); \
430 AWA_DUMMY_READ(name); \ 354 AWA_DUMMY_READ(name); \
431 local_irq_restore_hw(flags); \ 355 local_irq_restore_hw(flags); \
432} \ 356} \
433EXPORT_SYMBOL(set_gpio_ ## name); 357EXPORT_SYMBOL(set_gpio_ ## name);
434 358
435SET_GPIO(dir) 359SET_GPIO(dir) /* set_gpio_dir() */
436SET_GPIO(inen) 360SET_GPIO(inen) /* set_gpio_inen() */
437SET_GPIO(polar) 361SET_GPIO(polar) /* set_gpio_polar() */
438SET_GPIO(edge) 362SET_GPIO(edge) /* set_gpio_edge() */
439SET_GPIO(both) 363SET_GPIO(both) /* set_gpio_both() */
440 364
441 365
442#if ANOMALY_05000311 || ANOMALY_05000323
443#define SET_GPIO_SC(name) \ 366#define SET_GPIO_SC(name) \
444void set_gpio_ ## name(unsigned gpio, unsigned short arg) \ 367void set_gpio_ ## name(unsigned gpio, unsigned short arg) \
445{ \ 368{ \
446 unsigned long flags; \ 369 unsigned long flags; \
447 local_irq_save_hw(flags); \ 370 if (ANOMALY_05000311 || ANOMALY_05000323) \
448 if (arg) \ 371 local_irq_save_hw(flags); \
449 gpio_bankb[gpio_bank(gpio)]->name ## _set = gpio_bit(gpio); \
450 else \
451 gpio_bankb[gpio_bank(gpio)]->name ## _clear = gpio_bit(gpio); \
452 AWA_DUMMY_READ(name); \
453 local_irq_restore_hw(flags); \
454} \
455EXPORT_SYMBOL(set_gpio_ ## name);
456#else
457#define SET_GPIO_SC(name) \
458void set_gpio_ ## name(unsigned gpio, unsigned short arg) \
459{ \
460 if (arg) \ 372 if (arg) \
461 gpio_bankb[gpio_bank(gpio)]->name ## _set = gpio_bit(gpio); \ 373 gpio_array[gpio_bank(gpio)]->name ## _set = gpio_bit(gpio); \
462 else \ 374 else \
463 gpio_bankb[gpio_bank(gpio)]->name ## _clear = gpio_bit(gpio); \ 375 gpio_array[gpio_bank(gpio)]->name ## _clear = gpio_bit(gpio); \
376 if (ANOMALY_05000311 || ANOMALY_05000323) { \
377 AWA_DUMMY_READ(name); \
378 local_irq_restore_hw(flags); \
379 } \
464} \ 380} \
465EXPORT_SYMBOL(set_gpio_ ## name); 381EXPORT_SYMBOL(set_gpio_ ## name);
466#endif
467 382
468SET_GPIO_SC(maska) 383SET_GPIO_SC(maska)
469SET_GPIO_SC(maskb) 384SET_GPIO_SC(maskb)
470SET_GPIO_SC(data) 385SET_GPIO_SC(data)
471 386
472#if ANOMALY_05000311 || ANOMALY_05000323
473void set_gpio_toggle(unsigned gpio) 387void set_gpio_toggle(unsigned gpio)
474{ 388{
475 unsigned long flags; 389 unsigned long flags;
476 local_irq_save_hw(flags); 390 if (ANOMALY_05000311 || ANOMALY_05000323)
477 gpio_bankb[gpio_bank(gpio)]->toggle = gpio_bit(gpio); 391 local_irq_save_hw(flags);
478 AWA_DUMMY_READ(toggle); 392 gpio_array[gpio_bank(gpio)]->toggle = gpio_bit(gpio);
479 local_irq_restore_hw(flags); 393 if (ANOMALY_05000311 || ANOMALY_05000323) {
480} 394 AWA_DUMMY_READ(toggle);
481#else 395 local_irq_restore_hw(flags);
482void set_gpio_toggle(unsigned gpio) 396 }
483{
484 gpio_bankb[gpio_bank(gpio)]->toggle = gpio_bit(gpio);
485} 397}
486#endif
487EXPORT_SYMBOL(set_gpio_toggle); 398EXPORT_SYMBOL(set_gpio_toggle);
488 399
489 400
490/*Set current PORT date (16-bit word)*/ 401/*Set current PORT date (16-bit word)*/
491 402
492#if ANOMALY_05000311 || ANOMALY_05000323
493#define SET_GPIO_P(name) \ 403#define SET_GPIO_P(name) \
494void set_gpiop_ ## name(unsigned gpio, unsigned short arg) \ 404void set_gpiop_ ## name(unsigned gpio, unsigned short arg) \
495{ \ 405{ \
496 unsigned long flags; \ 406 unsigned long flags; \
497 local_irq_save_hw(flags); \ 407 if (ANOMALY_05000311 || ANOMALY_05000323) \
498 gpio_bankb[gpio_bank(gpio)]->name = arg; \ 408 local_irq_save_hw(flags); \
499 AWA_DUMMY_READ(name); \ 409 gpio_array[gpio_bank(gpio)]->name = arg; \
500 local_irq_restore_hw(flags); \ 410 if (ANOMALY_05000311 || ANOMALY_05000323) { \
411 AWA_DUMMY_READ(name); \
412 local_irq_restore_hw(flags); \
413 } \
501} \ 414} \
502EXPORT_SYMBOL(set_gpiop_ ## name); 415EXPORT_SYMBOL(set_gpiop_ ## name);
503#else
504#define SET_GPIO_P(name) \
505void set_gpiop_ ## name(unsigned gpio, unsigned short arg) \
506{ \
507 gpio_bankb[gpio_bank(gpio)]->name = arg; \
508} \
509EXPORT_SYMBOL(set_gpiop_ ## name);
510#endif
511 416
512SET_GPIO_P(data) 417SET_GPIO_P(data)
513SET_GPIO_P(dir) 418SET_GPIO_P(dir)
@@ -519,27 +424,21 @@ SET_GPIO_P(maska)
519SET_GPIO_P(maskb) 424SET_GPIO_P(maskb)
520 425
521/* Get a specific bit */ 426/* Get a specific bit */
522#if ANOMALY_05000311 || ANOMALY_05000323
523#define GET_GPIO(name) \ 427#define GET_GPIO(name) \
524unsigned short get_gpio_ ## name(unsigned gpio) \ 428unsigned short get_gpio_ ## name(unsigned gpio) \
525{ \ 429{ \
526 unsigned long flags; \ 430 unsigned long flags; \
527 unsigned short ret; \ 431 unsigned short ret; \
528 local_irq_save_hw(flags); \ 432 if (ANOMALY_05000311 || ANOMALY_05000323) \
529 ret = 0x01 & (gpio_bankb[gpio_bank(gpio)]->name >> gpio_sub_n(gpio)); \ 433 local_irq_save_hw(flags); \
530 AWA_DUMMY_READ(name); \ 434 ret = 0x01 & (gpio_array[gpio_bank(gpio)]->name >> gpio_sub_n(gpio)); \
531 local_irq_restore_hw(flags); \ 435 if (ANOMALY_05000311 || ANOMALY_05000323) { \
436 AWA_DUMMY_READ(name); \
437 local_irq_restore_hw(flags); \
438 } \
532 return ret; \ 439 return ret; \
533} \ 440} \
534EXPORT_SYMBOL(get_gpio_ ## name); 441EXPORT_SYMBOL(get_gpio_ ## name);
535#else
536#define GET_GPIO(name) \
537unsigned short get_gpio_ ## name(unsigned gpio) \
538{ \
539 return (0x01 & (gpio_bankb[gpio_bank(gpio)]->name >> gpio_sub_n(gpio))); \
540} \
541EXPORT_SYMBOL(get_gpio_ ## name);
542#endif
543 442
544GET_GPIO(data) 443GET_GPIO(data)
545GET_GPIO(dir) 444GET_GPIO(dir)
@@ -552,27 +451,21 @@ GET_GPIO(maskb)
552 451
553/*Get current PORT date (16-bit word)*/ 452/*Get current PORT date (16-bit word)*/
554 453
555#if ANOMALY_05000311 || ANOMALY_05000323
556#define GET_GPIO_P(name) \ 454#define GET_GPIO_P(name) \
557unsigned short get_gpiop_ ## name(unsigned gpio) \ 455unsigned short get_gpiop_ ## name(unsigned gpio) \
558{ \ 456{ \
559 unsigned long flags; \ 457 unsigned long flags; \
560 unsigned short ret; \ 458 unsigned short ret; \
561 local_irq_save_hw(flags); \ 459 if (ANOMALY_05000311 || ANOMALY_05000323) \
562 ret = (gpio_bankb[gpio_bank(gpio)]->name); \ 460 local_irq_save_hw(flags); \
563 AWA_DUMMY_READ(name); \ 461 ret = (gpio_array[gpio_bank(gpio)]->name); \
564 local_irq_restore_hw(flags); \ 462 if (ANOMALY_05000311 || ANOMALY_05000323) { \
463 AWA_DUMMY_READ(name); \
464 local_irq_restore_hw(flags); \
465 } \
565 return ret; \ 466 return ret; \
566} \ 467} \
567EXPORT_SYMBOL(get_gpiop_ ## name); 468EXPORT_SYMBOL(get_gpiop_ ## name);
568#else
569#define GET_GPIO_P(name) \
570unsigned short get_gpiop_ ## name(unsigned gpio) \
571{ \
572 return (gpio_bankb[gpio_bank(gpio)]->name);\
573} \
574EXPORT_SYMBOL(get_gpiop_ ## name);
575#endif
576 469
577GET_GPIO_P(data) 470GET_GPIO_P(data)
578GET_GPIO_P(dir) 471GET_GPIO_P(dir)
@@ -585,6 +478,26 @@ GET_GPIO_P(maskb)
585 478
586 479
587#ifdef CONFIG_PM 480#ifdef CONFIG_PM
481
482static unsigned short wakeup_map[GPIO_BANK_NUM];
483static unsigned char wakeup_flags_map[MAX_BLACKFIN_GPIOS];
484
485static const unsigned int sic_iwr_irqs[] = {
486#if defined(BF533_FAMILY)
487 IRQ_PROG_INTB
488#elif defined(BF537_FAMILY)
489 IRQ_PROG_INTB, IRQ_PORTG_INTB, IRQ_MAC_TX
490#elif defined(BF538_FAMILY)
491 IRQ_PORTF_INTB
492#elif defined(BF527_FAMILY) || defined(BF518_FAMILY)
493 IRQ_PORTF_INTB, IRQ_PORTG_INTB, IRQ_PORTH_INTB
494#elif defined(BF561_FAMILY)
495 IRQ_PROG0_INTB, IRQ_PROG1_INTB, IRQ_PROG2_INTB
496#else
497# error no SIC_IWR defined
498#endif
499};
500
588/*********************************************************** 501/***********************************************************
589* 502*
590* FUNCTIONS: Blackfin PM Setup API 503* FUNCTIONS: Blackfin PM Setup API
@@ -669,18 +582,18 @@ u32 bfin_pm_standby_setup(void)
669 mask = wakeup_map[gpio_bank(i)]; 582 mask = wakeup_map[gpio_bank(i)];
670 bank = gpio_bank(i); 583 bank = gpio_bank(i);
671 584
672 gpio_bank_saved[bank].maskb = gpio_bankb[bank]->maskb; 585 gpio_bank_saved[bank].maskb = gpio_array[bank]->maskb;
673 gpio_bankb[bank]->maskb = 0; 586 gpio_array[bank]->maskb = 0;
674 587
675 if (mask) { 588 if (mask) {
676#if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY) 589#if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY)
677 gpio_bank_saved[bank].fer = *port_fer[bank]; 590 gpio_bank_saved[bank].fer = *port_fer[bank];
678#endif 591#endif
679 gpio_bank_saved[bank].inen = gpio_bankb[bank]->inen; 592 gpio_bank_saved[bank].inen = gpio_array[bank]->inen;
680 gpio_bank_saved[bank].polar = gpio_bankb[bank]->polar; 593 gpio_bank_saved[bank].polar = gpio_array[bank]->polar;
681 gpio_bank_saved[bank].dir = gpio_bankb[bank]->dir; 594 gpio_bank_saved[bank].dir = gpio_array[bank]->dir;
682 gpio_bank_saved[bank].edge = gpio_bankb[bank]->edge; 595 gpio_bank_saved[bank].edge = gpio_array[bank]->edge;
683 gpio_bank_saved[bank].both = gpio_bankb[bank]->both; 596 gpio_bank_saved[bank].both = gpio_array[bank]->both;
684 gpio_bank_saved[bank].reserved = 597 gpio_bank_saved[bank].reserved =
685 reserved_gpio_map[bank]; 598 reserved_gpio_map[bank];
686 599
@@ -700,7 +613,7 @@ u32 bfin_pm_standby_setup(void)
700 } 613 }
701 614
702 bfin_internal_set_wake(sic_iwr_irqs[bank], 1); 615 bfin_internal_set_wake(sic_iwr_irqs[bank], 1);
703 gpio_bankb[bank]->maskb_set = wakeup_map[gpio_bank(i)]; 616 gpio_array[bank]->maskb_set = wakeup_map[gpio_bank(i)];
704 } 617 }
705 } 618 }
706 619
@@ -721,18 +634,18 @@ void bfin_pm_standby_restore(void)
721#if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY) 634#if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY)
722 *port_fer[bank] = gpio_bank_saved[bank].fer; 635 *port_fer[bank] = gpio_bank_saved[bank].fer;
723#endif 636#endif
724 gpio_bankb[bank]->inen = gpio_bank_saved[bank].inen; 637 gpio_array[bank]->inen = gpio_bank_saved[bank].inen;
725 gpio_bankb[bank]->dir = gpio_bank_saved[bank].dir; 638 gpio_array[bank]->dir = gpio_bank_saved[bank].dir;
726 gpio_bankb[bank]->polar = gpio_bank_saved[bank].polar; 639 gpio_array[bank]->polar = gpio_bank_saved[bank].polar;
727 gpio_bankb[bank]->edge = gpio_bank_saved[bank].edge; 640 gpio_array[bank]->edge = gpio_bank_saved[bank].edge;
728 gpio_bankb[bank]->both = gpio_bank_saved[bank].both; 641 gpio_array[bank]->both = gpio_bank_saved[bank].both;
729 642
730 reserved_gpio_map[bank] = 643 reserved_gpio_map[bank] =
731 gpio_bank_saved[bank].reserved; 644 gpio_bank_saved[bank].reserved;
732 bfin_internal_set_wake(sic_iwr_irqs[bank], 0); 645 bfin_internal_set_wake(sic_iwr_irqs[bank], 0);
733 } 646 }
734 647
735 gpio_bankb[bank]->maskb = gpio_bank_saved[bank].maskb; 648 gpio_array[bank]->maskb = gpio_bank_saved[bank].maskb;
736 } 649 }
737 AWA_DUMMY_READ(maskb); 650 AWA_DUMMY_READ(maskb);
738} 651}
@@ -745,21 +658,21 @@ void bfin_gpio_pm_hibernate_suspend(void)
745 bank = gpio_bank(i); 658 bank = gpio_bank(i);
746 659
747#if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY) 660#if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY)
748 gpio_bank_saved[bank].fer = *port_fer[bank]; 661 gpio_bank_saved[bank].fer = *port_fer[bank];
749#if defined(BF527_FAMILY) || defined(BF518_FAMILY) 662#if defined(BF527_FAMILY) || defined(BF518_FAMILY)
750 gpio_bank_saved[bank].mux = *port_mux[bank]; 663 gpio_bank_saved[bank].mux = *port_mux[bank];
751#else 664#else
752 if (bank == 0) 665 if (bank == 0)
753 gpio_bank_saved[bank].mux = bfin_read_PORT_MUX(); 666 gpio_bank_saved[bank].mux = bfin_read_PORT_MUX();
754#endif 667#endif
755#endif 668#endif
756 gpio_bank_saved[bank].data = gpio_bankb[bank]->data; 669 gpio_bank_saved[bank].data = gpio_array[bank]->data;
757 gpio_bank_saved[bank].inen = gpio_bankb[bank]->inen; 670 gpio_bank_saved[bank].inen = gpio_array[bank]->inen;
758 gpio_bank_saved[bank].polar = gpio_bankb[bank]->polar; 671 gpio_bank_saved[bank].polar = gpio_array[bank]->polar;
759 gpio_bank_saved[bank].dir = gpio_bankb[bank]->dir; 672 gpio_bank_saved[bank].dir = gpio_array[bank]->dir;
760 gpio_bank_saved[bank].edge = gpio_bankb[bank]->edge; 673 gpio_bank_saved[bank].edge = gpio_array[bank]->edge;
761 gpio_bank_saved[bank].both = gpio_bankb[bank]->both; 674 gpio_bank_saved[bank].both = gpio_array[bank]->both;
762 gpio_bank_saved[bank].maska = gpio_bankb[bank]->maska; 675 gpio_bank_saved[bank].maska = gpio_array[bank]->maska;
763 } 676 }
764 677
765 AWA_DUMMY_READ(maska); 678 AWA_DUMMY_READ(maska);
@@ -770,27 +683,27 @@ void bfin_gpio_pm_hibernate_restore(void)
770 int i, bank; 683 int i, bank;
771 684
772 for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) { 685 for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) {
773 bank = gpio_bank(i); 686 bank = gpio_bank(i);
774 687
775#if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY) 688#if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY)
776#if defined(BF527_FAMILY) || defined(BF518_FAMILY) 689#if defined(BF527_FAMILY) || defined(BF518_FAMILY)
777 *port_mux[bank] = gpio_bank_saved[bank].mux; 690 *port_mux[bank] = gpio_bank_saved[bank].mux;
778#else 691#else
779 if (bank == 0) 692 if (bank == 0)
780 bfin_write_PORT_MUX(gpio_bank_saved[bank].mux); 693 bfin_write_PORT_MUX(gpio_bank_saved[bank].mux);
781#endif 694#endif
782 *port_fer[bank] = gpio_bank_saved[bank].fer; 695 *port_fer[bank] = gpio_bank_saved[bank].fer;
783#endif 696#endif
784 gpio_bankb[bank]->inen = gpio_bank_saved[bank].inen; 697 gpio_array[bank]->inen = gpio_bank_saved[bank].inen;
785 gpio_bankb[bank]->dir = gpio_bank_saved[bank].dir; 698 gpio_array[bank]->dir = gpio_bank_saved[bank].dir;
786 gpio_bankb[bank]->polar = gpio_bank_saved[bank].polar; 699 gpio_array[bank]->polar = gpio_bank_saved[bank].polar;
787 gpio_bankb[bank]->edge = gpio_bank_saved[bank].edge; 700 gpio_array[bank]->edge = gpio_bank_saved[bank].edge;
788 gpio_bankb[bank]->both = gpio_bank_saved[bank].both; 701 gpio_array[bank]->both = gpio_bank_saved[bank].both;
789 702
790 gpio_bankb[bank]->data_set = gpio_bank_saved[bank].data 703 gpio_array[bank]->data_set = gpio_bank_saved[bank].data
791 | gpio_bank_saved[bank].dir; 704 | gpio_bank_saved[bank].dir;
792 705
793 gpio_bankb[bank]->maska = gpio_bank_saved[bank].maska; 706 gpio_array[bank]->maska = gpio_bank_saved[bank].maska;
794 } 707 }
795 AWA_DUMMY_READ(maska); 708 AWA_DUMMY_READ(maska);
796} 709}
@@ -817,12 +730,12 @@ void bfin_gpio_pm_hibernate_suspend(void)
817 for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) { 730 for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) {
818 bank = gpio_bank(i); 731 bank = gpio_bank(i);
819 732
820 gpio_bank_saved[bank].fer = gpio_array[bank]->port_fer; 733 gpio_bank_saved[bank].fer = gpio_array[bank]->port_fer;
821 gpio_bank_saved[bank].mux = gpio_array[bank]->port_mux; 734 gpio_bank_saved[bank].mux = gpio_array[bank]->port_mux;
822 gpio_bank_saved[bank].data = gpio_array[bank]->port_data; 735 gpio_bank_saved[bank].data = gpio_array[bank]->data;
823 gpio_bank_saved[bank].data = gpio_array[bank]->port_data; 736 gpio_bank_saved[bank].data = gpio_array[bank]->data;
824 gpio_bank_saved[bank].inen = gpio_array[bank]->port_inen; 737 gpio_bank_saved[bank].inen = gpio_array[bank]->inen;
825 gpio_bank_saved[bank].dir = gpio_array[bank]->port_dir_set; 738 gpio_bank_saved[bank].dir = gpio_array[bank]->dir_set;
826 } 739 }
827} 740}
828 741
@@ -831,21 +744,21 @@ void bfin_gpio_pm_hibernate_restore(void)
831 int i, bank; 744 int i, bank;
832 745
833 for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) { 746 for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) {
834 bank = gpio_bank(i); 747 bank = gpio_bank(i);
835 748
836 gpio_array[bank]->port_mux = gpio_bank_saved[bank].mux; 749 gpio_array[bank]->port_mux = gpio_bank_saved[bank].mux;
837 gpio_array[bank]->port_fer = gpio_bank_saved[bank].fer; 750 gpio_array[bank]->port_fer = gpio_bank_saved[bank].fer;
838 gpio_array[bank]->port_inen = gpio_bank_saved[bank].inen; 751 gpio_array[bank]->inen = gpio_bank_saved[bank].inen;
839 gpio_array[bank]->port_dir_set = gpio_bank_saved[bank].dir; 752 gpio_array[bank]->dir_set = gpio_bank_saved[bank].dir;
840 gpio_array[bank]->port_set = gpio_bank_saved[bank].data 753 gpio_array[bank]->data_set = gpio_bank_saved[bank].data
841 | gpio_bank_saved[bank].dir; 754 | gpio_bank_saved[bank].dir;
842 } 755 }
843} 756}
844#endif 757#endif
845 758
846unsigned short get_gpio_dir(unsigned gpio) 759unsigned short get_gpio_dir(unsigned gpio)
847{ 760{
848 return (0x01 & (gpio_array[gpio_bank(gpio)]->port_dir_clear >> gpio_sub_n(gpio))); 761 return (0x01 & (gpio_array[gpio_bank(gpio)]->dir_clear >> gpio_sub_n(gpio)));
849} 762}
850EXPORT_SYMBOL(get_gpio_dir); 763EXPORT_SYMBOL(get_gpio_dir);
851 764
@@ -905,9 +818,7 @@ int peripheral_request(unsigned short per, const char *label)
905 */ 818 */
906 819
907#ifdef BF548_FAMILY 820#ifdef BF548_FAMILY
908 u16 funct = get_portmux(ident); 821 if (!((per & P_MAYSHARE) && get_portmux(per) == P_FUNCT2MUX(per))) {
909
910 if (!((per & P_MAYSHARE) && (funct == P_FUNCT2MUX(per)))) {
911#else 822#else
912 if (!(per & P_MAYSHARE)) { 823 if (!(per & P_MAYSHARE)) {
913#endif 824#endif
@@ -931,11 +842,7 @@ int peripheral_request(unsigned short per, const char *label)
931 anyway: 842 anyway:
932 reserved_peri_map[gpio_bank(ident)] |= gpio_bit(ident); 843 reserved_peri_map[gpio_bank(ident)] |= gpio_bit(ident);
933 844
934#ifdef BF548_FAMILY 845 portmux_setup(per);
935 portmux_setup(ident, P_FUNCT2MUX(per));
936#else
937 portmux_setup(per, P_FUNCT2MUX(per));
938#endif
939 port_setup(ident, PERIPHERAL_USAGE); 846 port_setup(ident, PERIPHERAL_USAGE);
940 847
941 local_irq_restore_hw(flags); 848 local_irq_restore_hw(flags);
@@ -977,9 +884,6 @@ void peripheral_free(unsigned short per)
977 if (!(per & P_DEFINED)) 884 if (!(per & P_DEFINED))
978 return; 885 return;
979 886
980 if (check_gpio(ident) < 0)
981 return;
982
983 local_irq_save_hw(flags); 887 local_irq_save_hw(flags);
984 888
985 if (unlikely(!(reserved_peri_map[gpio_bank(ident)] & gpio_bit(ident)))) { 889 if (unlikely(!(reserved_peri_map[gpio_bank(ident)] & gpio_bit(ident)))) {
@@ -1056,9 +960,15 @@ int bfin_gpio_request(unsigned gpio, const char *label)
1056 local_irq_restore_hw(flags); 960 local_irq_restore_hw(flags);
1057 return -EBUSY; 961 return -EBUSY;
1058 } 962 }
1059 if (unlikely(reserved_gpio_irq_map[gpio_bank(gpio)] & gpio_bit(gpio))) 963 if (unlikely(reserved_gpio_irq_map[gpio_bank(gpio)] & gpio_bit(gpio))) {
1060 printk(KERN_NOTICE "bfin-gpio: GPIO %d is already reserved as gpio-irq!" 964 printk(KERN_NOTICE "bfin-gpio: GPIO %d is already reserved as gpio-irq!"
1061 " (Documentation/blackfin/bfin-gpio-notes.txt)\n", gpio); 965 " (Documentation/blackfin/bfin-gpio-notes.txt)\n", gpio);
966 }
967#ifndef BF548_FAMILY
968 else { /* Reset POLAR setting when acquiring a gpio for the first time */
969 set_gpio_polar(gpio, 0);
970 }
971#endif
1062 972
1063 reserved_gpio_map[gpio_bank(gpio)] |= gpio_bit(gpio); 973 reserved_gpio_map[gpio_bank(gpio)] |= gpio_bit(gpio);
1064 set_label(gpio, label); 974 set_label(gpio, label);
@@ -1078,6 +988,8 @@ void bfin_gpio_free(unsigned gpio)
1078 if (check_gpio(gpio) < 0) 988 if (check_gpio(gpio) < 0)
1079 return; 989 return;
1080 990
991 might_sleep();
992
1081 local_irq_save_hw(flags); 993 local_irq_save_hw(flags);
1082 994
1083 if (unlikely(!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio)))) { 995 if (unlikely(!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio)))) {
@@ -1158,8 +1070,16 @@ void bfin_gpio_irq_free(unsigned gpio)
1158 local_irq_restore_hw(flags); 1070 local_irq_restore_hw(flags);
1159} 1071}
1160 1072
1161 1073static inline void __bfin_gpio_direction_input(unsigned gpio)
1074{
1162#ifdef BF548_FAMILY 1075#ifdef BF548_FAMILY
1076 gpio_array[gpio_bank(gpio)]->dir_clear = gpio_bit(gpio);
1077#else
1078 gpio_array[gpio_bank(gpio)]->dir &= ~gpio_bit(gpio);
1079#endif
1080 gpio_array[gpio_bank(gpio)]->inen |= gpio_bit(gpio);
1081}
1082
1163int bfin_gpio_direction_input(unsigned gpio) 1083int bfin_gpio_direction_input(unsigned gpio)
1164{ 1084{
1165 unsigned long flags; 1085 unsigned long flags;
@@ -1170,125 +1090,85 @@ int bfin_gpio_direction_input(unsigned gpio)
1170 } 1090 }
1171 1091
1172 local_irq_save_hw(flags); 1092 local_irq_save_hw(flags);
1173 gpio_array[gpio_bank(gpio)]->port_dir_clear = gpio_bit(gpio); 1093 __bfin_gpio_direction_input(gpio);
1174 gpio_array[gpio_bank(gpio)]->port_inen |= gpio_bit(gpio); 1094 AWA_DUMMY_READ(inen);
1175 local_irq_restore_hw(flags); 1095 local_irq_restore_hw(flags);
1176 1096
1177 return 0; 1097 return 0;
1178} 1098}
1179EXPORT_SYMBOL(bfin_gpio_direction_input); 1099EXPORT_SYMBOL(bfin_gpio_direction_input);
1180 1100
1181int bfin_gpio_direction_output(unsigned gpio, int value) 1101void bfin_gpio_irq_prepare(unsigned gpio)
1182{ 1102{
1103#ifdef BF548_FAMILY
1183 unsigned long flags; 1104 unsigned long flags;
1105#endif
1184 1106
1185 if (!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))) { 1107 port_setup(gpio, GPIO_USAGE);
1186 gpio_error(gpio);
1187 return -EINVAL;
1188 }
1189 1108
1109#ifdef BF548_FAMILY
1190 local_irq_save_hw(flags); 1110 local_irq_save_hw(flags);
1191 gpio_array[gpio_bank(gpio)]->port_inen &= ~gpio_bit(gpio); 1111 __bfin_gpio_direction_input(gpio);
1192 gpio_set_value(gpio, value);
1193 gpio_array[gpio_bank(gpio)]->port_dir_set = gpio_bit(gpio);
1194 local_irq_restore_hw(flags); 1112 local_irq_restore_hw(flags);
1195 1113#endif
1196 return 0;
1197} 1114}
1198EXPORT_SYMBOL(bfin_gpio_direction_output);
1199 1115
1200void bfin_gpio_set_value(unsigned gpio, int arg) 1116void bfin_gpio_set_value(unsigned gpio, int arg)
1201{ 1117{
1202 if (arg) 1118 if (arg)
1203 gpio_array[gpio_bank(gpio)]->port_set = gpio_bit(gpio); 1119 gpio_array[gpio_bank(gpio)]->data_set = gpio_bit(gpio);
1204 else 1120 else
1205 gpio_array[gpio_bank(gpio)]->port_clear = gpio_bit(gpio); 1121 gpio_array[gpio_bank(gpio)]->data_clear = gpio_bit(gpio);
1206} 1122}
1207EXPORT_SYMBOL(bfin_gpio_set_value); 1123EXPORT_SYMBOL(bfin_gpio_set_value);
1208 1124
1209int bfin_gpio_get_value(unsigned gpio) 1125int bfin_gpio_direction_output(unsigned gpio, int value)
1210{
1211 return (1 & (gpio_array[gpio_bank(gpio)]->port_data >> gpio_sub_n(gpio)));
1212}
1213EXPORT_SYMBOL(bfin_gpio_get_value);
1214
1215void bfin_gpio_irq_prepare(unsigned gpio)
1216{ 1126{
1217 unsigned long flags; 1127 unsigned long flags;
1218 1128
1219 port_setup(gpio, GPIO_USAGE); 1129 if (!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))) {
1130 gpio_error(gpio);
1131 return -EINVAL;
1132 }
1220 1133
1221 local_irq_save_hw(flags); 1134 local_irq_save_hw(flags);
1222 gpio_array[gpio_bank(gpio)]->port_dir_clear = gpio_bit(gpio);
1223 gpio_array[gpio_bank(gpio)]->port_inen |= gpio_bit(gpio);
1224 local_irq_restore_hw(flags);
1225}
1226 1135
1136 gpio_array[gpio_bank(gpio)]->inen &= ~gpio_bit(gpio);
1137 gpio_set_value(gpio, value);
1138#ifdef BF548_FAMILY
1139 gpio_array[gpio_bank(gpio)]->dir_set = gpio_bit(gpio);
1227#else 1140#else
1141 gpio_array[gpio_bank(gpio)]->dir |= gpio_bit(gpio);
1142#endif
1143
1144 AWA_DUMMY_READ(dir);
1145 local_irq_restore_hw(flags);
1146
1147 return 0;
1148}
1149EXPORT_SYMBOL(bfin_gpio_direction_output);
1228 1150
1229int bfin_gpio_get_value(unsigned gpio) 1151int bfin_gpio_get_value(unsigned gpio)
1230{ 1152{
1153#ifdef BF548_FAMILY
1154 return (1 & (gpio_array[gpio_bank(gpio)]->data >> gpio_sub_n(gpio)));
1155#else
1231 unsigned long flags; 1156 unsigned long flags;
1232 int ret;
1233 1157
1234 if (unlikely(get_gpio_edge(gpio))) { 1158 if (unlikely(get_gpio_edge(gpio))) {
1159 int ret;
1235 local_irq_save_hw(flags); 1160 local_irq_save_hw(flags);
1236 set_gpio_edge(gpio, 0); 1161 set_gpio_edge(gpio, 0);
1237 ret = get_gpio_data(gpio); 1162 ret = get_gpio_data(gpio);
1238 set_gpio_edge(gpio, 1); 1163 set_gpio_edge(gpio, 1);
1239 local_irq_restore_hw(flags); 1164 local_irq_restore_hw(flags);
1240
1241 return ret; 1165 return ret;
1242 } else 1166 } else
1243 return get_gpio_data(gpio); 1167 return get_gpio_data(gpio);
1168#endif
1244} 1169}
1245EXPORT_SYMBOL(bfin_gpio_get_value); 1170EXPORT_SYMBOL(bfin_gpio_get_value);
1246 1171
1247
1248int bfin_gpio_direction_input(unsigned gpio)
1249{
1250 unsigned long flags;
1251
1252 if (!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))) {
1253 gpio_error(gpio);
1254 return -EINVAL;
1255 }
1256
1257 local_irq_save_hw(flags);
1258 gpio_bankb[gpio_bank(gpio)]->dir &= ~gpio_bit(gpio);
1259 gpio_bankb[gpio_bank(gpio)]->inen |= gpio_bit(gpio);
1260 AWA_DUMMY_READ(inen);
1261 local_irq_restore_hw(flags);
1262
1263 return 0;
1264}
1265EXPORT_SYMBOL(bfin_gpio_direction_input);
1266
1267int bfin_gpio_direction_output(unsigned gpio, int value)
1268{
1269 unsigned long flags;
1270
1271 if (!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))) {
1272 gpio_error(gpio);
1273 return -EINVAL;
1274 }
1275
1276 local_irq_save_hw(flags);
1277 gpio_bankb[gpio_bank(gpio)]->inen &= ~gpio_bit(gpio);
1278
1279 if (value)
1280 gpio_bankb[gpio_bank(gpio)]->data_set = gpio_bit(gpio);
1281 else
1282 gpio_bankb[gpio_bank(gpio)]->data_clear = gpio_bit(gpio);
1283
1284 gpio_bankb[gpio_bank(gpio)]->dir |= gpio_bit(gpio);
1285 AWA_DUMMY_READ(dir);
1286 local_irq_restore_hw(flags);
1287
1288 return 0;
1289}
1290EXPORT_SYMBOL(bfin_gpio_direction_output);
1291
1292/* If we are booting from SPI and our board lacks a strong enough pull up, 1172/* If we are booting from SPI and our board lacks a strong enough pull up,
1293 * the core can reset and execute the bootrom faster than the resistor can 1173 * the core can reset and execute the bootrom faster than the resistor can
1294 * pull the signal logically high. To work around this (common) error in 1174 * pull the signal logically high. To work around this (common) error in
@@ -1299,23 +1179,15 @@ EXPORT_SYMBOL(bfin_gpio_direction_output);
1299 * lives here as we need to force all the GPIO states w/out going through 1179 * lives here as we need to force all the GPIO states w/out going through
1300 * BUG() checks and such. 1180 * BUG() checks and such.
1301 */ 1181 */
1302void bfin_gpio_reset_spi0_ssel1(void) 1182void bfin_reset_boot_spi_cs(unsigned short pin)
1303{ 1183{
1304 u16 gpio = P_IDENT(P_SPI0_SSEL1); 1184 unsigned short gpio = P_IDENT(pin);
1305
1306 port_setup(gpio, GPIO_USAGE); 1185 port_setup(gpio, GPIO_USAGE);
1307 gpio_bankb[gpio_bank(gpio)]->data_set = gpio_bit(gpio); 1186 gpio_array[gpio_bank(gpio)]->data_set = gpio_bit(gpio);
1308 AWA_DUMMY_READ(data_set); 1187 AWA_DUMMY_READ(data_set);
1309 udelay(1); 1188 udelay(1);
1310} 1189}
1311 1190
1312void bfin_gpio_irq_prepare(unsigned gpio)
1313{
1314 port_setup(gpio, GPIO_USAGE);
1315}
1316
1317#endif /*BF548_FAMILY */
1318
1319#if defined(CONFIG_PROC_FS) 1191#if defined(CONFIG_PROC_FS)
1320static int gpio_proc_read(char *buf, char **start, off_t offset, 1192static int gpio_proc_read(char *buf, char **start, off_t offset,
1321 int len, int *unused_i, void *unused_v) 1193 int len, int *unused_i, void *unused_v)
@@ -1369,11 +1241,7 @@ int bfin_gpiolib_get_value(struct gpio_chip *chip, unsigned gpio)
1369 1241
1370void bfin_gpiolib_set_value(struct gpio_chip *chip, unsigned gpio, int value) 1242void bfin_gpiolib_set_value(struct gpio_chip *chip, unsigned gpio, int value)
1371{ 1243{
1372#ifdef BF548_FAMILY
1373 return bfin_gpio_set_value(gpio, value); 1244 return bfin_gpio_set_value(gpio, value);
1374#else
1375 return set_gpio_data(gpio, value);
1376#endif
1377} 1245}
1378 1246
1379int bfin_gpiolib_gpio_request(struct gpio_chip *chip, unsigned gpio) 1247int bfin_gpiolib_gpio_request(struct gpio_chip *chip, unsigned gpio)
diff --git a/arch/blackfin/kernel/cplb-mpu/cplbinit.c b/arch/blackfin/kernel/cplb-mpu/cplbinit.c
index bdb958486e76..3e329a6ce041 100644
--- a/arch/blackfin/kernel/cplb-mpu/cplbinit.c
+++ b/arch/blackfin/kernel/cplb-mpu/cplbinit.c
@@ -63,10 +63,8 @@ void __init generate_cplb_tables_cpu(unsigned int cpu)
63 dcplb_tbl[cpu][i_d].addr = 0; 63 dcplb_tbl[cpu][i_d].addr = 0;
64 dcplb_tbl[cpu][i_d++].data = SDRAM_OOPS | PAGE_SIZE_1KB; 64 dcplb_tbl[cpu][i_d++].data = SDRAM_OOPS | PAGE_SIZE_1KB;
65 65
66#if 0
67 icplb_tbl[cpu][i_i].addr = 0; 66 icplb_tbl[cpu][i_i].addr = 0;
68 icplb_tbl[cpu][i_i++].data = i_cache | CPLB_USER_RD | PAGE_SIZE_4KB; 67 icplb_tbl[cpu][i_i++].data = i_cache | CPLB_USER_RD | PAGE_SIZE_1KB;
69#endif
70 68
71 /* Cover kernel memory with 4M pages. */ 69 /* Cover kernel memory with 4M pages. */
72 addr = 0; 70 addr = 0;
diff --git a/arch/blackfin/kernel/cplb-nompu/cplbmgr.c b/arch/blackfin/kernel/cplb-nompu/cplbmgr.c
index 376249ab2694..8cbb47c7b663 100644
--- a/arch/blackfin/kernel/cplb-nompu/cplbmgr.c
+++ b/arch/blackfin/kernel/cplb-nompu/cplbmgr.c
@@ -163,12 +163,14 @@ MGR_ATTR static int icplb_miss(int cpu)
163 nr_icplb_supv_miss[cpu]++; 163 nr_icplb_supv_miss[cpu]++;
164 164
165 base = 0; 165 base = 0;
166 for (idx = 0; idx < icplb_nr_bounds; idx++) { 166 idx = 0;
167 do {
167 eaddr = icplb_bounds[idx].eaddr; 168 eaddr = icplb_bounds[idx].eaddr;
168 if (addr < eaddr) 169 if (addr < eaddr)
169 break; 170 break;
170 base = eaddr; 171 base = eaddr;
171 } 172 } while (++idx < icplb_nr_bounds);
173
172 if (unlikely(idx == icplb_nr_bounds)) 174 if (unlikely(idx == icplb_nr_bounds))
173 return CPLB_NO_ADDR_MATCH; 175 return CPLB_NO_ADDR_MATCH;
174 176
@@ -208,12 +210,14 @@ MGR_ATTR static int dcplb_miss(int cpu)
208 nr_dcplb_supv_miss[cpu]++; 210 nr_dcplb_supv_miss[cpu]++;
209 211
210 base = 0; 212 base = 0;
211 for (idx = 0; idx < dcplb_nr_bounds; idx++) { 213 idx = 0;
214 do {
212 eaddr = dcplb_bounds[idx].eaddr; 215 eaddr = dcplb_bounds[idx].eaddr;
213 if (addr < eaddr) 216 if (addr < eaddr)
214 break; 217 break;
215 base = eaddr; 218 base = eaddr;
216 } 219 } while (++idx < dcplb_nr_bounds);
220
217 if (unlikely(idx == dcplb_nr_bounds)) 221 if (unlikely(idx == dcplb_nr_bounds))
218 return CPLB_NO_ADDR_MATCH; 222 return CPLB_NO_ADDR_MATCH;
219 223
diff --git a/arch/blackfin/kernel/irqchip.c b/arch/blackfin/kernel/irqchip.c
index ab8209cbbad0..75724eee6494 100644
--- a/arch/blackfin/kernel/irqchip.c
+++ b/arch/blackfin/kernel/irqchip.c
@@ -35,6 +35,7 @@
35#include <linux/interrupt.h> 35#include <linux/interrupt.h>
36#include <linux/irq.h> 36#include <linux/irq.h>
37#include <asm/trace.h> 37#include <asm/trace.h>
38#include <asm/pda.h>
38 39
39static atomic_t irq_err_count; 40static atomic_t irq_err_count;
40static spinlock_t irq_controller_lock; 41static spinlock_t irq_controller_lock;
@@ -91,8 +92,13 @@ int show_interrupts(struct seq_file *p, void *v)
91 seq_putc(p, '\n'); 92 seq_putc(p, '\n');
92 skip: 93 skip:
93 spin_unlock_irqrestore(&irq_desc[i].lock, flags); 94 spin_unlock_irqrestore(&irq_desc[i].lock, flags);
94 } else if (i == NR_IRQS) 95 } else if (i == NR_IRQS) {
96 seq_printf(p, "NMI: ");
97 for_each_online_cpu(j)
98 seq_printf(p, "%10u ", cpu_pda[j].__nmi_count);
99 seq_printf(p, " CORE Non Maskable Interrupt\n");
95 seq_printf(p, "Err: %10u\n", atomic_read(&irq_err_count)); 100 seq_printf(p, "Err: %10u\n", atomic_read(&irq_err_count));
101 }
96 return 0; 102 return 0;
97} 103}
98 104
diff --git a/arch/blackfin/kernel/reboot.c b/arch/blackfin/kernel/reboot.c
index eeee8cb43360..53d08dee8531 100644
--- a/arch/blackfin/kernel/reboot.c
+++ b/arch/blackfin/kernel/reboot.c
@@ -20,8 +20,8 @@
20 * reset while the Core B bit (on dual core parts) is cleared by 20 * reset while the Core B bit (on dual core parts) is cleared by
21 * the core reset. 21 * the core reset.
22 */ 22 */
23__attribute__((l1_text)) 23__attribute__ ((__l1_text__, __noreturn__))
24static void _bfin_reset(void) 24static void bfin_reset(void)
25{ 25{
26 /* Wait for completion of "system" events such as cache line 26 /* Wait for completion of "system" events such as cache line
27 * line fills so that we avoid infinite stalls later on as 27 * line fills so that we avoid infinite stalls later on as
@@ -30,7 +30,11 @@ static void _bfin_reset(void)
30 */ 30 */
31 __builtin_bfin_ssync(); 31 __builtin_bfin_ssync();
32 32
33 while (1) { 33 /* The bootrom checks to see how it was reset and will
34 * automatically perform a software reset for us when
35 * it starts executing after the core reset.
36 */
37 if (ANOMALY_05000353 || ANOMALY_05000386) {
34 /* Initiate System software reset. */ 38 /* Initiate System software reset. */
35 bfin_write_SWRST(0x7); 39 bfin_write_SWRST(0x7);
36 40
@@ -50,6 +54,11 @@ static void _bfin_reset(void)
50 /* Clear System software reset */ 54 /* Clear System software reset */
51 bfin_write_SWRST(0); 55 bfin_write_SWRST(0);
52 56
57 /* The BF526 ROM will crash during reset */
58#if defined(__ADSPBF522__) || defined(__ADSPBF524__) || defined(__ADSPBF526__)
59 bfin_read_SWRST();
60#endif
61
53 /* Wait for the SWRST write to complete. Cannot rely on SSYNC 62 /* Wait for the SWRST write to complete. Cannot rely on SSYNC
54 * though as the System state is all reset now. 63 * though as the System state is all reset now.
55 */ 64 */
@@ -60,22 +69,11 @@ static void _bfin_reset(void)
60 : "a" (15 * 1) 69 : "a" (15 * 1)
61 : "LC1", "LB1", "LT1" 70 : "LC1", "LB1", "LT1"
62 ); 71 );
72 }
63 73
74 while (1)
64 /* Issue core reset */ 75 /* Issue core reset */
65 asm("raise 1"); 76 asm("raise 1");
66 }
67}
68
69static void bfin_reset(void)
70{
71 if (ANOMALY_05000353 || ANOMALY_05000386)
72 _bfin_reset();
73 else
74 /* the bootrom checks to see how it was reset and will
75 * automatically perform a software reset for us when
76 * it starts executing boot
77 */
78 asm("raise 1;");
79} 77}
80 78
81__attribute__((weak)) 79__attribute__((weak))
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index b2a811347b65..e5c116230800 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -60,7 +60,7 @@ void __initdata *init_retx, *init_saved_retx, *init_saved_seqstat,
60#define BFIN_MEMMAP_MAX 128 /* number of entries in bfin_memmap */ 60#define BFIN_MEMMAP_MAX 128 /* number of entries in bfin_memmap */
61#define BFIN_MEMMAP_RAM 1 61#define BFIN_MEMMAP_RAM 1
62#define BFIN_MEMMAP_RESERVED 2 62#define BFIN_MEMMAP_RESERVED 2
63struct bfin_memmap { 63static struct bfin_memmap {
64 int nr_map; 64 int nr_map;
65 struct bfin_memmap_entry { 65 struct bfin_memmap_entry {
66 unsigned long long addr; /* start of memory segment */ 66 unsigned long long addr; /* start of memory segment */
@@ -824,7 +824,15 @@ void __init setup_arch(char **cmdline_p)
824 flash_probe(); 824 flash_probe();
825#endif 825#endif
826 826
827 printk(KERN_INFO "Boot Mode: %i\n", bfin_read_SYSCR() & 0xF);
828
829 /* Newer parts mirror SWRST bits in SYSCR */
830#if defined(CONFIG_BF53x) || defined(CONFIG_BF561) || \
831 defined(CONFIG_BF538) || defined(CONFIG_BF539)
827 _bfin_swrst = bfin_read_SWRST(); 832 _bfin_swrst = bfin_read_SWRST();
833#else
834 _bfin_swrst = bfin_read_SYSCR();
835#endif
828 836
829#ifdef CONFIG_DEBUG_DOUBLEFAULT_PRINT 837#ifdef CONFIG_DEBUG_DOUBLEFAULT_PRINT
830 bfin_write_SWRST(_bfin_swrst & ~DOUBLE_FAULT); 838 bfin_write_SWRST(_bfin_swrst & ~DOUBLE_FAULT);
@@ -853,7 +861,7 @@ void __init setup_arch(char **cmdline_p)
853 else if (_bfin_swrst & RESET_SOFTWARE) 861 else if (_bfin_swrst & RESET_SOFTWARE)
854 printk(KERN_NOTICE "Reset caused by Software reset\n"); 862 printk(KERN_NOTICE "Reset caused by Software reset\n");
855 863
856 printk(KERN_INFO "Blackfin support (C) 2004-2008 Analog Devices, Inc.\n"); 864 printk(KERN_INFO "Blackfin support (C) 2004-2009 Analog Devices, Inc.\n");
857 if (bfin_compiled_revid() == 0xffff) 865 if (bfin_compiled_revid() == 0xffff)
858 printk(KERN_INFO "Compiled for ADSP-%s Rev any\n", CPU); 866 printk(KERN_INFO "Compiled for ADSP-%s Rev any\n", CPU);
859 else if (bfin_compiled_revid() == -1) 867 else if (bfin_compiled_revid() == -1)
diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c
index 5b0667da8d05..ffe7fb53eccb 100644
--- a/arch/blackfin/kernel/traps.c
+++ b/arch/blackfin/kernel/traps.c
@@ -673,6 +673,14 @@ static void decode_instruction(unsigned short *address)
673 verbose_printk("RTI"); 673 verbose_printk("RTI");
674 else if (opcode == 0x0012) 674 else if (opcode == 0x0012)
675 verbose_printk("RTX"); 675 verbose_printk("RTX");
676 else if (opcode == 0x0013)
677 verbose_printk("RTN");
678 else if (opcode == 0x0014)
679 verbose_printk("RTE");
680 else if (opcode == 0x0025)
681 verbose_printk("EMUEXCPT");
682 else if (opcode == 0x0040 && opcode <= 0x0047)
683 verbose_printk("STI R%i", opcode & 7);
676 else if (opcode >= 0x0050 && opcode <= 0x0057) 684 else if (opcode >= 0x0050 && opcode <= 0x0057)
677 verbose_printk("JUMP (P%i)", opcode & 7); 685 verbose_printk("JUMP (P%i)", opcode & 7);
678 else if (opcode >= 0x0060 && opcode <= 0x0067) 686 else if (opcode >= 0x0060 && opcode <= 0x0067)
@@ -681,6 +689,10 @@ static void decode_instruction(unsigned short *address)
681 verbose_printk("CALL (PC+P%i)", opcode & 7); 689 verbose_printk("CALL (PC+P%i)", opcode & 7);
682 else if (opcode >= 0x0080 && opcode <= 0x0087) 690 else if (opcode >= 0x0080 && opcode <= 0x0087)
683 verbose_printk("JUMP (PC+P%i)", opcode & 7); 691 verbose_printk("JUMP (PC+P%i)", opcode & 7);
692 else if (opcode >= 0x0090 && opcode <= 0x009F)
693 verbose_printk("RAISE 0x%x", opcode & 0xF);
694 else if (opcode >= 0x00A0 && opcode <= 0x00AF)
695 verbose_printk("EXCPT 0x%x", opcode & 0xF);
684 else if ((opcode >= 0x1000 && opcode <= 0x13FF) || (opcode >= 0x1800 && opcode <= 0x1BFF)) 696 else if ((opcode >= 0x1000 && opcode <= 0x13FF) || (opcode >= 0x1800 && opcode <= 0x1BFF))
685 verbose_printk("IF !CC JUMP"); 697 verbose_printk("IF !CC JUMP");
686 else if ((opcode >= 0x1400 && opcode <= 0x17ff) || (opcode >= 0x1c00 && opcode <= 0x1fff)) 698 else if ((opcode >= 0x1400 && opcode <= 0x17ff) || (opcode >= 0x1c00 && opcode <= 0x1fff))
@@ -820,11 +832,8 @@ void show_stack(struct task_struct *task, unsigned long *stack)
820 decode_address(buf, (unsigned int)stack); 832 decode_address(buf, (unsigned int)stack);
821 printk(KERN_NOTICE " SP: [0x%p] %s\n", stack, buf); 833 printk(KERN_NOTICE " SP: [0x%p] %s\n", stack, buf);
822 834
823 addr = (unsigned int *)((unsigned int)stack & ~0x3F);
824
825 /* First thing is to look for a frame pointer */ 835 /* First thing is to look for a frame pointer */
826 for (addr = (unsigned int *)((unsigned int)stack & ~0xF), i = 0; 836 for (addr = (unsigned int *)((unsigned int)stack & ~0xF); addr < endstack; addr++) {
827 addr < endstack; addr++, i++) {
828 if (*addr & 0x1) 837 if (*addr & 0x1)
829 continue; 838 continue;
830 ins_addr = (unsigned short *)*addr; 839 ins_addr = (unsigned short *)*addr;
@@ -834,7 +843,8 @@ void show_stack(struct task_struct *task, unsigned long *stack)
834 843
835 if (fp) { 844 if (fp) {
836 /* Let's check to see if it is a frame pointer */ 845 /* Let's check to see if it is a frame pointer */
837 while (fp >= (addr - 1) && fp < endstack && fp) 846 while (fp >= (addr - 1) && fp < endstack
847 && fp && ((unsigned int) fp & 0x3) == 0)
838 fp = (unsigned int *)*fp; 848 fp = (unsigned int *)*fp;
839 if (fp == 0 || fp == endstack) { 849 if (fp == 0 || fp == endstack) {
840 fp = addr - 1; 850 fp = addr - 1;
@@ -1052,8 +1062,9 @@ void show_regs(struct pt_regs *fp)
1052 char buf [150]; 1062 char buf [150];
1053 struct irqaction *action; 1063 struct irqaction *action;
1054 unsigned int i; 1064 unsigned int i;
1055 unsigned long flags; 1065 unsigned long flags = 0;
1056 unsigned int cpu = smp_processor_id(); 1066 unsigned int cpu = smp_processor_id();
1067 unsigned char in_atomic = (bfin_read_IPEND() & 0x10) || in_atomic();
1057 1068
1058 verbose_printk(KERN_NOTICE "\n" KERN_NOTICE "SEQUENCER STATUS:\t\t%s\n", print_tainted()); 1069 verbose_printk(KERN_NOTICE "\n" KERN_NOTICE "SEQUENCER STATUS:\t\t%s\n", print_tainted());
1059 verbose_printk(KERN_NOTICE " SEQSTAT: %08lx IPEND: %04lx SYSCFG: %04lx\n", 1070 verbose_printk(KERN_NOTICE " SEQSTAT: %08lx IPEND: %04lx SYSCFG: %04lx\n",
@@ -1073,17 +1084,22 @@ void show_regs(struct pt_regs *fp)
1073 } 1084 }
1074 verbose_printk(KERN_NOTICE " EXCAUSE : 0x%lx\n", 1085 verbose_printk(KERN_NOTICE " EXCAUSE : 0x%lx\n",
1075 fp->seqstat & SEQSTAT_EXCAUSE); 1086 fp->seqstat & SEQSTAT_EXCAUSE);
1076 for (i = 6; i <= 15 ; i++) { 1087 for (i = 2; i <= 15 ; i++) {
1077 if (fp->ipend & (1 << i)) { 1088 if (fp->ipend & (1 << i)) {
1078 decode_address(buf, bfin_read32(EVT0 + 4*i)); 1089 if (i != 4) {
1079 verbose_printk(KERN_NOTICE " physical IVG%i asserted : %s\n", i, buf); 1090 decode_address(buf, bfin_read32(EVT0 + 4*i));
1091 verbose_printk(KERN_NOTICE " physical IVG%i asserted : %s\n", i, buf);
1092 } else
1093 verbose_printk(KERN_NOTICE " interrupts disabled\n");
1080 } 1094 }
1081 } 1095 }
1082 1096
1083 /* if no interrupts are going off, don't print this out */ 1097 /* if no interrupts are going off, don't print this out */
1084 if (fp->ipend & ~0x3F) { 1098 if (fp->ipend & ~0x3F) {
1085 for (i = 0; i < (NR_IRQS - 1); i++) { 1099 for (i = 0; i < (NR_IRQS - 1); i++) {
1086 spin_lock_irqsave(&irq_desc[i].lock, flags); 1100 if (!in_atomic)
1101 spin_lock_irqsave(&irq_desc[i].lock, flags);
1102
1087 action = irq_desc[i].action; 1103 action = irq_desc[i].action;
1088 if (!action) 1104 if (!action)
1089 goto unlock; 1105 goto unlock;
@@ -1096,7 +1112,8 @@ void show_regs(struct pt_regs *fp)
1096 } 1112 }
1097 verbose_printk("\n"); 1113 verbose_printk("\n");
1098unlock: 1114unlock:
1099 spin_unlock_irqrestore(&irq_desc[i].lock, flags); 1115 if (!in_atomic)
1116 spin_unlock_irqrestore(&irq_desc[i].lock, flags);
1100 } 1117 }
1101 } 1118 }
1102 1119
diff --git a/arch/blackfin/mach-bf518/boards/ezbrd.c b/arch/blackfin/mach-bf518/boards/ezbrd.c
index 15f1351c8645..0e175342112e 100644
--- a/arch/blackfin/mach-bf518/boards/ezbrd.c
+++ b/arch/blackfin/mach-bf518/boards/ezbrd.c
@@ -46,6 +46,7 @@
46#include <asm/dpmc.h> 46#include <asm/dpmc.h>
47#include <asm/bfin_sdh.h> 47#include <asm/bfin_sdh.h>
48#include <linux/spi/ad7877.h> 48#include <linux/spi/ad7877.h>
49#include <net/dsa.h>
49 50
50/* 51/*
51 * Name the Board for the /proc/cpuinfo 52 * Name the Board for the /proc/cpuinfo
@@ -104,8 +105,31 @@ static struct platform_device rtc_device = {
104#endif 105#endif
105 106
106#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) 107#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
108static struct platform_device bfin_mii_bus = {
109 .name = "bfin_mii_bus",
110};
111
107static struct platform_device bfin_mac_device = { 112static struct platform_device bfin_mac_device = {
108 .name = "bfin_mac", 113 .name = "bfin_mac",
114 .dev.platform_data = &bfin_mii_bus,
115};
116#endif
117
118#if defined(CONFIG_NET_DSA_KSZ8893M) || defined(CONFIG_NET_DSA_KSZ8893M_MODULE)
119static struct dsa_platform_data ksz8893m_switch_data = {
120 .mii_bus = &bfin_mii_bus.dev,
121 .netdev = &bfin_mac_device.dev,
122 .port_names[0] = NULL,
123 .port_names[1] = "eth%d",
124 .port_names[2] = "eth%d",
125 .port_names[3] = "cpu",
126};
127
128static struct platform_device ksz8893m_switch_device = {
129 .name = "dsa",
130 .id = 0,
131 .num_resources = 0,
132 .dev.platform_data = &ksz8893m_switch_data,
109}; 133};
110#endif 134#endif
111 135
@@ -147,6 +171,15 @@ static struct bfin5xx_spi_chip spi_adc_chip_info = {
147}; 171};
148#endif 172#endif
149 173
174#if defined(CONFIG_NET_DSA_KSZ8893M) \
175 || defined(CONFIG_NET_DSA_KSZ8893M_MODULE)
176/* SPI SWITCH CHIP */
177static struct bfin5xx_spi_chip spi_switch_info = {
178 .enable_dma = 0,
179 .bits_per_word = 8,
180};
181#endif
182
150#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 183#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
151static struct bfin5xx_spi_chip spi_mmc_chip_info = { 184static struct bfin5xx_spi_chip spi_mmc_chip_info = {
152 .enable_dma = 1, 185 .enable_dma = 1,
@@ -226,6 +259,19 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
226 }, 259 },
227#endif 260#endif
228 261
262#if defined(CONFIG_NET_DSA_KSZ8893M) \
263 || defined(CONFIG_NET_DSA_KSZ8893M_MODULE)
264 {
265 .modalias = "ksz8893m",
266 .max_speed_hz = 5000000,
267 .bus_num = 0,
268 .chip_select = 1,
269 .platform_data = NULL,
270 .controller_data = &spi_switch_info,
271 .mode = SPI_MODE_3,
272 },
273#endif
274
229#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 275#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
230 { 276 {
231 .modalias = "spi_mmc_dummy", 277 .modalias = "spi_mmc_dummy",
@@ -473,7 +519,6 @@ static struct platform_device i2c_bfin_twi_device = {
473}; 519};
474#endif 520#endif
475 521
476#ifdef CONFIG_I2C_BOARDINFO
477static struct i2c_board_info __initdata bfin_i2c_board_info[] = { 522static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
478#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) 523#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
479 { 524 {
@@ -487,7 +532,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
487 }, 532 },
488#endif 533#endif
489}; 534};
490#endif
491 535
492#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) 536#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
493static struct platform_device bfin_sport0_uart_device = { 537static struct platform_device bfin_sport0_uart_device = {
@@ -584,9 +628,14 @@ static struct platform_device *stamp_devices[] __initdata = {
584#endif 628#endif
585 629
586#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) 630#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
631 &bfin_mii_bus,
587 &bfin_mac_device, 632 &bfin_mac_device,
588#endif 633#endif
589 634
635#if defined(CONFIG_NET_DSA_KSZ8893M) || defined(CONFIG_NET_DSA_KSZ8893M_MODULE)
636 &ksz8893m_switch_device,
637#endif
638
590#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) 639#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
591 &bfin_spi0_device, 640 &bfin_spi0_device,
592 &bfin_spi1_device, 641 &bfin_spi1_device,
@@ -632,12 +681,8 @@ static struct platform_device *stamp_devices[] __initdata = {
632static int __init ezbrd_init(void) 681static int __init ezbrd_init(void)
633{ 682{
634 printk(KERN_INFO "%s(): registering device resources\n", __func__); 683 printk(KERN_INFO "%s(): registering device resources\n", __func__);
635
636#ifdef CONFIG_I2C_BOARDINFO
637 i2c_register_board_info(0, bfin_i2c_board_info, 684 i2c_register_board_info(0, bfin_i2c_board_info,
638 ARRAY_SIZE(bfin_i2c_board_info)); 685 ARRAY_SIZE(bfin_i2c_board_info));
639#endif
640
641 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); 686 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
642 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); 687 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
643 return 0; 688 return 0;
@@ -649,7 +694,7 @@ void native_machine_restart(char *cmd)
649{ 694{
650 /* workaround reboot hang when booting from SPI */ 695 /* workaround reboot hang when booting from SPI */
651 if ((bfin_read_SYSCR() & 0x7) == 0x3) 696 if ((bfin_read_SYSCR() & 0x7) == 0x3)
652 bfin_gpio_reset_spi0_ssel1(); 697 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
653} 698}
654 699
655void bfin_get_ether_addr(char *addr) 700void bfin_get_ether_addr(char *addr)
diff --git a/arch/blackfin/mach-bf518/include/mach/portmux.h b/arch/blackfin/mach-bf518/include/mach/portmux.h
index ac16d54734d4..f618b487b2b0 100644
--- a/arch/blackfin/mach-bf518/include/mach/portmux.h
+++ b/arch/blackfin/mach-bf518/include/mach/portmux.h
@@ -103,6 +103,8 @@
103#define P_SPI1_SSEL4 (P_DEFINED | P_IDENT(GPIO_PF8) | P_FUNCT(2)) 103#define P_SPI1_SSEL4 (P_DEFINED | P_IDENT(GPIO_PF8) | P_FUNCT(2))
104#define P_SPI1_SSEL5 (P_DEFINED | P_IDENT(GPIO_PG11) | P_FUNCT(2)) 104#define P_SPI1_SSEL5 (P_DEFINED | P_IDENT(GPIO_PG11) | P_FUNCT(2))
105 105
106#define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL2
107
106/* SPORT Port Mux */ 108/* SPORT Port Mux */
107#define P_SPORT0_DRPRI (P_DEFINED | P_IDENT(GPIO_PG3) | P_FUNCT(0)) 109#define P_SPORT0_DRPRI (P_DEFINED | P_IDENT(GPIO_PG3) | P_FUNCT(0))
108#define P_SPORT0_RSCLK (P_DEFINED | P_IDENT(GPIO_PG4) | P_FUNCT(0)) 110#define P_SPORT0_RSCLK (P_DEFINED | P_IDENT(GPIO_PG4) | P_FUNCT(0))
diff --git a/arch/blackfin/mach-bf527/boards/cm_bf527.c b/arch/blackfin/mach-bf527/boards/cm_bf527.c
index a2c3578f4b6c..856c097b5317 100644
--- a/arch/blackfin/mach-bf527/boards/cm_bf527.c
+++ b/arch/blackfin/mach-bf527/boards/cm_bf527.c
@@ -403,8 +403,13 @@ static struct platform_device isp1362_hcd_device = {
403#endif 403#endif
404 404
405#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) 405#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
406static struct platform_device bfin_mii_bus = {
407 .name = "bfin_mii_bus",
408};
409
406static struct platform_device bfin_mac_device = { 410static struct platform_device bfin_mac_device = {
407 .name = "bfin_mac", 411 .name = "bfin_mac",
412 .dev.platform_data = &bfin_mii_bus,
408}; 413};
409#endif 414#endif
410 415
@@ -793,7 +798,6 @@ static struct platform_device i2c_bfin_twi_device = {
793}; 798};
794#endif 799#endif
795 800
796#ifdef CONFIG_I2C_BOARDINFO
797static struct i2c_board_info __initdata bfin_i2c_board_info[] = { 801static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
798#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) 802#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
799 { 803 {
@@ -809,7 +813,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
809 }, 813 },
810#endif 814#endif
811}; 815};
812#endif
813 816
814#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) 817#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
815static struct platform_device bfin_sport0_uart_device = { 818static struct platform_device bfin_sport0_uart_device = {
@@ -920,6 +923,7 @@ static struct platform_device *stamp_devices[] __initdata = {
920#endif 923#endif
921 924
922#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) 925#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
926 &bfin_mii_bus,
923 &bfin_mac_device, 927 &bfin_mac_device,
924#endif 928#endif
925 929
@@ -968,27 +972,23 @@ static struct platform_device *stamp_devices[] __initdata = {
968 &bfin_gpios_device, 972 &bfin_gpios_device,
969}; 973};
970 974
971static int __init stamp_init(void) 975static int __init cm_init(void)
972{ 976{
973 printk(KERN_INFO "%s(): registering device resources\n", __func__); 977 printk(KERN_INFO "%s(): registering device resources\n", __func__);
974
975#ifdef CONFIG_I2C_BOARDINFO
976 i2c_register_board_info(0, bfin_i2c_board_info, 978 i2c_register_board_info(0, bfin_i2c_board_info,
977 ARRAY_SIZE(bfin_i2c_board_info)); 979 ARRAY_SIZE(bfin_i2c_board_info));
978#endif
979
980 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); 980 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
981 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); 981 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
982 return 0; 982 return 0;
983} 983}
984 984
985arch_initcall(stamp_init); 985arch_initcall(cm_init);
986 986
987void native_machine_restart(char *cmd) 987void native_machine_restart(char *cmd)
988{ 988{
989 /* workaround reboot hang when booting from SPI */ 989 /* workaround reboot hang when booting from SPI */
990 if ((bfin_read_SYSCR() & 0x7) == 0x3) 990 if ((bfin_read_SYSCR() & 0x7) == 0x3)
991 bfin_gpio_reset_spi0_ssel1(); 991 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
992} 992}
993 993
994void bfin_get_ether_addr(char *addr) 994void bfin_get_ether_addr(char *addr)
diff --git a/arch/blackfin/mach-bf527/boards/ezbrd.c b/arch/blackfin/mach-bf527/boards/ezbrd.c
index 0314bd3355eb..83606fcdde27 100644
--- a/arch/blackfin/mach-bf527/boards/ezbrd.c
+++ b/arch/blackfin/mach-bf527/boards/ezbrd.c
@@ -208,8 +208,13 @@ static struct platform_device rtc_device = {
208 208
209 209
210#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) 210#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
211static struct platform_device bfin_mii_bus = {
212 .name = "bfin_mii_bus",
213};
214
211static struct platform_device bfin_mac_device = { 215static struct platform_device bfin_mac_device = {
212 .name = "bfin_mac", 216 .name = "bfin_mac",
217 .dev.platform_data = &bfin_mii_bus,
213}; 218};
214#endif 219#endif
215 220
@@ -590,7 +595,6 @@ static struct platform_device i2c_bfin_twi_device = {
590}; 595};
591#endif 596#endif
592 597
593#ifdef CONFIG_I2C_BOARDINFO
594static struct i2c_board_info __initdata bfin_i2c_board_info[] = { 598static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
595#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) 599#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
596 { 600 {
@@ -604,7 +608,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
604 }, 608 },
605#endif 609#endif
606}; 610};
607#endif
608 611
609#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) 612#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
610static struct platform_device bfin_sport0_uart_device = { 613static struct platform_device bfin_sport0_uart_device = {
@@ -720,6 +723,7 @@ static struct platform_device *stamp_devices[] __initdata = {
720#endif 723#endif
721 724
722#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) 725#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
726 &bfin_mii_bus,
723 &bfin_mac_device, 727 &bfin_mac_device,
724#endif 728#endif
725 729
@@ -764,27 +768,23 @@ static struct platform_device *stamp_devices[] __initdata = {
764 &bfin_gpios_device, 768 &bfin_gpios_device,
765}; 769};
766 770
767static int __init stamp_init(void) 771static int __init ezbrd_init(void)
768{ 772{
769 printk(KERN_INFO "%s(): registering device resources\n", __func__); 773 printk(KERN_INFO "%s(): registering device resources\n", __func__);
770
771#ifdef CONFIG_I2C_BOARDINFO
772 i2c_register_board_info(0, bfin_i2c_board_info, 774 i2c_register_board_info(0, bfin_i2c_board_info,
773 ARRAY_SIZE(bfin_i2c_board_info)); 775 ARRAY_SIZE(bfin_i2c_board_info));
774#endif
775
776 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); 776 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
777 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); 777 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
778 return 0; 778 return 0;
779} 779}
780 780
781arch_initcall(stamp_init); 781arch_initcall(ezbrd_init);
782 782
783void native_machine_restart(char *cmd) 783void native_machine_restart(char *cmd)
784{ 784{
785 /* workaround reboot hang when booting from SPI */ 785 /* workaround reboot hang when booting from SPI */
786 if ((bfin_read_SYSCR() & 0x7) == 0x3) 786 if ((bfin_read_SYSCR() & 0x7) == 0x3)
787 bfin_gpio_reset_spi0_ssel1(); 787 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
788} 788}
789 789
790void bfin_get_ether_addr(char *addr) 790void bfin_get_ether_addr(char *addr)
diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c
index 9454fb7b18c3..d0864111ef59 100644
--- a/arch/blackfin/mach-bf527/boards/ezkit.c
+++ b/arch/blackfin/mach-bf527/boards/ezkit.c
@@ -425,8 +425,13 @@ static struct platform_device isp1362_hcd_device = {
425#endif 425#endif
426 426
427#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) 427#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
428static struct platform_device bfin_mii_bus = {
429 .name = "bfin_mii_bus",
430};
431
428static struct platform_device bfin_mac_device = { 432static struct platform_device bfin_mac_device = {
429 .name = "bfin_mac", 433 .name = "bfin_mac",
434 .dev.platform_data = &bfin_mii_bus,
430}; 435};
431#endif 436#endif
432 437
@@ -830,7 +835,6 @@ static struct platform_device i2c_bfin_twi_device = {
830}; 835};
831#endif 836#endif
832 837
833#ifdef CONFIG_I2C_BOARDINFO
834static struct i2c_board_info __initdata bfin_i2c_board_info[] = { 838static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
835#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) 839#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
836 { 840 {
@@ -844,7 +848,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
844 }, 848 },
845#endif 849#endif
846}; 850};
847#endif
848 851
849#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) 852#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
850static struct platform_device bfin_sport0_uart_device = { 853static struct platform_device bfin_sport0_uart_device = {
@@ -988,6 +991,7 @@ static struct platform_device *stamp_devices[] __initdata = {
988#endif 991#endif
989 992
990#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) 993#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
994 &bfin_mii_bus,
991 &bfin_mac_device, 995 &bfin_mac_device,
992#endif 996#endif
993 997
@@ -1048,27 +1052,23 @@ static struct platform_device *stamp_devices[] __initdata = {
1048 &bfin_gpios_device, 1052 &bfin_gpios_device,
1049}; 1053};
1050 1054
1051static int __init stamp_init(void) 1055static int __init ezkit_init(void)
1052{ 1056{
1053 printk(KERN_INFO "%s(): registering device resources\n", __func__); 1057 printk(KERN_INFO "%s(): registering device resources\n", __func__);
1054
1055#ifdef CONFIG_I2C_BOARDINFO
1056 i2c_register_board_info(0, bfin_i2c_board_info, 1058 i2c_register_board_info(0, bfin_i2c_board_info,
1057 ARRAY_SIZE(bfin_i2c_board_info)); 1059 ARRAY_SIZE(bfin_i2c_board_info));
1058#endif
1059
1060 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); 1060 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
1061 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); 1061 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
1062 return 0; 1062 return 0;
1063} 1063}
1064 1064
1065arch_initcall(stamp_init); 1065arch_initcall(ezkit_init);
1066 1066
1067void native_machine_restart(char *cmd) 1067void native_machine_restart(char *cmd)
1068{ 1068{
1069 /* workaround reboot hang when booting from SPI */ 1069 /* workaround reboot hang when booting from SPI */
1070 if ((bfin_read_SYSCR() & 0x7) == 0x3) 1070 if ((bfin_read_SYSCR() & 0x7) == 0x3)
1071 bfin_gpio_reset_spi0_ssel1(); 1071 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
1072} 1072}
1073 1073
1074void bfin_get_ether_addr(char *addr) 1074void bfin_get_ether_addr(char *addr)
diff --git a/arch/blackfin/mach-bf527/include/mach/portmux.h b/arch/blackfin/mach-bf527/include/mach/portmux.h
index 7f6da2c386bb..72b1652be4da 100644
--- a/arch/blackfin/mach-bf527/include/mach/portmux.h
+++ b/arch/blackfin/mach-bf527/include/mach/portmux.h
@@ -73,6 +73,8 @@
73 73
74#define P_HWAIT (P_DONTCARE) 74#define P_HWAIT (P_DONTCARE)
75 75
76#define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL1
77
76#define P_SPI0_SS (P_DEFINED | P_IDENT(GPIO_PG1) | P_FUNCT(0)) 78#define P_SPI0_SS (P_DEFINED | P_IDENT(GPIO_PG1) | P_FUNCT(0))
77#define P_SPI0_SSEL1 (P_DEFINED | P_IDENT(GPIO_PG1) | P_FUNCT(2)) 79#define P_SPI0_SSEL1 (P_DEFINED | P_IDENT(GPIO_PG1) | P_FUNCT(2))
78#define P_SPI0_SCK (P_DEFINED | P_IDENT(GPIO_PG2) | P_FUNCT(2)) 80#define P_SPI0_SCK (P_DEFINED | P_IDENT(GPIO_PG2) | P_FUNCT(2))
diff --git a/arch/blackfin/mach-bf533/boards/blackstamp.c b/arch/blackfin/mach-bf533/boards/blackstamp.c
index 6ee607c259ac..015c18f85e7f 100644
--- a/arch/blackfin/mach-bf533/boards/blackstamp.c
+++ b/arch/blackfin/mach-bf533/boards/blackstamp.c
@@ -309,10 +309,8 @@ static struct platform_device i2c_gpio_device = {
309}; 309};
310#endif 310#endif
311 311
312#ifdef CONFIG_I2C_BOARDINFO
313static struct i2c_board_info __initdata bfin_i2c_board_info[] = { 312static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
314}; 313};
315#endif
316 314
317static const unsigned int cclk_vlev_datasheet[] = 315static const unsigned int cclk_vlev_datasheet[] =
318{ 316{
@@ -390,10 +388,8 @@ static int __init blackstamp_init(void)
390 388
391 printk(KERN_INFO "%s(): registering device resources\n", __func__); 389 printk(KERN_INFO "%s(): registering device resources\n", __func__);
392 390
393#ifdef CONFIG_I2C_BOARDINFO
394 i2c_register_board_info(0, bfin_i2c_board_info, 391 i2c_register_board_info(0, bfin_i2c_board_info,
395 ARRAY_SIZE(bfin_i2c_board_info)); 392 ARRAY_SIZE(bfin_i2c_board_info));
396#endif
397 393
398 ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); 394 ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
399 if (ret < 0) 395 if (ret < 0)
diff --git a/arch/blackfin/mach-bf533/boards/stamp.c b/arch/blackfin/mach-bf533/boards/stamp.c
index 07f9ad1e189c..db96f33f72e2 100644
--- a/arch/blackfin/mach-bf533/boards/stamp.c
+++ b/arch/blackfin/mach-bf533/boards/stamp.c
@@ -441,7 +441,6 @@ static struct platform_device i2c_gpio_device = {
441}; 441};
442#endif 442#endif
443 443
444#ifdef CONFIG_I2C_BOARDINFO
445static struct i2c_board_info __initdata bfin_i2c_board_info[] = { 444static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
446#if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE) 445#if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
447 { 446 {
@@ -461,7 +460,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
461 }, 460 },
462#endif 461#endif
463}; 462};
464#endif
465 463
466static const unsigned int cclk_vlev_datasheet[] = 464static const unsigned int cclk_vlev_datasheet[] =
467{ 465{
@@ -550,10 +548,8 @@ static int __init stamp_init(void)
550 548
551 printk(KERN_INFO "%s(): registering device resources\n", __func__); 549 printk(KERN_INFO "%s(): registering device resources\n", __func__);
552 550
553#ifdef CONFIG_I2C_BOARDINFO
554 i2c_register_board_info(0, bfin_i2c_board_info, 551 i2c_register_board_info(0, bfin_i2c_board_info,
555 ARRAY_SIZE(bfin_i2c_board_info)); 552 ARRAY_SIZE(bfin_i2c_board_info));
556#endif
557 553
558 ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); 554 ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
559 if (ret < 0) 555 if (ret < 0)
diff --git a/arch/blackfin/mach-bf533/include/mach/portmux.h b/arch/blackfin/mach-bf533/include/mach/portmux.h
index 685a2651dcda..2f59ce0b0cb5 100644
--- a/arch/blackfin/mach-bf533/include/mach/portmux.h
+++ b/arch/blackfin/mach-bf533/include/mach/portmux.h
@@ -54,14 +54,11 @@
54#define P_SPI0_SSEL2 (P_DEFINED | P_IDENT(GPIO_PF2)) 54#define P_SPI0_SSEL2 (P_DEFINED | P_IDENT(GPIO_PF2))
55#define P_SPI0_SSEL1 (P_DEFINED | P_IDENT(GPIO_PF1)) 55#define P_SPI0_SSEL1 (P_DEFINED | P_IDENT(GPIO_PF1))
56#define P_SPI0_SS (P_DEFINED | P_IDENT(GPIO_PF0)) 56#define P_SPI0_SS (P_DEFINED | P_IDENT(GPIO_PF0))
57#define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL2
57 58
58#define P_TMR2 (P_DONTCARE) 59#define P_TMR2 (P_DONTCARE)
59#define P_TMR1 (P_DONTCARE) 60#define P_TMR1 (P_DONTCARE)
60#define P_TMR0 (P_DONTCARE) 61#define P_TMR0 (P_DONTCARE)
61#define P_TMRCLK (P_DEFINED | P_IDENT(GPIO_PF1)) 62#define P_TMRCLK (P_DEFINED | P_IDENT(GPIO_PF1))
62 63
63
64
65
66
67#endif /* _MACH_PORTMUX_H_ */ 64#endif /* _MACH_PORTMUX_H_ */
diff --git a/arch/blackfin/mach-bf537/boards/cm_bf537.c b/arch/blackfin/mach-bf537/boards/cm_bf537.c
index 6ac8e4d5bd38..9cd8fb2a30d3 100644
--- a/arch/blackfin/mach-bf537/boards/cm_bf537.c
+++ b/arch/blackfin/mach-bf537/boards/cm_bf537.c
@@ -479,8 +479,13 @@ static struct platform_device bfin_sport1_uart_device = {
479#endif 479#endif
480 480
481#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) 481#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
482static struct platform_device bfin_mii_bus = {
483 .name = "bfin_mii_bus",
484};
485
482static struct platform_device bfin_mac_device = { 486static struct platform_device bfin_mac_device = {
483 .name = "bfin_mac", 487 .name = "bfin_mac",
488 .dev.platform_data = &bfin_mii_bus,
484}; 489};
485#endif 490#endif
486 491
@@ -591,6 +596,7 @@ static struct platform_device *cm_bf537_devices[] __initdata = {
591#endif 596#endif
592 597
593#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) 598#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
599 &bfin_mii_bus,
594 &bfin_mac_device, 600 &bfin_mac_device,
595#endif 601#endif
596 602
diff --git a/arch/blackfin/mach-bf537/boards/generic_board.c b/arch/blackfin/mach-bf537/boards/generic_board.c
index dd6e6bfb98ea..da710fdc4569 100644
--- a/arch/blackfin/mach-bf537/boards/generic_board.c
+++ b/arch/blackfin/mach-bf537/boards/generic_board.c
@@ -262,8 +262,13 @@ static struct platform_device isp1362_hcd_device = {
262#endif 262#endif
263 263
264#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) 264#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
265static struct platform_device bfin_mii_bus = {
266 .name = "bfin_mii_bus",
267};
268
265static struct platform_device bfin_mac_device = { 269static struct platform_device bfin_mac_device = {
266 .name = "bfin_mac", 270 .name = "bfin_mac",
271 .dev.platform_data = &bfin_mii_bus,
267}; 272};
268#endif 273#endif
269 274
@@ -662,6 +667,7 @@ static struct platform_device *stamp_devices[] __initdata = {
662#endif 667#endif
663 668
664#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) 669#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
670 &bfin_mii_bus,
665 &bfin_mac_device, 671 &bfin_mac_device,
666#endif 672#endif
667 673
@@ -708,7 +714,7 @@ static struct platform_device *stamp_devices[] __initdata = {
708#endif 714#endif
709}; 715};
710 716
711static int __init stamp_init(void) 717static int __init generic_init(void)
712{ 718{
713 printk(KERN_INFO "%s(): registering device resources\n", __func__); 719 printk(KERN_INFO "%s(): registering device resources\n", __func__);
714 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); 720 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
@@ -720,13 +726,13 @@ static int __init stamp_init(void)
720 return 0; 726 return 0;
721} 727}
722 728
723arch_initcall(stamp_init); 729arch_initcall(generic_init);
724 730
725void native_machine_restart(char *cmd) 731void native_machine_restart(char *cmd)
726{ 732{
727 /* workaround reboot hang when booting from SPI */ 733 /* workaround reboot hang when booting from SPI */
728 if ((bfin_read_SYSCR() & 0x7) == 0x3) 734 if ((bfin_read_SYSCR() & 0x7) == 0x3)
729 bfin_gpio_reset_spi0_ssel1(); 735 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
730} 736}
731 737
732#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) 738#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
diff --git a/arch/blackfin/mach-bf537/boards/minotaur.c b/arch/blackfin/mach-bf537/boards/minotaur.c
index bb795341cb17..db7d3a385e4b 100644
--- a/arch/blackfin/mach-bf537/boards/minotaur.c
+++ b/arch/blackfin/mach-bf537/boards/minotaur.c
@@ -61,8 +61,13 @@ static struct platform_device rtc_device = {
61#endif 61#endif
62 62
63#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) 63#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
64static struct platform_device bfin_mii_bus = {
65 .name = "bfin_mii_bus",
66};
67
64static struct platform_device bfin_mac_device = { 68static struct platform_device bfin_mac_device = {
65 .name = "bfin_mac", 69 .name = "bfin_mac",
70 .dev.platform_data = &bfin_mii_bus,
66}; 71};
67#endif 72#endif
68 73
@@ -324,6 +329,7 @@ static struct platform_device *minotaur_devices[] __initdata = {
324#endif 329#endif
325 330
326#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) 331#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
332 &bfin_mii_bus,
327 &bfin_mac_device, 333 &bfin_mac_device,
328#endif 334#endif
329 335
@@ -377,5 +383,5 @@ void native_machine_restart(char *cmd)
377{ 383{
378 /* workaround reboot hang when booting from SPI */ 384 /* workaround reboot hang when booting from SPI */
379 if ((bfin_read_SYSCR() & 0x7) == 0x3) 385 if ((bfin_read_SYSCR() & 0x7) == 0x3)
380 bfin_gpio_reset_spi0_ssel1(); 386 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
381} 387}
diff --git a/arch/blackfin/mach-bf537/boards/pnav10.c b/arch/blackfin/mach-bf537/boards/pnav10.c
index 89de94f4545d..590eb3a139b7 100644
--- a/arch/blackfin/mach-bf537/boards/pnav10.c
+++ b/arch/blackfin/mach-bf537/boards/pnav10.c
@@ -198,8 +198,13 @@ static struct platform_device isp1362_hcd_device = {
198#endif 198#endif
199 199
200#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) 200#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
201static struct platform_device bfin_mii_bus = {
202 .name = "bfin_mii_bus",
203};
204
201static struct platform_device bfin_mac_device = { 205static struct platform_device bfin_mac_device = {
202 .name = "bfin_mac", 206 .name = "bfin_mac",
207 .dev.platform_data = &bfin_mii_bus,
203}; 208};
204#endif 209#endif
205 210
@@ -529,6 +534,7 @@ static struct platform_device *stamp_devices[] __initdata = {
529#endif 534#endif
530 535
531#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) 536#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
537 &bfin_mii_bus,
532 &bfin_mac_device, 538 &bfin_mac_device,
533#endif 539#endif
534 540
@@ -558,7 +564,7 @@ static struct platform_device *stamp_devices[] __initdata = {
558#endif 564#endif
559}; 565};
560 566
561static int __init stamp_init(void) 567static int __init pnav_init(void)
562{ 568{
563 printk(KERN_INFO "%s(): registering device resources\n", __func__); 569 printk(KERN_INFO "%s(): registering device resources\n", __func__);
564 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); 570 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
@@ -569,7 +575,7 @@ static int __init stamp_init(void)
569 return 0; 575 return 0;
570} 576}
571 577
572arch_initcall(stamp_init); 578arch_initcall(pnav_init);
573 579
574void bfin_get_ether_addr(char *addr) 580void bfin_get_ether_addr(char *addr)
575{ 581{
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c
index d812e2514a2f..cd04c5e44878 100644
--- a/arch/blackfin/mach-bf537/boards/stamp.c
+++ b/arch/blackfin/mach-bf537/boards/stamp.c
@@ -321,8 +321,13 @@ static struct platform_device isp1362_hcd_device = {
321#endif 321#endif
322 322
323#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) 323#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
324static struct platform_device bfin_mii_bus = {
325 .name = "bfin_mii_bus",
326};
327
324static struct platform_device bfin_mac_device = { 328static struct platform_device bfin_mac_device = {
325 .name = "bfin_mac", 329 .name = "bfin_mac",
330 .dev.platform_data = &bfin_mii_bus,
326}; 331};
327#endif 332#endif
328 333
@@ -1068,7 +1073,6 @@ static struct adp5588_kpad_platform_data adp5588_kpad_data = {
1068}; 1073};
1069#endif 1074#endif
1070 1075
1071#ifdef CONFIG_I2C_BOARDINFO
1072static struct i2c_board_info __initdata bfin_i2c_board_info[] = { 1076static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
1073#if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE) 1077#if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
1074 { 1078 {
@@ -1102,7 +1106,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
1102 }, 1106 },
1103#endif 1107#endif
1104}; 1108};
1105#endif
1106 1109
1107#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) 1110#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1108static struct platform_device bfin_sport0_uart_device = { 1111static struct platform_device bfin_sport0_uart_device = {
@@ -1217,6 +1220,7 @@ static struct platform_device *stamp_devices[] __initdata = {
1217#endif 1220#endif
1218 1221
1219#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) 1222#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
1223 &bfin_mii_bus,
1220 &bfin_mac_device, 1224 &bfin_mac_device,
1221#endif 1225#endif
1222 1226
@@ -1284,12 +1288,8 @@ static struct platform_device *stamp_devices[] __initdata = {
1284static int __init stamp_init(void) 1288static int __init stamp_init(void)
1285{ 1289{
1286 printk(KERN_INFO "%s(): registering device resources\n", __func__); 1290 printk(KERN_INFO "%s(): registering device resources\n", __func__);
1287
1288#ifdef CONFIG_I2C_BOARDINFO
1289 i2c_register_board_info(0, bfin_i2c_board_info, 1291 i2c_register_board_info(0, bfin_i2c_board_info,
1290 ARRAY_SIZE(bfin_i2c_board_info)); 1292 ARRAY_SIZE(bfin_i2c_board_info));
1291#endif
1292
1293 bfin_plat_nand_init(); 1293 bfin_plat_nand_init();
1294 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); 1294 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
1295 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); 1295 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
@@ -1307,7 +1307,7 @@ void native_machine_restart(char *cmd)
1307{ 1307{
1308 /* workaround reboot hang when booting from SPI */ 1308 /* workaround reboot hang when booting from SPI */
1309 if ((bfin_read_SYSCR() & 0x7) == 0x3) 1309 if ((bfin_read_SYSCR() & 0x7) == 0x3)
1310 bfin_gpio_reset_spi0_ssel1(); 1310 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
1311} 1311}
1312 1312
1313/* 1313/*
diff --git a/arch/blackfin/mach-bf537/boards/tcm_bf537.c b/arch/blackfin/mach-bf537/boards/tcm_bf537.c
index 2f4b066153c5..3f4f203a06ec 100644
--- a/arch/blackfin/mach-bf537/boards/tcm_bf537.c
+++ b/arch/blackfin/mach-bf537/boards/tcm_bf537.c
@@ -481,8 +481,13 @@ static struct platform_device bfin_sport1_uart_device = {
481#endif 481#endif
482 482
483#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) 483#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
484static struct platform_device bfin_mii_bus = {
485 .name = "bfin_mii_bus",
486};
487
484static struct platform_device bfin_mac_device = { 488static struct platform_device bfin_mac_device = {
485 .name = "bfin_mac", 489 .name = "bfin_mac",
490 .dev.platform_data = &bfin_mii_bus,
486}; 491};
487#endif 492#endif
488 493
@@ -593,6 +598,7 @@ static struct platform_device *cm_bf537_devices[] __initdata = {
593#endif 598#endif
594 599
595#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) 600#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
601 &bfin_mii_bus,
596 &bfin_mac_device, 602 &bfin_mac_device,
597#endif 603#endif
598 604
@@ -615,7 +621,7 @@ static struct platform_device *cm_bf537_devices[] __initdata = {
615 &bfin_gpios_device, 621 &bfin_gpios_device,
616}; 622};
617 623
618static int __init cm_bf537_init(void) 624static int __init tcm_bf537_init(void)
619{ 625{
620 printk(KERN_INFO "%s(): registering device resources\n", __func__); 626 printk(KERN_INFO "%s(): registering device resources\n", __func__);
621 platform_add_devices(cm_bf537_devices, ARRAY_SIZE(cm_bf537_devices)); 627 platform_add_devices(cm_bf537_devices, ARRAY_SIZE(cm_bf537_devices));
@@ -629,7 +635,7 @@ static int __init cm_bf537_init(void)
629 return 0; 635 return 0;
630} 636}
631 637
632arch_initcall(cm_bf537_init); 638arch_initcall(tcm_bf537_init);
633 639
634void bfin_get_ether_addr(char *addr) 640void bfin_get_ether_addr(char *addr)
635{ 641{
diff --git a/arch/blackfin/mach-bf537/include/mach/portmux.h b/arch/blackfin/mach-bf537/include/mach/portmux.h
index 78fee6e0f237..87285e75e903 100644
--- a/arch/blackfin/mach-bf537/include/mach/portmux.h
+++ b/arch/blackfin/mach-bf537/include/mach/portmux.h
@@ -31,6 +31,7 @@
31#define P_PPI0_FS1 (P_DEFINED | P_IDENT(GPIO_PF9) | P_FUNCT(1)) 31#define P_PPI0_FS1 (P_DEFINED | P_IDENT(GPIO_PF9) | P_FUNCT(1))
32#define P_TACLK0 (P_DEFINED | P_IDENT(GPIO_PF14) | P_FUNCT(1)) 32#define P_TACLK0 (P_DEFINED | P_IDENT(GPIO_PF14) | P_FUNCT(1))
33#define P_TMRCLK (P_DEFINED | P_IDENT(GPIO_PF15) | P_FUNCT(1)) 33#define P_TMRCLK (P_DEFINED | P_IDENT(GPIO_PF15) | P_FUNCT(1))
34#define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL1
34 35
35#define P_PPI0_D0 (P_DEFINED | P_IDENT(GPIO_PG0) | P_FUNCT(0)) 36#define P_PPI0_D0 (P_DEFINED | P_IDENT(GPIO_PG0) | P_FUNCT(0))
36#define P_PPI0_D1 (P_DEFINED | P_IDENT(GPIO_PG1) | P_FUNCT(0)) 37#define P_PPI0_D1 (P_DEFINED | P_IDENT(GPIO_PG1) | P_FUNCT(0))
diff --git a/arch/blackfin/mach-bf538/include/mach/portmux.h b/arch/blackfin/mach-bf538/include/mach/portmux.h
index 1e031b588b47..c8db264e3e4d 100644
--- a/arch/blackfin/mach-bf538/include/mach/portmux.h
+++ b/arch/blackfin/mach-bf538/include/mach/portmux.h
@@ -102,5 +102,6 @@
102#define P_SPI0_SSEL2 (P_DEFINED | P_IDENT(GPIO_PF2)) 102#define P_SPI0_SSEL2 (P_DEFINED | P_IDENT(GPIO_PF2))
103#define P_SPI0_SSEL1 (P_DEFINED | P_IDENT(GPIO_PF1)) 103#define P_SPI0_SSEL1 (P_DEFINED | P_IDENT(GPIO_PF1))
104#define P_SPI0_SS (P_DEFINED | P_IDENT(GPIO_PF0)) 104#define P_SPI0_SS (P_DEFINED | P_IDENT(GPIO_PF0))
105#define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL2
105 106
106#endif /* _MACH_PORTMUX_H_ */ 107#endif /* _MACH_PORTMUX_H_ */
diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c
index 309c16014cae..096e661700a7 100644
--- a/arch/blackfin/mach-bf548/boards/ezkit.c
+++ b/arch/blackfin/mach-bf548/boards/ezkit.c
@@ -781,7 +781,6 @@ static struct platform_device i2c_bfin_twi1_device = {
781#endif 781#endif
782#endif 782#endif
783 783
784#ifdef CONFIG_I2C_BOARDINFO
785static struct i2c_board_info __initdata bfin_i2c_board_info0[] = { 784static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
786}; 785};
787 786
@@ -800,7 +799,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
800#endif 799#endif
801}; 800};
802#endif 801#endif
803#endif
804 802
805#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) 803#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
806#include <linux/gpio_keys.h> 804#include <linux/gpio_keys.h>
@@ -956,14 +954,12 @@ static int __init ezkit_init(void)
956{ 954{
957 printk(KERN_INFO "%s(): registering device resources\n", __func__); 955 printk(KERN_INFO "%s(): registering device resources\n", __func__);
958 956
959#ifdef CONFIG_I2C_BOARDINFO
960 i2c_register_board_info(0, bfin_i2c_board_info0, 957 i2c_register_board_info(0, bfin_i2c_board_info0,
961 ARRAY_SIZE(bfin_i2c_board_info0)); 958 ARRAY_SIZE(bfin_i2c_board_info0));
962#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */ 959#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
963 i2c_register_board_info(1, bfin_i2c_board_info1, 960 i2c_register_board_info(1, bfin_i2c_board_info1,
964 ARRAY_SIZE(bfin_i2c_board_info1)); 961 ARRAY_SIZE(bfin_i2c_board_info1));
965#endif 962#endif
966#endif
967 963
968 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices)); 964 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
969 965
diff --git a/arch/blackfin/mach-bf548/include/mach/anomaly.h b/arch/blackfin/mach-bf548/include/mach/anomaly.h
index 3b5430999f4f..23d03c52f4b4 100644
--- a/arch/blackfin/mach-bf548/include/mach/anomaly.h
+++ b/arch/blackfin/mach-bf548/include/mach/anomaly.h
@@ -175,6 +175,7 @@
175#define ANOMALY_05000311 (0) 175#define ANOMALY_05000311 (0)
176#define ANOMALY_05000323 (0) 176#define ANOMALY_05000323 (0)
177#define ANOMALY_05000363 (0) 177#define ANOMALY_05000363 (0)
178#define ANOMALY_05000380 (0)
178#define ANOMALY_05000412 (0) 179#define ANOMALY_05000412 (0)
179#define ANOMALY_05000432 (0) 180#define ANOMALY_05000432 (0)
180#define ANOMALY_05000435 (0) 181#define ANOMALY_05000435 (0)
diff --git a/arch/blackfin/mach-bf548/include/mach/bf548.h b/arch/blackfin/mach-bf548/include/mach/bf548.h
index f0e569984810..cd31f72bdd82 100644
--- a/arch/blackfin/mach-bf548/include/mach/bf548.h
+++ b/arch/blackfin/mach-bf548/include/mach/bf548.h
@@ -104,6 +104,18 @@
104 104
105#define AMGCTLVAL (V_AMBEN | V_AMCKEN) 105#define AMGCTLVAL (V_AMBEN | V_AMCKEN)
106 106
107#if defined(CONFIG_BF542M)
108# define CONFIG_BF542
109#elif defined(CONFIG_BF544M)
110# define CONFIG_BF544
111#elif defined(CONFIG_BF547M)
112# define CONFIG_BF547
113#elif defined(CONFIG_BF548M)
114# define CONFIG_BF548
115#elif defined(CONFIG_BF549M)
116# define CONFIG_BF549
117#endif
118
107#if defined(CONFIG_BF542) 119#if defined(CONFIG_BF542)
108# define CPU "BF542" 120# define CPU "BF542"
109# define CPUID 0x27de 121# define CPUID 0x27de
diff --git a/arch/blackfin/mach-bf548/include/mach/gpio.h b/arch/blackfin/mach-bf548/include/mach/gpio.h
index bba82dc75f16..3a2051709787 100644
--- a/arch/blackfin/mach-bf548/include/mach/gpio.h
+++ b/arch/blackfin/mach-bf548/include/mach/gpio.h
@@ -195,17 +195,17 @@
195struct gpio_port_t { 195struct gpio_port_t {
196 unsigned short port_fer; 196 unsigned short port_fer;
197 unsigned short dummy1; 197 unsigned short dummy1;
198 unsigned short port_data; 198 unsigned short data;
199 unsigned short dummy2; 199 unsigned short dummy2;
200 unsigned short port_set; 200 unsigned short data_set;
201 unsigned short dummy3; 201 unsigned short dummy3;
202 unsigned short port_clear; 202 unsigned short data_clear;
203 unsigned short dummy4; 203 unsigned short dummy4;
204 unsigned short port_dir_set; 204 unsigned short dir_set;
205 unsigned short dummy5; 205 unsigned short dummy5;
206 unsigned short port_dir_clear; 206 unsigned short dir_clear;
207 unsigned short dummy6; 207 unsigned short dummy6;
208 unsigned short port_inen; 208 unsigned short inen;
209 unsigned short dummy7; 209 unsigned short dummy7;
210 unsigned int port_mux; 210 unsigned int port_mux;
211}; 211};
diff --git a/arch/blackfin/mach-bf548/include/mach/portmux.h b/arch/blackfin/mach-bf548/include/mach/portmux.h
index 8177a567dcdb..ffb1d0a44b4d 100644
--- a/arch/blackfin/mach-bf548/include/mach/portmux.h
+++ b/arch/blackfin/mach-bf548/include/mach/portmux.h
@@ -125,6 +125,7 @@
125#define P_KEY_COL2 (P_DEFINED | P_IDENT(GPIO_PD14) | P_FUNCT(3)) 125#define P_KEY_COL2 (P_DEFINED | P_IDENT(GPIO_PD14) | P_FUNCT(3))
126#define P_KEY_COL3 (P_DEFINED | P_IDENT(GPIO_PD15) | P_FUNCT(3)) 126#define P_KEY_COL3 (P_DEFINED | P_IDENT(GPIO_PD15) | P_FUNCT(3))
127 127
128#define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL1
128#define P_SPI0_SCK (P_DEFINED | P_IDENT(GPIO_PE0) | P_FUNCT(0)) 129#define P_SPI0_SCK (P_DEFINED | P_IDENT(GPIO_PE0) | P_FUNCT(0))
129#define P_SPI0_MISO (P_DEFINED | P_IDENT(GPIO_PE1) | P_FUNCT(0)) 130#define P_SPI0_MISO (P_DEFINED | P_IDENT(GPIO_PE1) | P_FUNCT(0))
130#define P_SPI0_MOSI (P_DEFINED | P_IDENT(GPIO_PE2) | P_FUNCT(0)) 131#define P_SPI0_MOSI (P_DEFINED | P_IDENT(GPIO_PE2) | P_FUNCT(0))
diff --git a/arch/blackfin/mach-bf561/include/mach/defBF561.h b/arch/blackfin/mach-bf561/include/mach/defBF561.h
index d7c509759659..cf922295f4ce 100644
--- a/arch/blackfin/mach-bf561/include/mach/defBF561.h
+++ b/arch/blackfin/mach-bf561/include/mach/defBF561.h
@@ -1106,6 +1106,8 @@
1106#define DLEN_8 0x0 /* PPI Data Length mask for DLEN=8 */ 1106#define DLEN_8 0x0 /* PPI Data Length mask for DLEN=8 */
1107#define DLEN(x) (((x-9) & 0x07) << 11) /* PPI Data Length (only works for x=10-->x=16) */ 1107#define DLEN(x) (((x-9) & 0x07) << 11) /* PPI Data Length (only works for x=10-->x=16) */
1108#define POL 0x0000C000 /* PPI Signal Polarities */ 1108#define POL 0x0000C000 /* PPI Signal Polarities */
1109#define POLC 0x4000 /* PPI Clock Polarity */
1110#define POLS 0x8000 /* PPI Frame Sync Polarity */
1109 1111
1110/* PPI_STATUS Masks */ 1112/* PPI_STATUS Masks */
1111#define FLD 0x00000400 /* Field Indicator */ 1113#define FLD 0x00000400 /* Field Indicator */
diff --git a/arch/blackfin/mach-bf561/include/mach/portmux.h b/arch/blackfin/mach-bf561/include/mach/portmux.h
index a6ee8206efb6..2e5ad6347dea 100644
--- a/arch/blackfin/mach-bf561/include/mach/portmux.h
+++ b/arch/blackfin/mach-bf561/include/mach/portmux.h
@@ -85,5 +85,6 @@
85#define P_SPI0_MOSI (P_DONTCARE) 85#define P_SPI0_MOSI (P_DONTCARE)
86#define P_SPI0_MISO (P_DONTCARE) 86#define P_SPI0_MISO (P_DONTCARE)
87#define P_SPI0_SCK (P_DONTCARE) 87#define P_SPI0_SCK (P_DONTCARE)
88#define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL2
88 89
89#endif /* _MACH_PORTMUX_H_ */ 90#endif /* _MACH_PORTMUX_H_ */
diff --git a/arch/blackfin/mach-common/clocks-init.c b/arch/blackfin/mach-common/clocks-init.c
index 5d182abefc7b..9dddb6f8cc85 100644
--- a/arch/blackfin/mach-common/clocks-init.c
+++ b/arch/blackfin/mach-common/clocks-init.c
@@ -14,6 +14,7 @@
14#include <asm/clocks.h> 14#include <asm/clocks.h>
15#include <asm/mem_init.h> 15#include <asm/mem_init.h>
16 16
17#define SDGCTL_WIDTH (1 << 31) /* SDRAM external data path width */
17#define PLL_CTL_VAL \ 18#define PLL_CTL_VAL \
18 (((CONFIG_VCO_MULT & 63) << 9) | CLKIN_HALF | \ 19 (((CONFIG_VCO_MULT & 63) << 9) | CLKIN_HALF | \
19 (PLL_BYPASS << 8) | (ANOMALY_05000265 ? 0x8000 : 0)) 20 (PLL_BYPASS << 8) | (ANOMALY_05000265 ? 0x8000 : 0))
@@ -76,7 +77,7 @@ void init_clocks(void)
76 bfin_write_PLL_DIV(CONFIG_CCLK_ACT_DIV | CONFIG_SCLK_DIV); 77 bfin_write_PLL_DIV(CONFIG_CCLK_ACT_DIV | CONFIG_SCLK_DIV);
77#ifdef EBIU_SDGCTL 78#ifdef EBIU_SDGCTL
78 bfin_write_EBIU_SDRRC(mem_SDRRC); 79 bfin_write_EBIU_SDRRC(mem_SDRRC);
79 bfin_write_EBIU_SDGCTL(mem_SDGCTL); 80 bfin_write_EBIU_SDGCTL((bfin_read_EBIU_SDGCTL() & SDGCTL_WIDTH) | mem_SDGCTL);
80#else 81#else
81 bfin_write_EBIU_RSTCTL(bfin_read_EBIU_RSTCTL() & ~(SRREQ)); 82 bfin_write_EBIU_RSTCTL(bfin_read_EBIU_RSTCTL() & ~(SRREQ));
82 do_sync(); 83 do_sync();
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S
index fae774651374..88de053bbe8e 100644
--- a/arch/blackfin/mach-common/entry.S
+++ b/arch/blackfin/mach-common/entry.S
@@ -151,13 +151,6 @@ ENTRY(_ex_syscall)
151 jump.s _bfin_return_from_exception; 151 jump.s _bfin_return_from_exception;
152ENDPROC(_ex_syscall) 152ENDPROC(_ex_syscall)
153 153
154ENTRY(_ex_soft_bp)
155 r7 = retx;
156 r7 += -2;
157 retx = r7;
158 jump.s _ex_trap_c;
159ENDPROC(_ex_soft_bp)
160
161ENTRY(_ex_single_step) 154ENTRY(_ex_single_step)
162 /* If we just returned from an interrupt, the single step event is 155 /* If we just returned from an interrupt, the single step event is
163 for the RTI instruction. */ 156 for the RTI instruction. */
@@ -1087,7 +1080,7 @@ ENTRY(_ex_table)
1087 * EXCPT instruction can provide 4 bits of EXCAUSE, allowing 16 to be user defined 1080 * EXCPT instruction can provide 4 bits of EXCAUSE, allowing 16 to be user defined
1088 */ 1081 */
1089 .long _ex_syscall /* 0x00 - User Defined - Linux Syscall */ 1082 .long _ex_syscall /* 0x00 - User Defined - Linux Syscall */
1090 .long _ex_soft_bp /* 0x01 - User Defined - Software breakpoint */ 1083 .long _ex_trap_c /* 0x01 - User Defined - Software breakpoint */
1091#ifdef CONFIG_KGDB 1084#ifdef CONFIG_KGDB
1092 .long _ex_trap_c /* 0x02 - User Defined - KGDB initial connection 1085 .long _ex_trap_c /* 0x02 - User Defined - KGDB initial connection
1093 and break signal trap */ 1086 and break signal trap */
diff --git a/arch/blackfin/mach-common/head.S b/arch/blackfin/mach-common/head.S
index e1e42c029e15..698d4c05947e 100644
--- a/arch/blackfin/mach-common/head.S
+++ b/arch/blackfin/mach-common/head.S
@@ -17,6 +17,19 @@
17 17
18__INIT 18__INIT
19 19
20ENTRY(__init_clear_bss)
21 r2 = r2 - r1;
22 cc = r2 == 0;
23 if cc jump .L_bss_done;
24 r2 >>= 2;
25 p1 = r1;
26 p2 = r2;
27 lsetup (1f, 1f) lc0 = p2;
281: [p1++] = r0;
29.L_bss_done:
30 rts;
31ENDPROC(__init_clear_bss)
32
20#define INITIAL_STACK (L1_SCRATCH_START + L1_SCRATCH_LENGTH - 12) 33#define INITIAL_STACK (L1_SCRATCH_START + L1_SCRATCH_LENGTH - 12)
21 34
22ENTRY(__start) 35ENTRY(__start)
@@ -144,6 +157,35 @@ ENTRY(__start)
144 call _init_early_exception_vectors; 157 call _init_early_exception_vectors;
145#endif 158#endif
146 159
160 r0 = 0 (x);
161 /* Zero out all of the fun bss regions */
162#if L1_DATA_A_LENGTH > 0
163 r1.l = __sbss_l1;
164 r1.h = __sbss_l1;
165 r2.l = __ebss_l1;
166 r2.h = __ebss_l1;
167 call __init_clear_bss
168#endif
169#if L1_DATA_B_LENGTH > 0
170 r1.l = __sbss_b_l1;
171 r1.h = __sbss_b_l1;
172 r2.l = __ebss_b_l1;
173 r2.h = __ebss_b_l1;
174 call __init_clear_bss
175#endif
176#if L2_LENGTH > 0
177 r1.l = __sbss_l2;
178 r1.h = __sbss_l2;
179 r2.l = __ebss_l2;
180 r2.h = __ebss_l2;
181 call __init_clear_bss
182#endif
183 r1.l = ___bss_start;
184 r1.h = ___bss_start;
185 r2.l = ___bss_stop;
186 r2.h = ___bss_stop;
187 call __init_clear_bss
188
147 /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */ 189 /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */
148 call _bfin_relocate_l1_mem; 190 call _bfin_relocate_l1_mem;
149#ifdef CONFIG_BFIN_KERNEL_CLOCK 191#ifdef CONFIG_BFIN_KERNEL_CLOCK
@@ -185,19 +227,6 @@ ENDPROC(__start)
185# define WDOG_CTL WDOGA_CTL 227# define WDOG_CTL WDOGA_CTL
186#endif 228#endif
187 229
188ENTRY(__init_clear_bss)
189 r2 = r2 - r1;
190 cc = r2 == 0;
191 if cc jump .L_bss_done;
192 r2 >>= 2;
193 p1 = r1;
194 p2 = r2;
195 lsetup (1f, 1f) lc0 = p2;
1961: [p1++] = r0;
197.L_bss_done:
198 rts;
199ENDPROC(__init_clear_bss)
200
201ENTRY(_real_start) 230ENTRY(_real_start)
202 /* Enable nested interrupts */ 231 /* Enable nested interrupts */
203 [--sp] = reti; 232 [--sp] = reti;
@@ -209,35 +238,6 @@ ENTRY(_real_start)
209 w[p0] = r0; 238 w[p0] = r0;
210 ssync; 239 ssync;
211 240
212 r0 = 0 (x);
213 /* Zero out all of the fun bss regions */
214#if L1_DATA_A_LENGTH > 0
215 r1.l = __sbss_l1;
216 r1.h = __sbss_l1;
217 r2.l = __ebss_l1;
218 r2.h = __ebss_l1;
219 call __init_clear_bss
220#endif
221#if L1_DATA_B_LENGTH > 0
222 r1.l = __sbss_b_l1;
223 r1.h = __sbss_b_l1;
224 r2.l = __ebss_b_l1;
225 r2.h = __ebss_b_l1;
226 call __init_clear_bss
227#endif
228#if L2_LENGTH > 0
229 r1.l = __sbss_l2;
230 r1.h = __sbss_l2;
231 r2.l = __ebss_l2;
232 r2.h = __ebss_l2;
233 call __init_clear_bss
234#endif
235 r1.l = ___bss_start;
236 r1.h = ___bss_start;
237 r2.l = ___bss_stop;
238 r2.h = ___bss_stop;
239 call __init_clear_bss
240
241 /* Pass the u-boot arguments to the global value command line */ 241 /* Pass the u-boot arguments to the global value command line */
242 R0 = R7; 242 R0 = R7;
243 call _cmdline_init; 243 call _cmdline_init;
diff --git a/arch/blackfin/mach-common/interrupt.S b/arch/blackfin/mach-common/interrupt.S
index 473df0f7fa78..43c4eb9acb65 100644
--- a/arch/blackfin/mach-common/interrupt.S
+++ b/arch/blackfin/mach-common/interrupt.S
@@ -195,7 +195,7 @@ ENDPROC(_evt_ivhw)
195/* Interrupt routine for evt2 (NMI). 195/* Interrupt routine for evt2 (NMI).
196 * We don't actually use this, so just return. 196 * We don't actually use this, so just return.
197 * For inner circle type details, please see: 197 * For inner circle type details, please see:
198 * http://docs.blackfin.uclinux.org/doku.php?id=linux:nmi 198 * http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:nmi
199 */ 199 */
200ENTRY(_evt_nmi) 200ENTRY(_evt_nmi)
201.weak _evt_nmi 201.weak _evt_nmi
diff --git a/arch/blackfin/mach-common/ints-priority.c b/arch/blackfin/mach-common/ints-priority.c
index 1bba6030dce9..202494568c6c 100644
--- a/arch/blackfin/mach-common/ints-priority.c
+++ b/arch/blackfin/mach-common/ints-priority.c
@@ -1101,10 +1101,9 @@ int __init init_arch_irq(void)
1101 IMASK_IVG14 | IMASK_IVG13 | IMASK_IVG12 | IMASK_IVG11 | 1101 IMASK_IVG14 | IMASK_IVG13 | IMASK_IVG12 | IMASK_IVG11 |
1102 IMASK_IVG10 | IMASK_IVG9 | IMASK_IVG8 | IMASK_IVG7 | IMASK_IVGHW; 1102 IMASK_IVG10 | IMASK_IVG9 | IMASK_IVG8 | IMASK_IVG7 | IMASK_IVGHW;
1103 1103
1104#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561) \ 1104#ifdef SIC_IWR0
1105 || defined(BF538_FAMILY) || defined(CONFIG_BF51x)
1106 bfin_write_SIC_IWR0(IWR_DISABLE_ALL); 1105 bfin_write_SIC_IWR0(IWR_DISABLE_ALL);
1107#if defined(CONFIG_BF52x) || defined(CONFIG_BF51x) 1106# ifdef SIC_IWR1
1108 /* BF52x/BF51x system reset does not properly reset SIC_IWR1 which 1107 /* BF52x/BF51x system reset does not properly reset SIC_IWR1 which
1109 * will screw up the bootrom as it relies on MDMA0/1 waking it 1108 * will screw up the bootrom as it relies on MDMA0/1 waking it
1110 * up from IDLE instructions. See this report for more info: 1109 * up from IDLE instructions. See this report for more info:
@@ -1114,10 +1113,8 @@ int __init init_arch_irq(void)
1114 bfin_write_SIC_IWR1(IWR_ENABLE(10) | IWR_ENABLE(11)); 1113 bfin_write_SIC_IWR1(IWR_ENABLE(10) | IWR_ENABLE(11));
1115 else 1114 else
1116 bfin_write_SIC_IWR1(IWR_DISABLE_ALL); 1115 bfin_write_SIC_IWR1(IWR_DISABLE_ALL);
1117#else 1116# endif
1118 bfin_write_SIC_IWR1(IWR_DISABLE_ALL); 1117# ifdef SIC_IWR2
1119#endif
1120# ifdef CONFIG_BF54x
1121 bfin_write_SIC_IWR2(IWR_DISABLE_ALL); 1118 bfin_write_SIC_IWR2(IWR_DISABLE_ALL);
1122# endif 1119# endif
1123#else 1120#else
diff --git a/arch/blackfin/mach-common/pm.c b/arch/blackfin/mach-common/pm.c
index d3d70fd67c16..f48a6aebb49b 100644
--- a/arch/blackfin/mach-common/pm.c
+++ b/arch/blackfin/mach-common/pm.c
@@ -82,10 +82,9 @@ void bfin_pm_suspend_standby_enter(void)
82 82
83 bfin_pm_standby_restore(); 83 bfin_pm_standby_restore();
84 84
85#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561) || \ 85#ifdef SIC_IWR0
86 defined(CONFIG_BF538) || defined(CONFIG_BF539) || defined(CONFIG_BF51x)
87 bfin_write_SIC_IWR0(IWR_DISABLE_ALL); 86 bfin_write_SIC_IWR0(IWR_DISABLE_ALL);
88#if defined(CONFIG_BF52x) || defined(CONFIG_BF51x) 87# ifdef SIC_IWR1
89 /* BF52x system reset does not properly reset SIC_IWR1 which 88 /* BF52x system reset does not properly reset SIC_IWR1 which
90 * will screw up the bootrom as it relies on MDMA0/1 waking it 89 * will screw up the bootrom as it relies on MDMA0/1 waking it
91 * up from IDLE instructions. See this report for more info: 90 * up from IDLE instructions. See this report for more info:
@@ -95,10 +94,8 @@ void bfin_pm_suspend_standby_enter(void)
95 bfin_write_SIC_IWR1(IWR_ENABLE(10) | IWR_ENABLE(11)); 94 bfin_write_SIC_IWR1(IWR_ENABLE(10) | IWR_ENABLE(11));
96 else 95 else
97 bfin_write_SIC_IWR1(IWR_DISABLE_ALL); 96 bfin_write_SIC_IWR1(IWR_DISABLE_ALL);
98#else 97# endif
99 bfin_write_SIC_IWR1(IWR_DISABLE_ALL); 98# ifdef SIC_IWR2
100#endif
101# ifdef CONFIG_BF54x
102 bfin_write_SIC_IWR2(IWR_DISABLE_ALL); 99 bfin_write_SIC_IWR2(IWR_DISABLE_ALL);
103# endif 100# endif
104#else 101#else
diff --git a/arch/sparc/include/asm/cpudata_64.h b/arch/sparc/include/asm/cpudata_64.h
index 7da7c13d23c4..a11b89ee9ef8 100644
--- a/arch/sparc/include/asm/cpudata_64.h
+++ b/arch/sparc/include/asm/cpudata_64.h
@@ -17,7 +17,7 @@
17typedef struct { 17typedef struct {
18 /* Dcache line 1 */ 18 /* Dcache line 1 */
19 unsigned int __softirq_pending; /* must be 1st, see rtrap.S */ 19 unsigned int __softirq_pending; /* must be 1st, see rtrap.S */
20 unsigned int __pad0; 20 unsigned int __nmi_count;
21 unsigned long clock_tick; /* %tick's per second */ 21 unsigned long clock_tick; /* %tick's per second */
22 unsigned long __pad; 22 unsigned long __pad;
23 unsigned int __pad1; 23 unsigned int __pad1;
diff --git a/arch/sparc/include/asm/irq_64.h b/arch/sparc/include/asm/irq_64.h
index d47d4a1955a9..1934f2cbf513 100644
--- a/arch/sparc/include/asm/irq_64.h
+++ b/arch/sparc/include/asm/irq_64.h
@@ -66,9 +66,6 @@ extern void virt_irq_free(unsigned int virt_irq);
66extern void __init init_IRQ(void); 66extern void __init init_IRQ(void);
67extern void fixup_irqs(void); 67extern void fixup_irqs(void);
68 68
69extern int register_perfctr_intr(void (*handler)(struct pt_regs *));
70extern void release_perfctr_intr(void (*handler)(struct pt_regs *));
71
72static inline void set_softint(unsigned long bits) 69static inline void set_softint(unsigned long bits)
73{ 70{
74 __asm__ __volatile__("wr %0, 0x0, %%set_softint" 71 __asm__ __volatile__("wr %0, 0x0, %%set_softint"
@@ -98,5 +95,6 @@ void __trigger_all_cpu_backtrace(void);
98extern void *hardirq_stack[NR_CPUS]; 95extern void *hardirq_stack[NR_CPUS];
99extern void *softirq_stack[NR_CPUS]; 96extern void *softirq_stack[NR_CPUS];
100#define __ARCH_HAS_DO_SOFTIRQ 97#define __ARCH_HAS_DO_SOFTIRQ
98#define ARCH_HAS_NMI_WATCHDOG
101 99
102#endif 100#endif
diff --git a/arch/sparc/include/asm/kdebug_64.h b/arch/sparc/include/asm/kdebug_64.h
index f905b773235a..feb3578e12c4 100644
--- a/arch/sparc/include/asm/kdebug_64.h
+++ b/arch/sparc/include/asm/kdebug_64.h
@@ -14,6 +14,8 @@ enum die_val {
14 DIE_TRAP, 14 DIE_TRAP,
15 DIE_TRAP_TL1, 15 DIE_TRAP_TL1,
16 DIE_CALL, 16 DIE_CALL,
17 DIE_NMI,
18 DIE_NMIWATCHDOG,
17}; 19};
18 20
19#endif 21#endif
diff --git a/arch/sparc/include/asm/nmi.h b/arch/sparc/include/asm/nmi.h
new file mode 100644
index 000000000000..fbd546dd4feb
--- /dev/null
+++ b/arch/sparc/include/asm/nmi.h
@@ -0,0 +1,10 @@
1#ifndef __NMI_H
2#define __NMI_H
3
4extern int __init nmi_init(void);
5extern void perfctr_irq(int irq, struct pt_regs *regs);
6extern void nmi_adjust_hz(unsigned int new_hz);
7
8extern int nmi_usable;
9
10#endif /* __NMI_H */
diff --git a/arch/sparc/include/asm/pcr.h b/arch/sparc/include/asm/pcr.h
new file mode 100644
index 000000000000..a2f5c61f924e
--- /dev/null
+++ b/arch/sparc/include/asm/pcr.h
@@ -0,0 +1,46 @@
1#ifndef __PCR_H
2#define __PCR_H
3
4struct pcr_ops {
5 u64 (*read)(void);
6 void (*write)(u64);
7};
8extern const struct pcr_ops *pcr_ops;
9
10extern void deferred_pcr_work_irq(int irq, struct pt_regs *regs);
11extern void schedule_deferred_pcr_work(void);
12
13#define PCR_PIC_PRIV 0x00000001 /* PIC access is privileged */
14#define PCR_STRACE 0x00000002 /* Trace supervisor events */
15#define PCR_UTRACE 0x00000004 /* Trace user events */
16#define PCR_N2_HTRACE 0x00000008 /* Trace hypervisor events */
17#define PCR_N2_TOE_OV0 0x00000010 /* Trap if PIC 0 overflows */
18#define PCR_N2_TOE_OV1 0x00000020 /* Trap if PIC 1 overflows */
19#define PCR_N2_MASK0 0x00003fc0
20#define PCR_N2_MASK0_SHIFT 6
21#define PCR_N2_SL0 0x0003c000
22#define PCR_N2_SL0_SHIFT 14
23#define PCR_N2_OV0 0x00040000
24#define PCR_N2_MASK1 0x07f80000
25#define PCR_N2_MASK1_SHIFT 19
26#define PCR_N2_SL1 0x78000000
27#define PCR_N2_SL1_SHIFT 27
28#define PCR_N2_OV1 0x80000000
29
30extern unsigned int picl_shift;
31
32/* In order to commonize as much of the implementation as
33 * possible, we use PICH as our counter. Mostly this is
34 * to accomodate Niagara-1 which can only count insn cycles
35 * in PICH.
36 */
37static inline u64 picl_value(unsigned int nmi_hz)
38{
39 u32 delta = local_cpu_data().clock_tick / (nmi_hz << picl_shift);
40
41 return ((u64)((0 - delta) & 0xffffffff)) << 32;
42}
43
44extern u64 pcr_enable;
45
46#endif /* __PCR_H */
diff --git a/arch/sparc/include/asm/pil.h b/arch/sparc/include/asm/pil.h
index d573820c0ff4..32a7efe76d00 100644
--- a/arch/sparc/include/asm/pil.h
+++ b/arch/sparc/include/asm/pil.h
@@ -23,6 +23,7 @@
23#define PIL_SMP_CTX_NEW_VERSION 4 23#define PIL_SMP_CTX_NEW_VERSION 4
24#define PIL_DEVICE_IRQ 5 24#define PIL_DEVICE_IRQ 5
25#define PIL_SMP_CALL_FUNC_SNGL 6 25#define PIL_SMP_CALL_FUNC_SNGL 6
26#define PIL_DEFERRED_PCR_WORK 7
26#define PIL_NORMAL_MAX 14 27#define PIL_NORMAL_MAX 14
27#define PIL_NMI 15 28#define PIL_NMI 15
28 29
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index 53adcaa0348b..54742e58831c 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -52,6 +52,8 @@ obj-$(CONFIG_SPARC64) += visemul.o
52obj-$(CONFIG_SPARC64) += hvapi.o 52obj-$(CONFIG_SPARC64) += hvapi.o
53obj-$(CONFIG_SPARC64) += sstate.o 53obj-$(CONFIG_SPARC64) += sstate.o
54obj-$(CONFIG_SPARC64) += mdesc.o 54obj-$(CONFIG_SPARC64) += mdesc.o
55obj-$(CONFIG_SPARC64) += pcr.o
56obj-$(CONFIG_SPARC64) += nmi.o
55 57
56# sparc32 do not use GENERIC_HARDIRQS but uses the generic devres implementation 58# sparc32 do not use GENERIC_HARDIRQS but uses the generic devres implementation
57obj-$(CONFIG_SPARC32) += devres.o 59obj-$(CONFIG_SPARC32) += devres.o
diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c
index 32d32b4824f5..d85c3dc4953a 100644
--- a/arch/sparc/kernel/cpu.c
+++ b/arch/sparc/kernel/cpu.c
@@ -26,6 +26,7 @@ EXPORT_PER_CPU_SYMBOL(__cpu_data);
26struct cpu_info { 26struct cpu_info {
27 int psr_vers; 27 int psr_vers;
28 const char *name; 28 const char *name;
29 const char *pmu_name;
29}; 30};
30 31
31struct fpu_info { 32struct fpu_info {
@@ -45,6 +46,9 @@ struct manufacturer_info {
45#define CPU(ver, _name) \ 46#define CPU(ver, _name) \
46{ .psr_vers = ver, .name = _name } 47{ .psr_vers = ver, .name = _name }
47 48
49#define CPU_PMU(ver, _name, _pmu_name) \
50{ .psr_vers = ver, .name = _name, .pmu_name = _pmu_name }
51
48#define FPU(ver, _name) \ 52#define FPU(ver, _name) \
49{ .fp_vers = ver, .name = _name } 53{ .fp_vers = ver, .name = _name }
50 54
@@ -183,10 +187,10 @@ static const struct manufacturer_info __initconst manufacturer_info[] = {
183},{ 187},{
184 0x17, 188 0x17,
185 .cpu_info = { 189 .cpu_info = {
186 CPU(0x10, "TI UltraSparc I (SpitFire)"), 190 CPU_PMU(0x10, "TI UltraSparc I (SpitFire)", "ultra12"),
187 CPU(0x11, "TI UltraSparc II (BlackBird)"), 191 CPU_PMU(0x11, "TI UltraSparc II (BlackBird)", "ultra12"),
188 CPU(0x12, "TI UltraSparc IIi (Sabre)"), 192 CPU_PMU(0x12, "TI UltraSparc IIi (Sabre)", "ultra12"),
189 CPU(0x13, "TI UltraSparc IIe (Hummingbird)"), 193 CPU_PMU(0x13, "TI UltraSparc IIe (Hummingbird)", "ultra12"),
190 CPU(-1, NULL) 194 CPU(-1, NULL)
191 }, 195 },
192 .fpu_info = { 196 .fpu_info = {
@@ -199,7 +203,7 @@ static const struct manufacturer_info __initconst manufacturer_info[] = {
199},{ 203},{
200 0x22, 204 0x22,
201 .cpu_info = { 205 .cpu_info = {
202 CPU(0x10, "TI UltraSparc I (SpitFire)"), 206 CPU_PMU(0x10, "TI UltraSparc I (SpitFire)", "ultra12"),
203 CPU(-1, NULL) 207 CPU(-1, NULL)
204 }, 208 },
205 .fpu_info = { 209 .fpu_info = {
@@ -209,12 +213,12 @@ static const struct manufacturer_info __initconst manufacturer_info[] = {
209},{ 213},{
210 0x3e, 214 0x3e,
211 .cpu_info = { 215 .cpu_info = {
212 CPU(0x14, "TI UltraSparc III (Cheetah)"), 216 CPU_PMU(0x14, "TI UltraSparc III (Cheetah)", "ultra3"),
213 CPU(0x15, "TI UltraSparc III+ (Cheetah+)"), 217 CPU_PMU(0x15, "TI UltraSparc III+ (Cheetah+)", "ultra3+"),
214 CPU(0x16, "TI UltraSparc IIIi (Jalapeno)"), 218 CPU_PMU(0x16, "TI UltraSparc IIIi (Jalapeno)", "ultra3i"),
215 CPU(0x18, "TI UltraSparc IV (Jaguar)"), 219 CPU_PMU(0x18, "TI UltraSparc IV (Jaguar)", "ultra3+"),
216 CPU(0x19, "TI UltraSparc IV+ (Panther)"), 220 CPU_PMU(0x19, "TI UltraSparc IV+ (Panther)", "ultra4+"),
217 CPU(0x22, "TI UltraSparc IIIi+ (Serrano)"), 221 CPU_PMU(0x22, "TI UltraSparc IIIi+ (Serrano)", "ultra3i"),
218 CPU(-1, NULL) 222 CPU(-1, NULL)
219 }, 223 },
220 .fpu_info = { 224 .fpu_info = {
@@ -234,6 +238,7 @@ static const struct manufacturer_info __initconst manufacturer_info[] = {
234 238
235const char *sparc_cpu_type; 239const char *sparc_cpu_type;
236const char *sparc_fpu_type; 240const char *sparc_fpu_type;
241const char *sparc_pmu_type;
237 242
238unsigned int fsr_storage; 243unsigned int fsr_storage;
239 244
@@ -244,6 +249,7 @@ static void set_cpu_and_fpu(int psr_impl, int psr_vers, int fpu_vers)
244 249
245 sparc_cpu_type = NULL; 250 sparc_cpu_type = NULL;
246 sparc_fpu_type = NULL; 251 sparc_fpu_type = NULL;
252 sparc_pmu_type = NULL;
247 manuf = NULL; 253 manuf = NULL;
248 254
249 for (i = 0; i < ARRAY_SIZE(manufacturer_info); i++) 255 for (i = 0; i < ARRAY_SIZE(manufacturer_info); i++)
@@ -263,6 +269,7 @@ static void set_cpu_and_fpu(int psr_impl, int psr_vers, int fpu_vers)
263 { 269 {
264 if (cpu->psr_vers == psr_vers) { 270 if (cpu->psr_vers == psr_vers) {
265 sparc_cpu_type = cpu->name; 271 sparc_cpu_type = cpu->name;
272 sparc_pmu_type = cpu->pmu_name;
266 sparc_fpu_type = "No FPU"; 273 sparc_fpu_type = "No FPU";
267 break; 274 break;
268 } 275 }
@@ -290,6 +297,8 @@ static void set_cpu_and_fpu(int psr_impl, int psr_vers, int fpu_vers)
290 psr_impl, fpu_vers); 297 psr_impl, fpu_vers);
291 sparc_fpu_type = "Unknown FPU"; 298 sparc_fpu_type = "Unknown FPU";
292 } 299 }
300 if (sparc_pmu_type == NULL)
301 sparc_pmu_type = "Unknown PMU";
293} 302}
294 303
295#ifdef CONFIG_SPARC32 304#ifdef CONFIG_SPARC32
@@ -315,11 +324,13 @@ static void __init sun4v_cpu_probe(void)
315 case SUN4V_CHIP_NIAGARA1: 324 case SUN4V_CHIP_NIAGARA1:
316 sparc_cpu_type = "UltraSparc T1 (Niagara)"; 325 sparc_cpu_type = "UltraSparc T1 (Niagara)";
317 sparc_fpu_type = "UltraSparc T1 integrated FPU"; 326 sparc_fpu_type = "UltraSparc T1 integrated FPU";
327 sparc_pmu_type = "niagara";
318 break; 328 break;
319 329
320 case SUN4V_CHIP_NIAGARA2: 330 case SUN4V_CHIP_NIAGARA2:
321 sparc_cpu_type = "UltraSparc T2 (Niagara2)"; 331 sparc_cpu_type = "UltraSparc T2 (Niagara2)";
322 sparc_fpu_type = "UltraSparc T2 integrated FPU"; 332 sparc_fpu_type = "UltraSparc T2 integrated FPU";
333 sparc_pmu_type = "niagara2";
323 break; 334 break;
324 335
325 default: 336 default:
diff --git a/arch/sparc/kernel/irq_64.c b/arch/sparc/kernel/irq_64.c
index cab8e0286871..e289376198eb 100644
--- a/arch/sparc/kernel/irq_64.c
+++ b/arch/sparc/kernel/irq_64.c
@@ -196,6 +196,11 @@ int show_interrupts(struct seq_file *p, void *v)
196 seq_putc(p, '\n'); 196 seq_putc(p, '\n');
197skip: 197skip:
198 spin_unlock_irqrestore(&irq_desc[i].lock, flags); 198 spin_unlock_irqrestore(&irq_desc[i].lock, flags);
199 } else if (i == NR_IRQS) {
200 seq_printf(p, "NMI: ");
201 for_each_online_cpu(j)
202 seq_printf(p, "%10u ", cpu_data(j).__nmi_count);
203 seq_printf(p, " Non-maskable interrupts\n");
199 } 204 }
200 return 0; 205 return 0;
201} 206}
@@ -778,69 +783,6 @@ void do_softirq(void)
778 local_irq_restore(flags); 783 local_irq_restore(flags);
779} 784}
780 785
781static void unhandled_perf_irq(struct pt_regs *regs)
782{
783 unsigned long pcr, pic;
784
785 read_pcr(pcr);
786 read_pic(pic);
787
788 write_pcr(0);
789
790 printk(KERN_EMERG "CPU %d: Got unexpected perf counter IRQ.\n",
791 smp_processor_id());
792 printk(KERN_EMERG "CPU %d: PCR[%016lx] PIC[%016lx]\n",
793 smp_processor_id(), pcr, pic);
794}
795
796/* Almost a direct copy of the powerpc PMC code. */
797static DEFINE_SPINLOCK(perf_irq_lock);
798static void *perf_irq_owner_caller; /* mostly for debugging */
799static void (*perf_irq)(struct pt_regs *regs) = unhandled_perf_irq;
800
801/* Invoked from level 15 PIL handler in trap table. */
802void perfctr_irq(int irq, struct pt_regs *regs)
803{
804 clear_softint(1 << irq);
805 perf_irq(regs);
806}
807
808int register_perfctr_intr(void (*handler)(struct pt_regs *))
809{
810 int ret;
811
812 if (!handler)
813 return -EINVAL;
814
815 spin_lock(&perf_irq_lock);
816 if (perf_irq != unhandled_perf_irq) {
817 printk(KERN_WARNING "register_perfctr_intr: "
818 "perf IRQ busy (reserved by caller %p)\n",
819 perf_irq_owner_caller);
820 ret = -EBUSY;
821 goto out;
822 }
823
824 perf_irq_owner_caller = __builtin_return_address(0);
825 perf_irq = handler;
826
827 ret = 0;
828out:
829 spin_unlock(&perf_irq_lock);
830
831 return ret;
832}
833EXPORT_SYMBOL_GPL(register_perfctr_intr);
834
835void release_perfctr_intr(void (*handler)(struct pt_regs *))
836{
837 spin_lock(&perf_irq_lock);
838 perf_irq_owner_caller = NULL;
839 perf_irq = unhandled_perf_irq;
840 spin_unlock(&perf_irq_lock);
841}
842EXPORT_SYMBOL_GPL(release_perfctr_intr);
843
844#ifdef CONFIG_HOTPLUG_CPU 786#ifdef CONFIG_HOTPLUG_CPU
845void fixup_irqs(void) 787void fixup_irqs(void)
846{ 788{
diff --git a/arch/sparc/kernel/kernel.h b/arch/sparc/kernel/kernel.h
index 81a972e8d8ea..15d8a3f645c9 100644
--- a/arch/sparc/kernel/kernel.h
+++ b/arch/sparc/kernel/kernel.h
@@ -5,6 +5,7 @@
5 5
6/* cpu.c */ 6/* cpu.c */
7extern const char *sparc_cpu_type; 7extern const char *sparc_cpu_type;
8extern const char *sparc_pmu_type;
8extern const char *sparc_fpu_type; 9extern const char *sparc_fpu_type;
9 10
10extern unsigned int fsr_storage; 11extern unsigned int fsr_storage;
diff --git a/arch/sparc/kernel/nmi.c b/arch/sparc/kernel/nmi.c
new file mode 100644
index 000000000000..09f088ed4a64
--- /dev/null
+++ b/arch/sparc/kernel/nmi.c
@@ -0,0 +1,224 @@
1/* Pseudo NMI support on sparc64 systems.
2 *
3 * Copyright (C) 2009 David S. Miller <davem@davemloft.net>
4 *
5 * The NMI watchdog support and infrastructure is based almost
6 * entirely upon the x86 NMI support code.
7 */
8#include <linux/kernel.h>
9#include <linux/param.h>
10#include <linux/init.h>
11#include <linux/percpu.h>
12#include <linux/nmi.h>
13#include <linux/module.h>
14#include <linux/kprobes.h>
15#include <linux/kernel_stat.h>
16#include <linux/slab.h>
17#include <linux/kdebug.h>
18#include <linux/delay.h>
19#include <linux/smp.h>
20
21#include <asm/ptrace.h>
22#include <asm/local.h>
23#include <asm/pcr.h>
24
25/* We don't have a real NMI on sparc64, but we can fake one
26 * up using profiling counter overflow interrupts and interrupt
27 * levels.
28 *
29 * The profile overflow interrupts at level 15, so we use
30 * level 14 as our IRQ off level.
31 */
32
33static int nmi_watchdog_active;
34static int panic_on_timeout;
35
36int nmi_usable;
37EXPORT_SYMBOL_GPL(nmi_usable);
38
39static unsigned int nmi_hz = HZ;
40
41static DEFINE_PER_CPU(unsigned int, last_irq_sum);
42static DEFINE_PER_CPU(local_t, alert_counter);
43static DEFINE_PER_CPU(int, nmi_touch);
44
45void touch_nmi_watchdog(void)
46{
47 if (nmi_watchdog_active) {
48 int cpu;
49
50 for_each_present_cpu(cpu) {
51 if (per_cpu(nmi_touch, cpu) != 1)
52 per_cpu(nmi_touch, cpu) = 1;
53 }
54 }
55
56 touch_softlockup_watchdog();
57}
58EXPORT_SYMBOL(touch_nmi_watchdog);
59
60static void die_nmi(const char *str, struct pt_regs *regs, int do_panic)
61{
62 if (notify_die(DIE_NMIWATCHDOG, str, regs, 0,
63 pt_regs_trap_type(regs), SIGINT) == NOTIFY_STOP)
64 return;
65
66 console_verbose();
67 bust_spinlocks(1);
68
69 printk(KERN_EMERG "%s", str);
70 printk(" on CPU%d, ip %08lx, registers:\n",
71 smp_processor_id(), regs->tpc);
72 show_regs(regs);
73
74 bust_spinlocks(0);
75
76 if (do_panic || panic_on_oops)
77 panic("Non maskable interrupt");
78
79 local_irq_enable();
80 do_exit(SIGBUS);
81}
82
83notrace __kprobes void perfctr_irq(int irq, struct pt_regs *regs)
84{
85 unsigned int sum, touched = 0;
86 int cpu = smp_processor_id();
87
88 clear_softint(1 << irq);
89 pcr_ops->write(PCR_PIC_PRIV);
90
91 local_cpu_data().__nmi_count++;
92
93 if (notify_die(DIE_NMI, "nmi", regs, 0,
94 pt_regs_trap_type(regs), SIGINT) == NOTIFY_STOP)
95 touched = 1;
96
97 sum = kstat_irqs_cpu(0, cpu);
98 if (__get_cpu_var(nmi_touch)) {
99 __get_cpu_var(nmi_touch) = 0;
100 touched = 1;
101 }
102 if (!touched && __get_cpu_var(last_irq_sum) == sum) {
103 local_inc(&__get_cpu_var(alert_counter));
104 if (local_read(&__get_cpu_var(alert_counter)) == 5 * nmi_hz)
105 die_nmi("BUG: NMI Watchdog detected LOCKUP",
106 regs, panic_on_timeout);
107 } else {
108 __get_cpu_var(last_irq_sum) = sum;
109 local_set(&__get_cpu_var(alert_counter), 0);
110 }
111 if (nmi_usable) {
112 write_pic(picl_value(nmi_hz));
113 pcr_ops->write(pcr_enable);
114 }
115}
116
117static inline unsigned int get_nmi_count(int cpu)
118{
119 return cpu_data(cpu).__nmi_count;
120}
121
122static int endflag __initdata;
123
124static __init void nmi_cpu_busy(void *data)
125{
126 local_irq_enable_in_hardirq();
127 while (endflag == 0)
128 mb();
129}
130
131static void report_broken_nmi(int cpu, int *prev_nmi_count)
132{
133 printk(KERN_CONT "\n");
134
135 printk(KERN_WARNING
136 "WARNING: CPU#%d: NMI appears to be stuck (%d->%d)!\n",
137 cpu, prev_nmi_count[cpu], get_nmi_count(cpu));
138
139 printk(KERN_WARNING
140 "Please report this to bugzilla.kernel.org,\n");
141 printk(KERN_WARNING
142 "and attach the output of the 'dmesg' command.\n");
143
144 nmi_usable = 0;
145}
146
147static void stop_watchdog(void *unused)
148{
149 pcr_ops->write(PCR_PIC_PRIV);
150}
151
152static int __init check_nmi_watchdog(void)
153{
154 unsigned int *prev_nmi_count;
155 int cpu, err;
156
157 prev_nmi_count = kmalloc(nr_cpu_ids * sizeof(unsigned int), GFP_KERNEL);
158 if (!prev_nmi_count) {
159 err = -ENOMEM;
160 goto error;
161 }
162
163 printk(KERN_INFO "Testing NMI watchdog ... ");
164
165 smp_call_function(nmi_cpu_busy, (void *)&endflag, 0);
166
167 for_each_possible_cpu(cpu)
168 prev_nmi_count[cpu] = get_nmi_count(cpu);
169 local_irq_enable();
170 mdelay((20 * 1000) / nmi_hz); /* wait 20 ticks */
171
172 for_each_online_cpu(cpu) {
173 if (get_nmi_count(cpu) - prev_nmi_count[cpu] <= 5)
174 report_broken_nmi(cpu, prev_nmi_count);
175 }
176 endflag = 1;
177 if (!nmi_usable) {
178 kfree(prev_nmi_count);
179 err = -ENODEV;
180 goto error;
181 }
182 printk("OK.\n");
183
184 nmi_hz = 1;
185
186 kfree(prev_nmi_count);
187 return 0;
188error:
189 on_each_cpu(stop_watchdog, NULL, 1);
190 return err;
191}
192
193static void start_watchdog(void *unused)
194{
195 pcr_ops->write(PCR_PIC_PRIV);
196 write_pic(picl_value(nmi_hz));
197
198 pcr_ops->write(pcr_enable);
199}
200
201void nmi_adjust_hz(unsigned int new_hz)
202{
203 nmi_hz = new_hz;
204 on_each_cpu(start_watchdog, NULL, 1);
205}
206EXPORT_SYMBOL_GPL(nmi_adjust_hz);
207
208int __init nmi_init(void)
209{
210 nmi_usable = 1;
211
212 on_each_cpu(start_watchdog, NULL, 1);
213
214 return check_nmi_watchdog();
215}
216
217static int __init setup_nmi_watchdog(char *str)
218{
219 if (!strncmp(str, "panic", 5))
220 panic_on_timeout = 1;
221
222 return 0;
223}
224__setup("nmi_watchdog=", setup_nmi_watchdog);
diff --git a/arch/sparc/kernel/pcr.c b/arch/sparc/kernel/pcr.c
new file mode 100644
index 000000000000..92e0dda141a4
--- /dev/null
+++ b/arch/sparc/kernel/pcr.c
@@ -0,0 +1,153 @@
1/* pcr.c: Generic sparc64 performance counter infrastructure.
2 *
3 * Copyright (C) 2009 David S. Miller (davem@davemloft.net)
4 */
5#include <linux/kernel.h>
6#include <linux/module.h>
7#include <linux/init.h>
8#include <linux/irq.h>
9
10#include <asm/pil.h>
11#include <asm/pcr.h>
12#include <asm/nmi.h>
13
14/* This code is shared between various users of the performance
15 * counters. Users will be oprofile, pseudo-NMI watchdog, and the
16 * perf_counter support layer.
17 */
18
19#define PCR_SUN4U_ENABLE (PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE)
20#define PCR_N2_ENABLE (PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE | \
21 PCR_N2_TOE_OV1 | \
22 (2 << PCR_N2_SL1_SHIFT) | \
23 (0xff << PCR_N2_MASK1_SHIFT))
24
25u64 pcr_enable;
26unsigned int picl_shift;
27
28/* Performance counter interrupts run unmasked at PIL level 15.
29 * Therefore we can't do things like wakeups and other work
30 * that expects IRQ disabling to be adhered to in locking etc.
31 *
32 * Therefore in such situations we defer the work by signalling
33 * a lower level cpu IRQ.
34 */
35void deferred_pcr_work_irq(int irq, struct pt_regs *regs)
36{
37 clear_softint(1 << PIL_DEFERRED_PCR_WORK);
38}
39
40void schedule_deferred_pcr_work(void)
41{
42 set_softint(1 << PIL_DEFERRED_PCR_WORK);
43}
44
45const struct pcr_ops *pcr_ops;
46EXPORT_SYMBOL_GPL(pcr_ops);
47
48static u64 direct_pcr_read(void)
49{
50 u64 val;
51
52 read_pcr(val);
53 return val;
54}
55
56static void direct_pcr_write(u64 val)
57{
58 write_pcr(val);
59}
60
61static const struct pcr_ops direct_pcr_ops = {
62 .read = direct_pcr_read,
63 .write = direct_pcr_write,
64};
65
66static void n2_pcr_write(u64 val)
67{
68 unsigned long ret;
69
70 ret = sun4v_niagara2_setperf(HV_N2_PERF_SPARC_CTL, val);
71 if (val != HV_EOK)
72 write_pcr(val);
73}
74
75static const struct pcr_ops n2_pcr_ops = {
76 .read = direct_pcr_read,
77 .write = n2_pcr_write,
78};
79
80static unsigned long perf_hsvc_group;
81static unsigned long perf_hsvc_major;
82static unsigned long perf_hsvc_minor;
83
84static int __init register_perf_hsvc(void)
85{
86 if (tlb_type == hypervisor) {
87 switch (sun4v_chip_type) {
88 case SUN4V_CHIP_NIAGARA1:
89 perf_hsvc_group = HV_GRP_NIAG_PERF;
90 break;
91
92 case SUN4V_CHIP_NIAGARA2:
93 perf_hsvc_group = HV_GRP_N2_CPU;
94 break;
95
96 default:
97 return -ENODEV;
98 }
99
100
101 perf_hsvc_major = 1;
102 perf_hsvc_minor = 0;
103 if (sun4v_hvapi_register(perf_hsvc_group,
104 perf_hsvc_major,
105 &perf_hsvc_minor)) {
106 printk("perfmon: Could not register hvapi.\n");
107 return -ENODEV;
108 }
109 }
110 return 0;
111}
112
113static void __init unregister_perf_hsvc(void)
114{
115 if (tlb_type != hypervisor)
116 return;
117 sun4v_hvapi_unregister(perf_hsvc_group);
118}
119
120int __init pcr_arch_init(void)
121{
122 int err = register_perf_hsvc();
123
124 if (err)
125 return err;
126
127 switch (tlb_type) {
128 case hypervisor:
129 pcr_ops = &n2_pcr_ops;
130 pcr_enable = PCR_N2_ENABLE;
131 picl_shift = 2;
132 break;
133
134 case cheetah:
135 case cheetah_plus:
136 case spitfire:
137 pcr_ops = &direct_pcr_ops;
138 pcr_enable = PCR_SUN4U_ENABLE;
139 break;
140
141 default:
142 err = -ENODEV;
143 goto out_unregister;
144 }
145
146 return nmi_init();
147
148out_unregister:
149 unregister_perf_hsvc();
150 return err;
151}
152
153arch_initcall(pcr_arch_init);
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
index cc8b5604442c..a73954b87f0a 100644
--- a/arch/sparc/kernel/process_64.c
+++ b/arch/sparc/kernel/process_64.c
@@ -29,6 +29,7 @@
29#include <linux/cpu.h> 29#include <linux/cpu.h>
30#include <linux/elfcore.h> 30#include <linux/elfcore.h>
31#include <linux/sysrq.h> 31#include <linux/sysrq.h>
32#include <linux/nmi.h>
32 33
33#include <asm/uaccess.h> 34#include <asm/uaccess.h>
34#include <asm/system.h> 35#include <asm/system.h>
@@ -52,8 +53,10 @@
52 53
53static void sparc64_yield(int cpu) 54static void sparc64_yield(int cpu)
54{ 55{
55 if (tlb_type != hypervisor) 56 if (tlb_type != hypervisor) {
57 touch_nmi_watchdog();
56 return; 58 return;
59 }
57 60
58 clear_thread_flag(TIF_POLLING_NRFLAG); 61 clear_thread_flag(TIF_POLLING_NRFLAG);
59 smp_mb__after_clear_bit(); 62 smp_mb__after_clear_bit();
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c
index 49d061f4ae9d..f2bcfd2967d7 100644
--- a/arch/sparc/kernel/setup_64.c
+++ b/arch/sparc/kernel/setup_64.c
@@ -354,6 +354,7 @@ static int show_cpuinfo(struct seq_file *m, void *__unused)
354 seq_printf(m, 354 seq_printf(m,
355 "cpu\t\t: %s\n" 355 "cpu\t\t: %s\n"
356 "fpu\t\t: %s\n" 356 "fpu\t\t: %s\n"
357 "pmu\t\t: %s\n"
357 "prom\t\t: %s\n" 358 "prom\t\t: %s\n"
358 "type\t\t: %s\n" 359 "type\t\t: %s\n"
359 "ncpus probed\t: %d\n" 360 "ncpus probed\t: %d\n"
@@ -366,6 +367,7 @@ static int show_cpuinfo(struct seq_file *m, void *__unused)
366 , 367 ,
367 sparc_cpu_type, 368 sparc_cpu_type,
368 sparc_fpu_type, 369 sparc_fpu_type,
370 sparc_pmu_type,
369 prom_version, 371 prom_version,
370 ((tlb_type == hypervisor) ? 372 ((tlb_type == hypervisor) ?
371 "sun4v" : 373 "sun4v" :
diff --git a/arch/sparc/kernel/ttable.S b/arch/sparc/kernel/ttable.S
index ea925503b42e..d9bdfb9d5c18 100644
--- a/arch/sparc/kernel/ttable.S
+++ b/arch/sparc/kernel/ttable.S
@@ -63,7 +63,8 @@ tl0_irq6: TRAP_IRQ(smp_call_function_single_client, 6)
63#else 63#else
64tl0_irq6: BTRAP(0x46) 64tl0_irq6: BTRAP(0x46)
65#endif 65#endif
66tl0_irq7: BTRAP(0x47) BTRAP(0x48) BTRAP(0x49) 66tl0_irq7: TRAP_IRQ(deferred_pcr_work_irq, 7)
67tl0_irq8: BTRAP(0x48) BTRAP(0x49)
67tl0_irq10: BTRAP(0x4a) BTRAP(0x4b) BTRAP(0x4c) BTRAP(0x4d) 68tl0_irq10: BTRAP(0x4a) BTRAP(0x4b) BTRAP(0x4c) BTRAP(0x4d)
68tl0_irq14: TRAP_IRQ(timer_interrupt, 14) 69tl0_irq14: TRAP_IRQ(timer_interrupt, 14)
69tl0_irq15: TRAP_NMI_IRQ(perfctr_irq, 15) 70tl0_irq15: TRAP_NMI_IRQ(perfctr_irq, 15)
diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c
index a9e474bf6385..4ab8993b0863 100644
--- a/arch/sparc/mm/fault_64.c
+++ b/arch/sparc/mm/fault_64.c
@@ -19,6 +19,7 @@
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/kprobes.h> 20#include <linux/kprobes.h>
21#include <linux/kdebug.h> 21#include <linux/kdebug.h>
22#include <linux/percpu.h>
22 23
23#include <asm/page.h> 24#include <asm/page.h>
24#include <asm/pgtable.h> 25#include <asm/pgtable.h>
@@ -224,6 +225,30 @@ cannot_handle:
224 unhandled_fault (address, current, regs); 225 unhandled_fault (address, current, regs);
225} 226}
226 227
228static void noinline bogus_32bit_fault_tpc(struct pt_regs *regs)
229{
230 static int times;
231
232 if (times++ < 10)
233 printk(KERN_ERR "FAULT[%s:%d]: 32-bit process reports "
234 "64-bit TPC [%lx]\n",
235 current->comm, current->pid,
236 regs->tpc);
237 show_regs(regs);
238}
239
240static void noinline bogus_32bit_fault_address(struct pt_regs *regs,
241 unsigned long addr)
242{
243 static int times;
244
245 if (times++ < 10)
246 printk(KERN_ERR "FAULT[%s:%d]: 32-bit process "
247 "reports 64-bit fault address [%lx]\n",
248 current->comm, current->pid, addr);
249 show_regs(regs);
250}
251
227asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs) 252asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
228{ 253{
229 struct mm_struct *mm = current->mm; 254 struct mm_struct *mm = current->mm;
@@ -244,6 +269,19 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
244 (fault_code & FAULT_CODE_DTLB)) 269 (fault_code & FAULT_CODE_DTLB))
245 BUG(); 270 BUG();
246 271
272 if (test_thread_flag(TIF_32BIT)) {
273 if (!(regs->tstate & TSTATE_PRIV)) {
274 if (unlikely((regs->tpc >> 32) != 0)) {
275 bogus_32bit_fault_tpc(regs);
276 goto intr_or_no_mm;
277 }
278 }
279 if (unlikely((address >> 32) != 0)) {
280 bogus_32bit_fault_address(regs, address);
281 goto intr_or_no_mm;
282 }
283 }
284
247 if (regs->tstate & TSTATE_PRIV) { 285 if (regs->tstate & TSTATE_PRIV) {
248 unsigned long tpc = regs->tpc; 286 unsigned long tpc = regs->tpc;
249 287
@@ -264,12 +302,6 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
264 if (in_atomic() || !mm) 302 if (in_atomic() || !mm)
265 goto intr_or_no_mm; 303 goto intr_or_no_mm;
266 304
267 if (test_thread_flag(TIF_32BIT)) {
268 if (!(regs->tstate & TSTATE_PRIV))
269 regs->tpc &= 0xffffffff;
270 address &= 0xffffffff;
271 }
272
273 if (!down_read_trylock(&mm->mmap_sem)) { 305 if (!down_read_trylock(&mm->mmap_sem)) {
274 if ((regs->tstate & TSTATE_PRIV) && 306 if ((regs->tstate & TSTATE_PRIV) &&
275 !search_exception_tables(regs->tpc)) { 307 !search_exception_tables(regs->tpc)) {
diff --git a/arch/sparc/oprofile/init.c b/arch/sparc/oprofile/init.c
index d6e170c074fc..d172f86439b1 100644
--- a/arch/sparc/oprofile/init.c
+++ b/arch/sparc/oprofile/init.c
@@ -13,217 +13,57 @@
13#include <linux/init.h> 13#include <linux/init.h>
14 14
15#ifdef CONFIG_SPARC64 15#ifdef CONFIG_SPARC64
16#include <asm/hypervisor.h> 16#include <linux/notifier.h>
17#include <asm/spitfire.h> 17#include <linux/rcupdate.h>
18#include <asm/cpudata.h> 18#include <linux/kdebug.h>
19#include <asm/irq.h> 19#include <asm/nmi.h>
20 20
21static int nmi_enabled; 21static int profile_timer_exceptions_notify(struct notifier_block *self,
22 22 unsigned long val, void *data)
23struct pcr_ops {
24 u64 (*read)(void);
25 void (*write)(u64);
26};
27static const struct pcr_ops *pcr_ops;
28
29static u64 direct_pcr_read(void)
30{
31 u64 val;
32
33 read_pcr(val);
34 return val;
35}
36
37static void direct_pcr_write(u64 val)
38{
39 write_pcr(val);
40}
41
42static const struct pcr_ops direct_pcr_ops = {
43 .read = direct_pcr_read,
44 .write = direct_pcr_write,
45};
46
47static void n2_pcr_write(u64 val)
48{ 23{
49 unsigned long ret; 24 struct die_args *args = (struct die_args *)data;
50 25 int ret = NOTIFY_DONE;
51 ret = sun4v_niagara2_setperf(HV_N2_PERF_SPARC_CTL, val);
52 if (val != HV_EOK)
53 write_pcr(val);
54}
55
56static const struct pcr_ops n2_pcr_ops = {
57 .read = direct_pcr_read,
58 .write = n2_pcr_write,
59};
60
61/* In order to commonize as much of the implementation as
62 * possible, we use PICH as our counter. Mostly this is
63 * to accomodate Niagara-1 which can only count insn cycles
64 * in PICH.
65 */
66static u64 picl_value(void)
67{
68 u32 delta = local_cpu_data().clock_tick / HZ;
69
70 return ((u64)((0 - delta) & 0xffffffff)) << 32;
71}
72
73#define PCR_PIC_PRIV 0x00000001 /* PIC access is privileged */
74#define PCR_STRACE 0x00000002 /* Trace supervisor events */
75#define PCR_UTRACE 0x00000004 /* Trace user events */
76#define PCR_N2_HTRACE 0x00000008 /* Trace hypervisor events */
77#define PCR_N2_TOE_OV0 0x00000010 /* Trap if PIC 0 overflows */
78#define PCR_N2_TOE_OV1 0x00000020 /* Trap if PIC 1 overflows */
79#define PCR_N2_MASK0 0x00003fc0
80#define PCR_N2_MASK0_SHIFT 6
81#define PCR_N2_SL0 0x0003c000
82#define PCR_N2_SL0_SHIFT 14
83#define PCR_N2_OV0 0x00040000
84#define PCR_N2_MASK1 0x07f80000
85#define PCR_N2_MASK1_SHIFT 19
86#define PCR_N2_SL1 0x78000000
87#define PCR_N2_SL1_SHIFT 27
88#define PCR_N2_OV1 0x80000000
89
90#define PCR_SUN4U_ENABLE (PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE)
91#define PCR_N2_ENABLE (PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE | \
92 PCR_N2_TOE_OV1 | \
93 (2 << PCR_N2_SL1_SHIFT) | \
94 (0xff << PCR_N2_MASK1_SHIFT))
95
96static u64 pcr_enable = PCR_SUN4U_ENABLE;
97
98static void nmi_handler(struct pt_regs *regs)
99{
100 pcr_ops->write(PCR_PIC_PRIV);
101
102 if (nmi_enabled) {
103 oprofile_add_sample(regs, 0);
104
105 write_pic(picl_value());
106 pcr_ops->write(pcr_enable);
107 }
108}
109
110/* We count "clock cycle" events in the lower 32-bit PIC.
111 * Then configure it such that it overflows every HZ, and thus
112 * generates a level 15 interrupt at that frequency.
113 */
114static void cpu_nmi_start(void *_unused)
115{
116 pcr_ops->write(PCR_PIC_PRIV);
117 write_pic(picl_value());
118
119 pcr_ops->write(pcr_enable);
120}
121 26
122static void cpu_nmi_stop(void *_unused) 27 switch (val) {
123{ 28 case DIE_NMI:
124 pcr_ops->write(PCR_PIC_PRIV); 29 oprofile_add_sample(args->regs, 0);
125} 30 ret = NOTIFY_STOP;
126 31 break;
127static int nmi_start(void) 32 default:
128{ 33 break;
129 int err = register_perfctr_intr(nmi_handler);
130
131 if (!err) {
132 nmi_enabled = 1;
133 wmb();
134 err = on_each_cpu(cpu_nmi_start, NULL, 1);
135 if (err) {
136 nmi_enabled = 0;
137 wmb();
138 on_each_cpu(cpu_nmi_stop, NULL, 1);
139 release_perfctr_intr(nmi_handler);
140 }
141 } 34 }
142 35 return ret;
143 return err;
144}
145
146static void nmi_stop(void)
147{
148 nmi_enabled = 0;
149 wmb();
150
151 on_each_cpu(cpu_nmi_stop, NULL, 1);
152 release_perfctr_intr(nmi_handler);
153 synchronize_sched();
154} 36}
155 37
156static unsigned long perf_hsvc_group; 38static struct notifier_block profile_timer_exceptions_nb = {
157static unsigned long perf_hsvc_major; 39 .notifier_call = profile_timer_exceptions_notify,
158static unsigned long perf_hsvc_minor; 40};
159 41
160static int __init register_perf_hsvc(void) 42static int timer_start(void)
161{ 43{
162 if (tlb_type == hypervisor) { 44 if (register_die_notifier(&profile_timer_exceptions_nb))
163 switch (sun4v_chip_type) { 45 return 1;
164 case SUN4V_CHIP_NIAGARA1: 46 nmi_adjust_hz(HZ);
165 perf_hsvc_group = HV_GRP_NIAG_PERF;
166 break;
167
168 case SUN4V_CHIP_NIAGARA2:
169 perf_hsvc_group = HV_GRP_N2_CPU;
170 break;
171
172 default:
173 return -ENODEV;
174 }
175
176
177 perf_hsvc_major = 1;
178 perf_hsvc_minor = 0;
179 if (sun4v_hvapi_register(perf_hsvc_group,
180 perf_hsvc_major,
181 &perf_hsvc_minor)) {
182 printk("perfmon: Could not register N2 hvapi.\n");
183 return -ENODEV;
184 }
185 }
186 return 0; 47 return 0;
187} 48}
188 49
189static void unregister_perf_hsvc(void) 50
51static void timer_stop(void)
190{ 52{
191 if (tlb_type != hypervisor) 53 nmi_adjust_hz(1);
192 return; 54 unregister_die_notifier(&profile_timer_exceptions_nb);
193 sun4v_hvapi_unregister(perf_hsvc_group); 55 synchronize_sched(); /* Allow already-started NMIs to complete. */
194} 56}
195 57
196static int oprofile_nmi_init(struct oprofile_operations *ops) 58static int op_nmi_timer_init(struct oprofile_operations *ops)
197{ 59{
198 int err = register_perf_hsvc(); 60 if (!nmi_usable)
199
200 if (err)
201 return err;
202
203 switch (tlb_type) {
204 case hypervisor:
205 pcr_ops = &n2_pcr_ops;
206 pcr_enable = PCR_N2_ENABLE;
207 break;
208
209 case cheetah:
210 case cheetah_plus:
211 pcr_ops = &direct_pcr_ops;
212 break;
213
214 default:
215 return -ENODEV; 61 return -ENODEV;
216 }
217 62
218 ops->create_files = NULL; 63 ops->start = timer_start;
219 ops->setup = NULL; 64 ops->stop = timer_stop;
220 ops->shutdown = NULL;
221 ops->start = nmi_start;
222 ops->stop = nmi_stop;
223 ops->cpu_type = "timer"; 65 ops->cpu_type = "timer";
224 66 printk(KERN_INFO "oprofile: Using perfctr NMI timer interrupt.\n");
225 printk(KERN_INFO "oprofile: Using perfctr based NMI timer interrupt.\n");
226
227 return 0; 67 return 0;
228} 68}
229#endif 69#endif
@@ -233,7 +73,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
233 int ret = -ENODEV; 73 int ret = -ENODEV;
234 74
235#ifdef CONFIG_SPARC64 75#ifdef CONFIG_SPARC64
236 ret = oprofile_nmi_init(ops); 76 ret = op_nmi_timer_init(ops);
237 if (!ret) 77 if (!ret)
238 return ret; 78 return ret;
239#endif 79#endif
@@ -241,10 +81,6 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
241 return ret; 81 return ret;
242} 82}
243 83
244
245void oprofile_arch_exit(void) 84void oprofile_arch_exit(void)
246{ 85{
247#ifdef CONFIG_SPARC64
248 unregister_perf_hsvc();
249#endif
250} 86}
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 77bba4c083cb..a603bbf9b1b7 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -61,9 +61,14 @@
61#define EM_MSG_LED_VALUE_ON 0x00010000 61#define EM_MSG_LED_VALUE_ON 0x00010000
62 62
63static int ahci_skip_host_reset; 63static int ahci_skip_host_reset;
64static int ahci_ignore_sss;
65
64module_param_named(skip_host_reset, ahci_skip_host_reset, int, 0444); 66module_param_named(skip_host_reset, ahci_skip_host_reset, int, 0444);
65MODULE_PARM_DESC(skip_host_reset, "skip global host reset (0=don't skip, 1=skip)"); 67MODULE_PARM_DESC(skip_host_reset, "skip global host reset (0=don't skip, 1=skip)");
66 68
69module_param_named(ignore_sss, ahci_ignore_sss, int, 0444);
70MODULE_PARM_DESC(ignore_sss, "Ignore staggered spinup flag (0=don't ignore, 1=ignore)");
71
67static int ahci_enable_alpm(struct ata_port *ap, 72static int ahci_enable_alpm(struct ata_port *ap,
68 enum link_pm policy); 73 enum link_pm policy);
69static void ahci_disable_alpm(struct ata_port *ap); 74static void ahci_disable_alpm(struct ata_port *ap);
@@ -2692,8 +2697,10 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2692 host->iomap = pcim_iomap_table(pdev); 2697 host->iomap = pcim_iomap_table(pdev);
2693 host->private_data = hpriv; 2698 host->private_data = hpriv;
2694 2699
2695 if (!(hpriv->cap & HOST_CAP_SSS)) 2700 if (!(hpriv->cap & HOST_CAP_SSS) || ahci_ignore_sss)
2696 host->flags |= ATA_HOST_PARALLEL_SCAN; 2701 host->flags |= ATA_HOST_PARALLEL_SCAN;
2702 else
2703 printk(KERN_INFO "ahci: SSS flag set, parallel bus scan disabled\n");
2697 2704
2698 if (pi.flags & ATA_FLAG_EM) 2705 if (pi.flags & ATA_FLAG_EM)
2699 ahci_reset_em(host); 2706 ahci_reset_em(host);
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 88c242856dae..9fbf0595f3d4 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -164,6 +164,11 @@ MODULE_LICENSE("GPL");
164MODULE_VERSION(DRV_VERSION); 164MODULE_VERSION(DRV_VERSION);
165 165
166 166
167static bool ata_sstatus_online(u32 sstatus)
168{
169 return (sstatus & 0xf) == 0x3;
170}
171
167/** 172/**
168 * ata_link_next - link iteration helper 173 * ata_link_next - link iteration helper
169 * @link: the previous link, NULL to start 174 * @link: the previous link, NULL to start
@@ -1015,18 +1020,6 @@ static const char *sata_spd_string(unsigned int spd)
1015 return spd_str[spd - 1]; 1020 return spd_str[spd - 1];
1016} 1021}
1017 1022
1018void ata_dev_disable(struct ata_device *dev)
1019{
1020 if (ata_dev_enabled(dev)) {
1021 if (ata_msg_drv(dev->link->ap))
1022 ata_dev_printk(dev, KERN_WARNING, "disabled\n");
1023 ata_acpi_on_disable(dev);
1024 ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 |
1025 ATA_DNXFER_QUIET);
1026 dev->class++;
1027 }
1028}
1029
1030static int ata_dev_set_dipm(struct ata_device *dev, enum link_pm policy) 1023static int ata_dev_set_dipm(struct ata_device *dev, enum link_pm policy)
1031{ 1024{
1032 struct ata_link *link = dev->link; 1025 struct ata_link *link = dev->link;
@@ -2239,6 +2232,40 @@ retry:
2239 return rc; 2232 return rc;
2240} 2233}
2241 2234
2235static int ata_do_link_spd_horkage(struct ata_device *dev)
2236{
2237 struct ata_link *plink = ata_dev_phys_link(dev);
2238 u32 target, target_limit;
2239
2240 if (!sata_scr_valid(plink))
2241 return 0;
2242
2243 if (dev->horkage & ATA_HORKAGE_1_5_GBPS)
2244 target = 1;
2245 else
2246 return 0;
2247
2248 target_limit = (1 << target) - 1;
2249
2250 /* if already on stricter limit, no need to push further */
2251 if (plink->sata_spd_limit <= target_limit)
2252 return 0;
2253
2254 plink->sata_spd_limit = target_limit;
2255
2256 /* Request another EH round by returning -EAGAIN if link is
2257 * going faster than the target speed. Forward progress is
2258 * guaranteed by setting sata_spd_limit to target_limit above.
2259 */
2260 if (plink->sata_spd > target) {
2261 ata_dev_printk(dev, KERN_INFO,
2262 "applying link speed limit horkage to %s\n",
2263 sata_spd_string(target));
2264 return -EAGAIN;
2265 }
2266 return 0;
2267}
2268
2242static inline u8 ata_dev_knobble(struct ata_device *dev) 2269static inline u8 ata_dev_knobble(struct ata_device *dev)
2243{ 2270{
2244 struct ata_port *ap = dev->link->ap; 2271 struct ata_port *ap = dev->link->ap;
@@ -2329,6 +2356,10 @@ int ata_dev_configure(struct ata_device *dev)
2329 return 0; 2356 return 0;
2330 } 2357 }
2331 2358
2359 rc = ata_do_link_spd_horkage(dev);
2360 if (rc)
2361 return rc;
2362
2332 /* let ACPI work its magic */ 2363 /* let ACPI work its magic */
2333 rc = ata_acpi_on_devcfg(dev); 2364 rc = ata_acpi_on_devcfg(dev);
2334 if (rc) 2365 if (rc)
@@ -2784,7 +2815,7 @@ int ata_bus_probe(struct ata_port *ap)
2784 /* This is the last chance, better to slow 2815 /* This is the last chance, better to slow
2785 * down than lose it. 2816 * down than lose it.
2786 */ 2817 */
2787 sata_down_spd_limit(&ap->link); 2818 sata_down_spd_limit(&ap->link, 0);
2788 ata_down_xfermask_limit(dev, ATA_DNXFER_PIO); 2819 ata_down_xfermask_limit(dev, ATA_DNXFER_PIO);
2789 } 2820 }
2790 } 2821 }
@@ -2880,21 +2911,27 @@ void ata_port_disable(struct ata_port *ap)
2880/** 2911/**
2881 * sata_down_spd_limit - adjust SATA spd limit downward 2912 * sata_down_spd_limit - adjust SATA spd limit downward
2882 * @link: Link to adjust SATA spd limit for 2913 * @link: Link to adjust SATA spd limit for
2914 * @spd_limit: Additional limit
2883 * 2915 *
2884 * Adjust SATA spd limit of @link downward. Note that this 2916 * Adjust SATA spd limit of @link downward. Note that this
2885 * function only adjusts the limit. The change must be applied 2917 * function only adjusts the limit. The change must be applied
2886 * using sata_set_spd(). 2918 * using sata_set_spd().
2887 * 2919 *
2920 * If @spd_limit is non-zero, the speed is limited to equal to or
2921 * lower than @spd_limit if such speed is supported. If
2922 * @spd_limit is slower than any supported speed, only the lowest
2923 * supported speed is allowed.
2924 *
2888 * LOCKING: 2925 * LOCKING:
2889 * Inherited from caller. 2926 * Inherited from caller.
2890 * 2927 *
2891 * RETURNS: 2928 * RETURNS:
2892 * 0 on success, negative errno on failure 2929 * 0 on success, negative errno on failure
2893 */ 2930 */
2894int sata_down_spd_limit(struct ata_link *link) 2931int sata_down_spd_limit(struct ata_link *link, u32 spd_limit)
2895{ 2932{
2896 u32 sstatus, spd, mask; 2933 u32 sstatus, spd, mask;
2897 int rc, highbit; 2934 int rc, bit;
2898 2935
2899 if (!sata_scr_valid(link)) 2936 if (!sata_scr_valid(link))
2900 return -EOPNOTSUPP; 2937 return -EOPNOTSUPP;
@@ -2903,7 +2940,7 @@ int sata_down_spd_limit(struct ata_link *link)
2903 * If not, use cached value in link->sata_spd. 2940 * If not, use cached value in link->sata_spd.
2904 */ 2941 */
2905 rc = sata_scr_read(link, SCR_STATUS, &sstatus); 2942 rc = sata_scr_read(link, SCR_STATUS, &sstatus);
2906 if (rc == 0) 2943 if (rc == 0 && ata_sstatus_online(sstatus))
2907 spd = (sstatus >> 4) & 0xf; 2944 spd = (sstatus >> 4) & 0xf;
2908 else 2945 else
2909 spd = link->sata_spd; 2946 spd = link->sata_spd;
@@ -2913,8 +2950,8 @@ int sata_down_spd_limit(struct ata_link *link)
2913 return -EINVAL; 2950 return -EINVAL;
2914 2951
2915 /* unconditionally mask off the highest bit */ 2952 /* unconditionally mask off the highest bit */
2916 highbit = fls(mask) - 1; 2953 bit = fls(mask) - 1;
2917 mask &= ~(1 << highbit); 2954 mask &= ~(1 << bit);
2918 2955
2919 /* Mask off all speeds higher than or equal to the current 2956 /* Mask off all speeds higher than or equal to the current
2920 * one. Force 1.5Gbps if current SPD is not available. 2957 * one. Force 1.5Gbps if current SPD is not available.
@@ -2928,6 +2965,15 @@ int sata_down_spd_limit(struct ata_link *link)
2928 if (!mask) 2965 if (!mask)
2929 return -EINVAL; 2966 return -EINVAL;
2930 2967
2968 if (spd_limit) {
2969 if (mask & ((1 << spd_limit) - 1))
2970 mask &= (1 << spd_limit) - 1;
2971 else {
2972 bit = ffs(mask) - 1;
2973 mask = 1 << bit;
2974 }
2975 }
2976
2931 link->sata_spd_limit = mask; 2977 link->sata_spd_limit = mask;
2932 2978
2933 ata_link_printk(link, KERN_WARNING, "limiting SATA link speed to %s\n", 2979 ata_link_printk(link, KERN_WARNING, "limiting SATA link speed to %s\n",
@@ -4215,6 +4261,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
4215 /* Devices that do not need bridging limits applied */ 4261 /* Devices that do not need bridging limits applied */
4216 { "MTRON MSP-SATA*", NULL, ATA_HORKAGE_BRIDGE_OK, }, 4262 { "MTRON MSP-SATA*", NULL, ATA_HORKAGE_BRIDGE_OK, },
4217 4263
4264 /* Devices which aren't very happy with higher link speeds */
4265 { "WD My Book", NULL, ATA_HORKAGE_1_5_GBPS, },
4266
4218 /* End Marker */ 4267 /* End Marker */
4219 { } 4268 { }
4220}; 4269};
@@ -4709,8 +4758,7 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words)
4709 4758
4710/** 4759/**
4711 * ata_qc_new - Request an available ATA command, for queueing 4760 * ata_qc_new - Request an available ATA command, for queueing
4712 * @ap: Port associated with device @dev 4761 * @ap: target port
4713 * @dev: Device from whom we request an available command structure
4714 * 4762 *
4715 * LOCKING: 4763 * LOCKING:
4716 * None. 4764 * None.
@@ -5175,7 +5223,7 @@ bool ata_phys_link_online(struct ata_link *link)
5175 u32 sstatus; 5223 u32 sstatus;
5176 5224
5177 if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0 && 5225 if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0 &&
5178 (sstatus & 0xf) == 0x3) 5226 ata_sstatus_online(sstatus))
5179 return true; 5227 return true;
5180 return false; 5228 return false;
5181} 5229}
@@ -5199,7 +5247,7 @@ bool ata_phys_link_offline(struct ata_link *link)
5199 u32 sstatus; 5247 u32 sstatus;
5200 5248
5201 if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0 && 5249 if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0 &&
5202 (sstatus & 0xf) != 0x3) 5250 !ata_sstatus_online(sstatus))
5203 return true; 5251 return true;
5204 return false; 5252 return false;
5205} 5253}
@@ -5412,8 +5460,8 @@ void ata_dev_init(struct ata_device *dev)
5412 dev->horkage = 0; 5460 dev->horkage = 0;
5413 spin_unlock_irqrestore(ap->lock, flags); 5461 spin_unlock_irqrestore(ap->lock, flags);
5414 5462
5415 memset((void *)dev + ATA_DEVICE_CLEAR_OFFSET, 0, 5463 memset((void *)dev + ATA_DEVICE_CLEAR_BEGIN, 0,
5416 sizeof(*dev) - ATA_DEVICE_CLEAR_OFFSET); 5464 ATA_DEVICE_CLEAR_END - ATA_DEVICE_CLEAR_BEGIN);
5417 dev->pio_mask = UINT_MAX; 5465 dev->pio_mask = UINT_MAX;
5418 dev->mwdma_mask = UINT_MAX; 5466 dev->mwdma_mask = UINT_MAX;
5419 dev->udma_mask = UINT_MAX; 5467 dev->udma_mask = UINT_MAX;
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 8147a8386370..ce2ef0475339 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -82,6 +82,10 @@ enum {
82 ATA_EH_FASTDRAIN_INTERVAL = 3000, 82 ATA_EH_FASTDRAIN_INTERVAL = 3000,
83 83
84 ATA_EH_UA_TRIES = 5, 84 ATA_EH_UA_TRIES = 5,
85
86 /* probe speed down parameters, see ata_eh_schedule_probe() */
87 ATA_EH_PROBE_TRIAL_INTERVAL = 60000, /* 1 min */
88 ATA_EH_PROBE_TRIALS = 2,
85}; 89};
86 90
87/* The following table determines how we sequence resets. Each entry 91/* The following table determines how we sequence resets. Each entry
@@ -1176,6 +1180,32 @@ void ata_eh_qc_retry(struct ata_queued_cmd *qc)
1176} 1180}
1177 1181
1178/** 1182/**
1183 * ata_dev_disable - disable ATA device
1184 * @dev: ATA device to disable
1185 *
1186 * Disable @dev.
1187 *
1188 * Locking:
1189 * EH context.
1190 */
1191void ata_dev_disable(struct ata_device *dev)
1192{
1193 if (!ata_dev_enabled(dev))
1194 return;
1195
1196 if (ata_msg_drv(dev->link->ap))
1197 ata_dev_printk(dev, KERN_WARNING, "disabled\n");
1198 ata_acpi_on_disable(dev);
1199 ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 | ATA_DNXFER_QUIET);
1200 dev->class++;
1201
1202 /* From now till the next successful probe, ering is used to
1203 * track probe failures. Clear accumulated device error info.
1204 */
1205 ata_ering_clear(&dev->ering);
1206}
1207
1208/**
1179 * ata_eh_detach_dev - detach ATA device 1209 * ata_eh_detach_dev - detach ATA device
1180 * @dev: ATA device to detach 1210 * @dev: ATA device to detach
1181 * 1211 *
@@ -1849,7 +1879,7 @@ static unsigned int ata_eh_speed_down(struct ata_device *dev,
1849 /* speed down? */ 1879 /* speed down? */
1850 if (verdict & ATA_EH_SPDN_SPEED_DOWN) { 1880 if (verdict & ATA_EH_SPDN_SPEED_DOWN) {
1851 /* speed down SATA link speed if possible */ 1881 /* speed down SATA link speed if possible */
1852 if (sata_down_spd_limit(link) == 0) { 1882 if (sata_down_spd_limit(link, 0) == 0) {
1853 action |= ATA_EH_RESET; 1883 action |= ATA_EH_RESET;
1854 goto done; 1884 goto done;
1855 } 1885 }
@@ -2601,11 +2631,11 @@ int ata_eh_reset(struct ata_link *link, int classify,
2601 } 2631 }
2602 2632
2603 if (try == max_tries - 1) { 2633 if (try == max_tries - 1) {
2604 sata_down_spd_limit(link); 2634 sata_down_spd_limit(link, 0);
2605 if (slave) 2635 if (slave)
2606 sata_down_spd_limit(slave); 2636 sata_down_spd_limit(slave, 0);
2607 } else if (rc == -EPIPE) 2637 } else if (rc == -EPIPE)
2608 sata_down_spd_limit(failed_link); 2638 sata_down_spd_limit(failed_link, 0);
2609 2639
2610 if (hardreset) 2640 if (hardreset)
2611 reset = hardreset; 2641 reset = hardreset;
@@ -2744,6 +2774,8 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
2744 readid_flags, dev->id); 2774 readid_flags, dev->id);
2745 switch (rc) { 2775 switch (rc) {
2746 case 0: 2776 case 0:
2777 /* clear error info accumulated during probe */
2778 ata_ering_clear(&dev->ering);
2747 new_mask |= 1 << dev->devno; 2779 new_mask |= 1 << dev->devno;
2748 break; 2780 break;
2749 case -ENOENT: 2781 case -ENOENT:
@@ -2947,9 +2979,24 @@ static int ata_eh_skip_recovery(struct ata_link *link)
2947 return 1; 2979 return 1;
2948} 2980}
2949 2981
2982static int ata_count_probe_trials_cb(struct ata_ering_entry *ent, void *void_arg)
2983{
2984 u64 interval = msecs_to_jiffies(ATA_EH_PROBE_TRIAL_INTERVAL);
2985 u64 now = get_jiffies_64();
2986 int *trials = void_arg;
2987
2988 if (ent->timestamp < now - min(now, interval))
2989 return -1;
2990
2991 (*trials)++;
2992 return 0;
2993}
2994
2950static int ata_eh_schedule_probe(struct ata_device *dev) 2995static int ata_eh_schedule_probe(struct ata_device *dev)
2951{ 2996{
2952 struct ata_eh_context *ehc = &dev->link->eh_context; 2997 struct ata_eh_context *ehc = &dev->link->eh_context;
2998 struct ata_link *link = ata_dev_phys_link(dev);
2999 int trials = 0;
2953 3000
2954 if (!(ehc->i.probe_mask & (1 << dev->devno)) || 3001 if (!(ehc->i.probe_mask & (1 << dev->devno)) ||
2955 (ehc->did_probe_mask & (1 << dev->devno))) 3002 (ehc->did_probe_mask & (1 << dev->devno)))
@@ -2962,6 +3009,25 @@ static int ata_eh_schedule_probe(struct ata_device *dev)
2962 ehc->saved_xfer_mode[dev->devno] = 0; 3009 ehc->saved_xfer_mode[dev->devno] = 0;
2963 ehc->saved_ncq_enabled &= ~(1 << dev->devno); 3010 ehc->saved_ncq_enabled &= ~(1 << dev->devno);
2964 3011
3012 /* Record and count probe trials on the ering. The specific
3013 * error mask used is irrelevant. Because a successful device
3014 * detection clears the ering, this count accumulates only if
3015 * there are consecutive failed probes.
3016 *
3017 * If the count is equal to or higher than ATA_EH_PROBE_TRIALS
3018 * in the last ATA_EH_PROBE_TRIAL_INTERVAL, link speed is
3019 * forced to 1.5Gbps.
3020 *
3021 * This is to work around cases where failed link speed
3022 * negotiation results in device misdetection leading to
3023 * infinite DEVXCHG or PHRDY CHG events.
3024 */
3025 ata_ering_record(&dev->ering, 0, AC_ERR_OTHER);
3026 ata_ering_map(&dev->ering, ata_count_probe_trials_cb, &trials);
3027
3028 if (trials > ATA_EH_PROBE_TRIALS)
3029 sata_down_spd_limit(link, 1);
3030
2965 return 1; 3031 return 1;
2966} 3032}
2967 3033
@@ -2969,7 +3035,11 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err)
2969{ 3035{
2970 struct ata_eh_context *ehc = &dev->link->eh_context; 3036 struct ata_eh_context *ehc = &dev->link->eh_context;
2971 3037
2972 ehc->tries[dev->devno]--; 3038 /* -EAGAIN from EH routine indicates retry without prejudice.
3039 * The requester is responsible for ensuring forward progress.
3040 */
3041 if (err != -EAGAIN)
3042 ehc->tries[dev->devno]--;
2973 3043
2974 switch (err) { 3044 switch (err) {
2975 case -ENODEV: 3045 case -ENODEV:
@@ -2979,12 +3049,13 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err)
2979 /* give it just one more chance */ 3049 /* give it just one more chance */
2980 ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1); 3050 ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1);
2981 case -EIO: 3051 case -EIO:
2982 if (ehc->tries[dev->devno] == 1 && dev->pio_mode > XFER_PIO_0) { 3052 if (ehc->tries[dev->devno] == 1) {
2983 /* This is the last chance, better to slow 3053 /* This is the last chance, better to slow
2984 * down than lose it. 3054 * down than lose it.
2985 */ 3055 */
2986 sata_down_spd_limit(ata_dev_phys_link(dev)); 3056 sata_down_spd_limit(ata_dev_phys_link(dev), 0);
2987 ata_down_xfermask_limit(dev, ATA_DNXFER_PIO); 3057 if (dev->pio_mode > XFER_PIO_0)
3058 ata_down_xfermask_limit(dev, ATA_DNXFER_PIO);
2988 } 3059 }
2989 } 3060 }
2990 3061
diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c
index 98ca07a2db87..619f2c33950e 100644
--- a/drivers/ata/libata-pmp.c
+++ b/drivers/ata/libata-pmp.c
@@ -729,7 +729,7 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap,
729 if (tries) { 729 if (tries) {
730 /* consecutive revalidation failures? speed down */ 730 /* consecutive revalidation failures? speed down */
731 if (reval_failed) 731 if (reval_failed)
732 sata_down_spd_limit(link); 732 sata_down_spd_limit(link, 0);
733 else 733 else
734 reval_failed = 1; 734 reval_failed = 1;
735 735
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 3c4c5ae277ba..b9747fa59e54 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -415,6 +415,7 @@ int ata_std_bios_param(struct scsi_device *sdev, struct block_device *bdev,
415 415
416/** 416/**
417 * ata_get_identity - Handler for HDIO_GET_IDENTITY ioctl 417 * ata_get_identity - Handler for HDIO_GET_IDENTITY ioctl
418 * @ap: target port
418 * @sdev: SCSI device to get identify data for 419 * @sdev: SCSI device to get identify data for
419 * @arg: User buffer area for identify data 420 * @arg: User buffer area for identify data
420 * 421 *
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index fe2839e58774..cea8014cd87e 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -79,7 +79,6 @@ extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev,
79 u64 block, u32 n_block, unsigned int tf_flags, 79 u64 block, u32 n_block, unsigned int tf_flags,
80 unsigned int tag); 80 unsigned int tag);
81extern u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev); 81extern u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev);
82extern void ata_dev_disable(struct ata_device *dev);
83extern void ata_pio_queue_task(struct ata_port *ap, void *data, 82extern void ata_pio_queue_task(struct ata_port *ap, void *data,
84 unsigned long delay); 83 unsigned long delay);
85extern void ata_port_flush_task(struct ata_port *ap); 84extern void ata_port_flush_task(struct ata_port *ap);
@@ -100,7 +99,7 @@ extern int ata_dev_reread_id(struct ata_device *dev, unsigned int readid_flags);
100extern int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class, 99extern int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
101 unsigned int readid_flags); 100 unsigned int readid_flags);
102extern int ata_dev_configure(struct ata_device *dev); 101extern int ata_dev_configure(struct ata_device *dev);
103extern int sata_down_spd_limit(struct ata_link *link); 102extern int sata_down_spd_limit(struct ata_link *link, u32 spd_limit);
104extern int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel); 103extern int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel);
105extern void ata_sg_clean(struct ata_queued_cmd *qc); 104extern void ata_sg_clean(struct ata_queued_cmd *qc);
106extern void ata_qc_free(struct ata_queued_cmd *qc); 105extern void ata_qc_free(struct ata_queued_cmd *qc);
@@ -160,6 +159,7 @@ extern void ata_scsi_error(struct Scsi_Host *host);
160extern void ata_port_wait_eh(struct ata_port *ap); 159extern void ata_port_wait_eh(struct ata_port *ap);
161extern void ata_eh_fastdrain_timerfn(unsigned long arg); 160extern void ata_eh_fastdrain_timerfn(unsigned long arg);
162extern void ata_qc_schedule_eh(struct ata_queued_cmd *qc); 161extern void ata_qc_schedule_eh(struct ata_queued_cmd *qc);
162extern void ata_dev_disable(struct ata_device *dev);
163extern void ata_eh_detach_dev(struct ata_device *dev); 163extern void ata_eh_detach_dev(struct ata_device *dev);
164extern void ata_eh_about_to_do(struct ata_link *link, struct ata_device *dev, 164extern void ata_eh_about_to_do(struct ata_link *link, struct ata_device *dev,
165 unsigned int action); 165 unsigned int action);
diff --git a/drivers/ata/pata_qdi.c b/drivers/ata/pata_qdi.c
index 3080f371222c..f1b26f7c8e4d 100644
--- a/drivers/ata/pata_qdi.c
+++ b/drivers/ata/pata_qdi.c
@@ -12,7 +12,7 @@
12 * 12 *
13 * Probe code based on drivers/ide/legacy/qd65xx.c 13 * Probe code based on drivers/ide/legacy/qd65xx.c
14 * Rewritten from the work of Colten Edwards <pje120@cs.usask.ca> by 14 * Rewritten from the work of Colten Edwards <pje120@cs.usask.ca> by
15 * Samuel Thibault <samuel.thibault@fnac.net> 15 * Samuel Thibault <samuel.thibault@ens-lyon.org>
16 */ 16 */
17 17
18#include <linux/kernel.h> 18#include <linux/kernel.h>
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index f2d8a020ea53..4ae1a4138b47 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -663,8 +663,8 @@ static const struct pci_device_id mv_pci_tbl[] = {
663 { PCI_VDEVICE(MARVELL, 0x5081), chip_508x }, 663 { PCI_VDEVICE(MARVELL, 0x5081), chip_508x },
664 /* RocketRAID 1720/174x have different identifiers */ 664 /* RocketRAID 1720/174x have different identifiers */
665 { PCI_VDEVICE(TTI, 0x1720), chip_6042 }, 665 { PCI_VDEVICE(TTI, 0x1720), chip_6042 },
666 { PCI_VDEVICE(TTI, 0x1740), chip_508x }, 666 { PCI_VDEVICE(TTI, 0x1740), chip_6042 },
667 { PCI_VDEVICE(TTI, 0x1742), chip_508x }, 667 { PCI_VDEVICE(TTI, 0x1742), chip_6042 },
668 668
669 { PCI_VDEVICE(MARVELL, 0x6040), chip_604x }, 669 { PCI_VDEVICE(MARVELL, 0x6040), chip_604x },
670 { PCI_VDEVICE(MARVELL, 0x6041), chip_604x }, 670 { PCI_VDEVICE(MARVELL, 0x6041), chip_604x },
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index c49ad0e61b6f..444af0415ca1 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -436,11 +436,16 @@ static struct ata_port_operations nv_nf2_ops = {
436 .hardreset = nv_noclassify_hardreset, 436 .hardreset = nv_noclassify_hardreset,
437}; 437};
438 438
439/* CK804 finally gets hardreset right */ 439/* For initial probing after boot and hot plugging, hardreset mostly
440 * works fine on CK804 but curiously, reprobing on the initial port by
441 * rescanning or rmmod/insmod fails to acquire the initial D2H Reg FIS
442 * in somewhat undeterministic way. Use noclassify hardreset.
443 */
440static struct ata_port_operations nv_ck804_ops = { 444static struct ata_port_operations nv_ck804_ops = {
441 .inherits = &nv_common_ops, 445 .inherits = &nv_common_ops,
442 .freeze = nv_ck804_freeze, 446 .freeze = nv_ck804_freeze,
443 .thaw = nv_ck804_thaw, 447 .thaw = nv_ck804_thaw,
448 .hardreset = nv_noclassify_hardreset,
444 .host_stop = nv_ck804_host_stop, 449 .host_stop = nv_ck804_host_stop,
445}; 450};
446 451
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index 9f029595f454..d0091609e210 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -324,7 +324,7 @@ static void sil_fill_sg(struct ata_queued_cmd *qc)
324 324
325 prd->addr = cpu_to_le32(addr); 325 prd->addr = cpu_to_le32(addr);
326 prd->flags_len = cpu_to_le32(sg_len); 326 prd->flags_len = cpu_to_le32(sg_len);
327 VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", pi, addr, sg_len); 327 VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", si, addr, sg_len);
328 328
329 last_prd = prd; 329 last_prd = prd;
330 prd++; 330 prd++;
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index f5be8081cd81..735bbe2be51a 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -761,7 +761,7 @@ source "drivers/char/hw_random/Kconfig"
761 761
762config NVRAM 762config NVRAM
763 tristate "/dev/nvram support" 763 tristate "/dev/nvram support"
764 depends on ATARI || X86 || ARM || GENERIC_NVRAM 764 depends on ATARI || X86 || (ARM && RTC_DRV_CMOS) || GENERIC_NVRAM
765 ---help--- 765 ---help---
766 If you say Y here and create a character special file /dev/nvram 766 If you say Y here and create a character special file /dev/nvram
767 with major number 10 and minor number 144 using mknod ("man mknod"), 767 with major number 10 and minor number 144 using mknod ("man mknod"),
diff --git a/drivers/dca/dca-core.c b/drivers/dca/dca-core.c
index 55433849bfa6..33bd75347518 100644
--- a/drivers/dca/dca-core.c
+++ b/drivers/dca/dca-core.c
@@ -28,7 +28,7 @@
28#include <linux/device.h> 28#include <linux/device.h>
29#include <linux/dca.h> 29#include <linux/dca.h>
30 30
31#define DCA_VERSION "1.4" 31#define DCA_VERSION "1.8"
32 32
33MODULE_VERSION(DCA_VERSION); 33MODULE_VERSION(DCA_VERSION);
34MODULE_LICENSE("GPL"); 34MODULE_LICENSE("GPL");
@@ -60,16 +60,17 @@ int dca_add_requester(struct device *dev)
60{ 60{
61 struct dca_provider *dca; 61 struct dca_provider *dca;
62 int err, slot = -ENODEV; 62 int err, slot = -ENODEV;
63 unsigned long flags;
63 64
64 if (!dev) 65 if (!dev)
65 return -EFAULT; 66 return -EFAULT;
66 67
67 spin_lock(&dca_lock); 68 spin_lock_irqsave(&dca_lock, flags);
68 69
69 /* check if the requester has not been added already */ 70 /* check if the requester has not been added already */
70 dca = dca_find_provider_by_dev(dev); 71 dca = dca_find_provider_by_dev(dev);
71 if (dca) { 72 if (dca) {
72 spin_unlock(&dca_lock); 73 spin_unlock_irqrestore(&dca_lock, flags);
73 return -EEXIST; 74 return -EEXIST;
74 } 75 }
75 76
@@ -78,19 +79,21 @@ int dca_add_requester(struct device *dev)
78 if (slot >= 0) 79 if (slot >= 0)
79 break; 80 break;
80 } 81 }
81 if (slot < 0) { 82
82 spin_unlock(&dca_lock); 83 spin_unlock_irqrestore(&dca_lock, flags);
84
85 if (slot < 0)
83 return slot; 86 return slot;
84 }
85 87
86 err = dca_sysfs_add_req(dca, dev, slot); 88 err = dca_sysfs_add_req(dca, dev, slot);
87 if (err) { 89 if (err) {
88 dca->ops->remove_requester(dca, dev); 90 spin_lock_irqsave(&dca_lock, flags);
89 spin_unlock(&dca_lock); 91 if (dca == dca_find_provider_by_dev(dev))
92 dca->ops->remove_requester(dca, dev);
93 spin_unlock_irqrestore(&dca_lock, flags);
90 return err; 94 return err;
91 } 95 }
92 96
93 spin_unlock(&dca_lock);
94 return 0; 97 return 0;
95} 98}
96EXPORT_SYMBOL_GPL(dca_add_requester); 99EXPORT_SYMBOL_GPL(dca_add_requester);
@@ -103,25 +106,25 @@ int dca_remove_requester(struct device *dev)
103{ 106{
104 struct dca_provider *dca; 107 struct dca_provider *dca;
105 int slot; 108 int slot;
109 unsigned long flags;
106 110
107 if (!dev) 111 if (!dev)
108 return -EFAULT; 112 return -EFAULT;
109 113
110 spin_lock(&dca_lock); 114 spin_lock_irqsave(&dca_lock, flags);
111 dca = dca_find_provider_by_dev(dev); 115 dca = dca_find_provider_by_dev(dev);
112 if (!dca) { 116 if (!dca) {
113 spin_unlock(&dca_lock); 117 spin_unlock_irqrestore(&dca_lock, flags);
114 return -ENODEV; 118 return -ENODEV;
115 } 119 }
116 slot = dca->ops->remove_requester(dca, dev); 120 slot = dca->ops->remove_requester(dca, dev);
117 if (slot < 0) { 121 spin_unlock_irqrestore(&dca_lock, flags);
118 spin_unlock(&dca_lock); 122
123 if (slot < 0)
119 return slot; 124 return slot;
120 }
121 125
122 dca_sysfs_remove_req(dca, slot); 126 dca_sysfs_remove_req(dca, slot);
123 127
124 spin_unlock(&dca_lock);
125 return 0; 128 return 0;
126} 129}
127EXPORT_SYMBOL_GPL(dca_remove_requester); 130EXPORT_SYMBOL_GPL(dca_remove_requester);
@@ -135,17 +138,18 @@ u8 dca_common_get_tag(struct device *dev, int cpu)
135{ 138{
136 struct dca_provider *dca; 139 struct dca_provider *dca;
137 u8 tag; 140 u8 tag;
141 unsigned long flags;
138 142
139 spin_lock(&dca_lock); 143 spin_lock_irqsave(&dca_lock, flags);
140 144
141 dca = dca_find_provider_by_dev(dev); 145 dca = dca_find_provider_by_dev(dev);
142 if (!dca) { 146 if (!dca) {
143 spin_unlock(&dca_lock); 147 spin_unlock_irqrestore(&dca_lock, flags);
144 return -ENODEV; 148 return -ENODEV;
145 } 149 }
146 tag = dca->ops->get_tag(dca, dev, cpu); 150 tag = dca->ops->get_tag(dca, dev, cpu);
147 151
148 spin_unlock(&dca_lock); 152 spin_unlock_irqrestore(&dca_lock, flags);
149 return tag; 153 return tag;
150} 154}
151 155
@@ -217,11 +221,16 @@ static BLOCKING_NOTIFIER_HEAD(dca_provider_chain);
217int register_dca_provider(struct dca_provider *dca, struct device *dev) 221int register_dca_provider(struct dca_provider *dca, struct device *dev)
218{ 222{
219 int err; 223 int err;
224 unsigned long flags;
220 225
221 err = dca_sysfs_add_provider(dca, dev); 226 err = dca_sysfs_add_provider(dca, dev);
222 if (err) 227 if (err)
223 return err; 228 return err;
229
230 spin_lock_irqsave(&dca_lock, flags);
224 list_add(&dca->node, &dca_providers); 231 list_add(&dca->node, &dca_providers);
232 spin_unlock_irqrestore(&dca_lock, flags);
233
225 blocking_notifier_call_chain(&dca_provider_chain, 234 blocking_notifier_call_chain(&dca_provider_chain,
226 DCA_PROVIDER_ADD, NULL); 235 DCA_PROVIDER_ADD, NULL);
227 return 0; 236 return 0;
@@ -234,9 +243,15 @@ EXPORT_SYMBOL_GPL(register_dca_provider);
234 */ 243 */
235void unregister_dca_provider(struct dca_provider *dca) 244void unregister_dca_provider(struct dca_provider *dca)
236{ 245{
246 unsigned long flags;
247
237 blocking_notifier_call_chain(&dca_provider_chain, 248 blocking_notifier_call_chain(&dca_provider_chain,
238 DCA_PROVIDER_REMOVE, NULL); 249 DCA_PROVIDER_REMOVE, NULL);
250
251 spin_lock_irqsave(&dca_lock, flags);
239 list_del(&dca->node); 252 list_del(&dca->node);
253 spin_unlock_irqrestore(&dca_lock, flags);
254
240 dca_sysfs_remove_provider(dca); 255 dca_sysfs_remove_provider(dca);
241} 256}
242EXPORT_SYMBOL_GPL(unregister_dca_provider); 257EXPORT_SYMBOL_GPL(unregister_dca_provider);
diff --git a/drivers/ide/qd65xx.c b/drivers/ide/qd65xx.c
index 5b2e3af43c4b..08c4fa35e9b1 100644
--- a/drivers/ide/qd65xx.c
+++ b/drivers/ide/qd65xx.c
@@ -16,7 +16,7 @@
16 16
17/* 17/*
18 * Rewritten from the work of Colten Edwards <pje120@cs.usask.ca> by 18 * Rewritten from the work of Colten Edwards <pje120@cs.usask.ca> by
19 * Samuel Thibault <samuel.thibault@fnac.net> 19 * Samuel Thibault <samuel.thibault@ens-lyon.org>
20 */ 20 */
21 21
22#include <linux/module.h> 22#include <linux/module.h>
diff --git a/drivers/ide/qd65xx.h b/drivers/ide/qd65xx.h
index 6636f9665d16..d7e67a1a1dcc 100644
--- a/drivers/ide/qd65xx.h
+++ b/drivers/ide/qd65xx.h
@@ -4,7 +4,7 @@
4 4
5/* 5/*
6 * Authors: Petr Soucek <petr@ryston.cz> 6 * Authors: Petr Soucek <petr@ryston.cz>
7 * Samuel Thibault <samuel.thibault@fnac.net> 7 * Samuel Thibault <samuel.thibault@ens-lyon.org>
8 */ 8 */
9 9
10/* truncates a in [b,c] */ 10/* truncates a in [b,c] */
diff --git a/drivers/mfd/pcf50633-core.c b/drivers/mfd/pcf50633-core.c
index 24508e28e3fb..ea9488e7ad6d 100644
--- a/drivers/mfd/pcf50633-core.c
+++ b/drivers/mfd/pcf50633-core.c
@@ -626,7 +626,6 @@ static int __devinit pcf50633_probe(struct i2c_client *client,
626 } 626 }
627 627
628 if (client->irq) { 628 if (client->irq) {
629 set_irq_handler(client->irq, handle_level_irq);
630 ret = request_irq(client->irq, pcf50633_irq, 629 ret = request_irq(client->irq, pcf50633_irq,
631 IRQF_TRIGGER_LOW, "pcf50633", pcf); 630 IRQF_TRIGGER_LOW, "pcf50633", pcf);
632 631
diff --git a/drivers/misc/sgi-xp/xpnet.c b/drivers/misc/sgi-xp/xpnet.c
index 7957f525b2f4..6faefcffcb53 100644
--- a/drivers/misc/sgi-xp/xpnet.c
+++ b/drivers/misc/sgi-xp/xpnet.c
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1999-2008 Silicon Graphics, Inc. All rights reserved. 6 * Copyright (C) 1999-2009 Silicon Graphics, Inc. All rights reserved.
7 */ 7 */
8 8
9/* 9/*
@@ -551,6 +551,7 @@ xpnet_init(void)
551 551
552 netif_carrier_off(xpnet_device); 552 netif_carrier_off(xpnet_device);
553 553
554 xpnet_device->netdev_ops = &xpnet_netdev_ops;
554 xpnet_device->mtu = XPNET_DEF_MTU; 555 xpnet_device->mtu = XPNET_DEF_MTU;
555 556
556 /* 557 /*
diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c
index 7df6bbf0e4d9..6f6a0f6dafd6 100644
--- a/drivers/mtd/maps/sa1100-flash.c
+++ b/drivers/mtd/maps/sa1100-flash.c
@@ -453,7 +453,7 @@ static struct platform_driver sa1100_mtd_driver = {
453 .resume = sa1100_mtd_resume, 453 .resume = sa1100_mtd_resume,
454 .shutdown = sa1100_mtd_shutdown, 454 .shutdown = sa1100_mtd_shutdown,
455 .driver = { 455 .driver = {
456 .name = "flash", 456 .name = "sa1100-mtd",
457 .owner = THIS_MODULE, 457 .owner = THIS_MODULE,
458 }, 458 },
459}; 459};
@@ -474,4 +474,4 @@ module_exit(sa1100_mtd_exit);
474MODULE_AUTHOR("Nicolas Pitre"); 474MODULE_AUTHOR("Nicolas Pitre");
475MODULE_DESCRIPTION("SA1100 CFI map driver"); 475MODULE_DESCRIPTION("SA1100 CFI map driver");
476MODULE_LICENSE("GPL"); 476MODULE_LICENSE("GPL");
477MODULE_ALIAS("platform:flash"); 477MODULE_ALIAS("platform:sa1100-mtd");
diff --git a/drivers/net/arm/etherh.c b/drivers/net/arm/etherh.c
index d15d8b79d8e5..54b52e5b1821 100644
--- a/drivers/net/arm/etherh.c
+++ b/drivers/net/arm/etherh.c
@@ -646,7 +646,7 @@ static const struct net_device_ops etherh_netdev_ops = {
646 .ndo_get_stats = ei_get_stats, 646 .ndo_get_stats = ei_get_stats,
647 .ndo_set_multicast_list = ei_set_multicast_list, 647 .ndo_set_multicast_list = ei_set_multicast_list,
648 .ndo_validate_addr = eth_validate_addr, 648 .ndo_validate_addr = eth_validate_addr,
649 .ndo_set_mac_address = eth_set_mac_addr, 649 .ndo_set_mac_address = eth_mac_addr,
650 .ndo_change_mtu = eth_change_mtu, 650 .ndo_change_mtu = eth_change_mtu,
651#ifdef CONFIG_NET_POLL_CONTROLLER 651#ifdef CONFIG_NET_POLL_CONTROLLER
652 .ndo_poll_controller = ei_poll, 652 .ndo_poll_controller = ei_poll,
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index 840b3d1a22f5..bbbc3bb08aa5 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -806,7 +806,7 @@ static int cas_reset_mii_phy(struct cas *cp)
806 806
807 cas_phy_write(cp, MII_BMCR, BMCR_RESET); 807 cas_phy_write(cp, MII_BMCR, BMCR_RESET);
808 udelay(100); 808 udelay(100);
809 while (limit--) { 809 while (--limit) {
810 val = cas_phy_read(cp, MII_BMCR); 810 val = cas_phy_read(cp, MII_BMCR);
811 if ((val & BMCR_RESET) == 0) 811 if ((val & BMCR_RESET) == 0)
812 break; 812 break;
@@ -979,7 +979,7 @@ static void cas_phy_init(struct cas *cp)
979 writel(val, cp->regs + REG_PCS_MII_CTRL); 979 writel(val, cp->regs + REG_PCS_MII_CTRL);
980 980
981 limit = STOP_TRIES; 981 limit = STOP_TRIES;
982 while (limit-- > 0) { 982 while (--limit > 0) {
983 udelay(10); 983 udelay(10);
984 if ((readl(cp->regs + REG_PCS_MII_CTRL) & 984 if ((readl(cp->regs + REG_PCS_MII_CTRL) &
985 PCS_MII_RESET) == 0) 985 PCS_MII_RESET) == 0)
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index c986978ce761..6bd63cc67b3e 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -940,7 +940,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
940 err = pci_enable_device(pdev); 940 err = pci_enable_device(pdev);
941 } else { 941 } else {
942 bars = pci_select_bars(pdev, IORESOURCE_MEM); 942 bars = pci_select_bars(pdev, IORESOURCE_MEM);
943 err = pci_enable_device(pdev); 943 err = pci_enable_device_mem(pdev);
944 } 944 }
945 if (err) 945 if (err)
946 return err; 946 return err;
diff --git a/drivers/net/ibm_newemac/phy.c b/drivers/net/ibm_newemac/phy.c
index c40cd8df2212..ac9d964e59ec 100644
--- a/drivers/net/ibm_newemac/phy.c
+++ b/drivers/net/ibm_newemac/phy.c
@@ -60,7 +60,7 @@ int emac_mii_reset_phy(struct mii_phy *phy)
60 60
61 udelay(300); 61 udelay(300);
62 62
63 while (limit--) { 63 while (--limit) {
64 val = phy_read(phy, MII_BMCR); 64 val = phy_read(phy, MII_BMCR);
65 if (val >= 0 && (val & BMCR_RESET) == 0) 65 if (val >= 0 && (val & BMCR_RESET) == 0)
66 break; 66 break;
@@ -84,7 +84,7 @@ int emac_mii_reset_gpcs(struct mii_phy *phy)
84 84
85 udelay(300); 85 udelay(300);
86 86
87 while (limit--) { 87 while (--limit) {
88 val = gpcs_phy_read(phy, MII_BMCR); 88 val = gpcs_phy_read(phy, MII_BMCR);
89 if (val >= 0 && (val & BMCR_RESET) == 0) 89 if (val >= 0 && (val & BMCR_RESET) == 0)
90 break; 90 break;
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index c38ed777f0a8..a6999403f37b 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -586,7 +586,7 @@ static int pcnet_config(struct pcmcia_device *link)
586 } 586 }
587 587
588 if ((link->conf.ConfigBase == 0x03c0) 588 if ((link->conf.ConfigBase == 0x03c0)
589 && (link->manf_id == 0x149) && (link->card_id = 0xc1ab)) { 589 && (link->manf_id == 0x149) && (link->card_id == 0xc1ab)) {
590 printk(KERN_INFO "pcnet_cs: this is an AX88190 card!\n"); 590 printk(KERN_INFO "pcnet_cs: this is an AX88190 card!\n");
591 printk(KERN_INFO "pcnet_cs: use axnet_cs instead.\n"); 591 printk(KERN_INFO "pcnet_cs: use axnet_cs instead.\n");
592 goto failed; 592 goto failed;
diff --git a/drivers/net/qlge/qlge.h b/drivers/net/qlge/qlge.h
index c1dadadfab18..e6fdce9206cc 100644
--- a/drivers/net/qlge/qlge.h
+++ b/drivers/net/qlge/qlge.h
@@ -787,12 +787,12 @@ struct mbox_params {
787 787
788struct flash_params { 788struct flash_params {
789 u8 dev_id_str[4]; 789 u8 dev_id_str[4];
790 u16 size; 790 __le16 size;
791 u16 csum; 791 __le16 csum;
792 u16 ver; 792 __le16 ver;
793 u16 sub_dev_id; 793 __le16 sub_dev_id;
794 u8 mac_addr[6]; 794 u8 mac_addr[6];
795 u16 res; 795 __le16 res;
796}; 796};
797 797
798 798
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
index 45421c8b6010..3d1d7b6e55aa 100644
--- a/drivers/net/qlge/qlge_main.c
+++ b/drivers/net/qlge/qlge_main.c
@@ -641,7 +641,7 @@ static void ql_enable_all_completion_interrupts(struct ql_adapter *qdev)
641 641
642} 642}
643 643
644static int ql_read_flash_word(struct ql_adapter *qdev, int offset, u32 *data) 644static int ql_read_flash_word(struct ql_adapter *qdev, int offset, __le32 *data)
645{ 645{
646 int status = 0; 646 int status = 0;
647 /* wait for reg to come ready */ 647 /* wait for reg to come ready */
@@ -656,8 +656,11 @@ static int ql_read_flash_word(struct ql_adapter *qdev, int offset, u32 *data)
656 FLASH_ADDR, FLASH_ADDR_RDY, FLASH_ADDR_ERR); 656 FLASH_ADDR, FLASH_ADDR_RDY, FLASH_ADDR_ERR);
657 if (status) 657 if (status)
658 goto exit; 658 goto exit;
659 /* get the data */ 659 /* This data is stored on flash as an array of
660 *data = ql_read32(qdev, FLASH_DATA); 660 * __le32. Since ql_read32() returns cpu endian
661 * we need to swap it back.
662 */
663 *data = cpu_to_le32(ql_read32(qdev, FLASH_DATA));
661exit: 664exit:
662 return status; 665 return status;
663} 666}
@@ -666,13 +669,20 @@ static int ql_get_flash_params(struct ql_adapter *qdev)
666{ 669{
667 int i; 670 int i;
668 int status; 671 int status;
669 u32 *p = (u32 *)&qdev->flash; 672 __le32 *p = (__le32 *)&qdev->flash;
673 u32 offset = 0;
674
675 /* Second function's parameters follow the first
676 * function's.
677 */
678 if (qdev->func)
679 offset = sizeof(qdev->flash) / sizeof(u32);
670 680
671 if (ql_sem_spinlock(qdev, SEM_FLASH_MASK)) 681 if (ql_sem_spinlock(qdev, SEM_FLASH_MASK))
672 return -ETIMEDOUT; 682 return -ETIMEDOUT;
673 683
674 for (i = 0; i < sizeof(qdev->flash) / sizeof(u32); i++, p++) { 684 for (i = 0; i < sizeof(qdev->flash) / sizeof(u32); i++, p++) {
675 status = ql_read_flash_word(qdev, i, p); 685 status = ql_read_flash_word(qdev, i+offset, p);
676 if (status) { 686 if (status) {
677 QPRINTK(qdev, IFUP, ERR, "Error reading flash.\n"); 687 QPRINTK(qdev, IFUP, ERR, "Error reading flash.\n");
678 goto exit; 688 goto exit;
@@ -3826,7 +3836,7 @@ static int qlge_suspend(struct pci_dev *pdev, pm_message_t state)
3826{ 3836{
3827 struct net_device *ndev = pci_get_drvdata(pdev); 3837 struct net_device *ndev = pci_get_drvdata(pdev);
3828 struct ql_adapter *qdev = netdev_priv(ndev); 3838 struct ql_adapter *qdev = netdev_priv(ndev);
3829 int err; 3839 int err, i;
3830 3840
3831 netif_device_detach(ndev); 3841 netif_device_detach(ndev);
3832 3842
@@ -3836,6 +3846,9 @@ static int qlge_suspend(struct pci_dev *pdev, pm_message_t state)
3836 return err; 3846 return err;
3837 } 3847 }
3838 3848
3849 for (i = qdev->rss_ring_first_cq_id; i < qdev->rx_ring_count; i++)
3850 netif_napi_del(&qdev->rx_ring[i].napi);
3851
3839 err = pci_save_state(pdev); 3852 err = pci_save_state(pdev);
3840 if (err) 3853 if (err)
3841 return err; 3854 return err;
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index bf3aa2a1effe..223cde0d43be 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -220,9 +220,9 @@ static void smc911x_reset(struct net_device *dev)
220 220
221 /* make sure EEPROM has finished loading before setting GPIO_CFG */ 221 /* make sure EEPROM has finished loading before setting GPIO_CFG */
222 timeout=1000; 222 timeout=1000;
223 while ( timeout-- && (SMC_GET_E2P_CMD(lp) & E2P_CMD_EPC_BUSY_)) { 223 while (--timeout && (SMC_GET_E2P_CMD(lp) & E2P_CMD_EPC_BUSY_))
224 udelay(10); 224 udelay(10);
225 } 225
226 if (timeout == 0){ 226 if (timeout == 0){
227 PRINTK("%s: smc911x_reset timeout waiting for EEPROM busy\n", dev->name); 227 PRINTK("%s: smc911x_reset timeout waiting for EEPROM busy\n", dev->name);
228 return; 228 return;
diff --git a/drivers/net/smsc9420.c b/drivers/net/smsc9420.c
index d801900a5036..a1e4b3895b33 100644
--- a/drivers/net/smsc9420.c
+++ b/drivers/net/smsc9420.c
@@ -498,7 +498,7 @@ static void smsc9420_check_mac_address(struct net_device *dev)
498static void smsc9420_stop_tx(struct smsc9420_pdata *pd) 498static void smsc9420_stop_tx(struct smsc9420_pdata *pd)
499{ 499{
500 u32 dmac_control, mac_cr, dma_intr_ena; 500 u32 dmac_control, mac_cr, dma_intr_ena;
501 int timeOut = 1000; 501 int timeout = 1000;
502 502
503 /* disable TX DMAC */ 503 /* disable TX DMAC */
504 dmac_control = smsc9420_reg_read(pd, DMAC_CONTROL); 504 dmac_control = smsc9420_reg_read(pd, DMAC_CONTROL);
@@ -506,13 +506,13 @@ static void smsc9420_stop_tx(struct smsc9420_pdata *pd)
506 smsc9420_reg_write(pd, DMAC_CONTROL, dmac_control); 506 smsc9420_reg_write(pd, DMAC_CONTROL, dmac_control);
507 507
508 /* Wait max 10ms for transmit process to stop */ 508 /* Wait max 10ms for transmit process to stop */
509 while (timeOut--) { 509 while (--timeout) {
510 if (smsc9420_reg_read(pd, DMAC_STATUS) & DMAC_STS_TS_) 510 if (smsc9420_reg_read(pd, DMAC_STATUS) & DMAC_STS_TS_)
511 break; 511 break;
512 udelay(10); 512 udelay(10);
513 } 513 }
514 514
515 if (!timeOut) 515 if (!timeout)
516 smsc_warn(IFDOWN, "TX DMAC failed to stop"); 516 smsc_warn(IFDOWN, "TX DMAC failed to stop");
517 517
518 /* ACK Tx DMAC stop bit */ 518 /* ACK Tx DMAC stop bit */
@@ -596,7 +596,7 @@ static void smsc9420_free_rx_ring(struct smsc9420_pdata *pd)
596 596
597static void smsc9420_stop_rx(struct smsc9420_pdata *pd) 597static void smsc9420_stop_rx(struct smsc9420_pdata *pd)
598{ 598{
599 int timeOut = 1000; 599 int timeout = 1000;
600 u32 mac_cr, dmac_control, dma_intr_ena; 600 u32 mac_cr, dmac_control, dma_intr_ena;
601 601
602 /* mask RX DMAC interrupts */ 602 /* mask RX DMAC interrupts */
@@ -617,13 +617,13 @@ static void smsc9420_stop_rx(struct smsc9420_pdata *pd)
617 smsc9420_pci_flush_write(pd); 617 smsc9420_pci_flush_write(pd);
618 618
619 /* wait up to 10ms for receive to stop */ 619 /* wait up to 10ms for receive to stop */
620 while (timeOut--) { 620 while (--timeout) {
621 if (smsc9420_reg_read(pd, DMAC_STATUS) & DMAC_STS_RS_) 621 if (smsc9420_reg_read(pd, DMAC_STATUS) & DMAC_STS_RS_)
622 break; 622 break;
623 udelay(10); 623 udelay(10);
624 } 624 }
625 625
626 if (!timeOut) 626 if (!timeout)
627 smsc_warn(IFDOWN, "RX DMAC did not stop! timeout."); 627 smsc_warn(IFDOWN, "RX DMAC did not stop! timeout.");
628 628
629 /* ACK the Rx DMAC stop bit */ 629 /* ACK the Rx DMAC stop bit */
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 86c765d83de1..b17efa9cc530 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -148,7 +148,7 @@ static u16 __phy_read(struct gem *gp, int phy_addr, int reg)
148 cmd |= (MIF_FRAME_TAMSB); 148 cmd |= (MIF_FRAME_TAMSB);
149 writel(cmd, gp->regs + MIF_FRAME); 149 writel(cmd, gp->regs + MIF_FRAME);
150 150
151 while (limit--) { 151 while (--limit) {
152 cmd = readl(gp->regs + MIF_FRAME); 152 cmd = readl(gp->regs + MIF_FRAME);
153 if (cmd & MIF_FRAME_TALSB) 153 if (cmd & MIF_FRAME_TALSB)
154 break; 154 break;
diff --git a/drivers/net/sungem_phy.c b/drivers/net/sungem_phy.c
index 61843fd57525..78f8cee5fd74 100644
--- a/drivers/net/sungem_phy.c
+++ b/drivers/net/sungem_phy.c
@@ -79,7 +79,7 @@ static int reset_one_mii_phy(struct mii_phy* phy, int phy_id)
79 79
80 udelay(100); 80 udelay(100);
81 81
82 while (limit--) { 82 while (--limit) {
83 val = __phy_read(phy, phy_id, MII_BMCR); 83 val = __phy_read(phy, phy_id, MII_BMCR);
84 if ((val & BMCR_RESET) == 0) 84 if ((val & BMCR_RESET) == 0)
85 break; 85 break;
diff --git a/drivers/net/sunqe.c b/drivers/net/sunqe.c
index 6e8f377355fe..fe0c3f244562 100644
--- a/drivers/net/sunqe.c
+++ b/drivers/net/sunqe.c
@@ -227,7 +227,7 @@ static int qe_init(struct sunqe *qep, int from_irq)
227 if (!(sbus_readb(mregs + MREGS_PHYCONFIG) & MREGS_PHYCONFIG_LTESTDIS)) { 227 if (!(sbus_readb(mregs + MREGS_PHYCONFIG) & MREGS_PHYCONFIG_LTESTDIS)) {
228 int tries = 50; 228 int tries = 50;
229 229
230 while (tries--) { 230 while (--tries) {
231 u8 tmp; 231 u8 tmp;
232 232
233 mdelay(5); 233 mdelay(5);
diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c
index 75461dbd4876..a9fd2b2ccaf6 100644
--- a/drivers/net/tsi108_eth.c
+++ b/drivers/net/tsi108_eth.c
@@ -1237,7 +1237,7 @@ static void tsi108_init_phy(struct net_device *dev)
1237 spin_lock_irqsave(&phy_lock, flags); 1237 spin_lock_irqsave(&phy_lock, flags);
1238 1238
1239 tsi108_write_mii(data, MII_BMCR, BMCR_RESET); 1239 tsi108_write_mii(data, MII_BMCR, BMCR_RESET);
1240 while (i--){ 1240 while (--i) {
1241 if(!(tsi108_read_mii(data, MII_BMCR) & BMCR_RESET)) 1241 if(!(tsi108_read_mii(data, MII_BMCR) & BMCR_RESET))
1242 break; 1242 break;
1243 udelay(10); 1243 udelay(10);
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
index d5d53b633cf8..0bf2114738be 100644
--- a/drivers/net/tulip/de2104x.c
+++ b/drivers/net/tulip/de2104x.c
@@ -392,7 +392,7 @@ static void de_rx (struct de_private *de)
392 unsigned drop = 0; 392 unsigned drop = 0;
393 int rc; 393 int rc;
394 394
395 while (rx_work--) { 395 while (--rx_work) {
396 u32 status, len; 396 u32 status, len;
397 dma_addr_t mapping; 397 dma_addr_t mapping;
398 struct sk_buff *skb, *copy_skb; 398 struct sk_buff *skb, *copy_skb;
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 0d0fa91c0251..fe98acaead97 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -455,6 +455,7 @@ static const struct usb_device_id hso_ids[] = {
455 {icon321_port_device(0x0af0, 0xd033)}, /* Icon-322 */ 455 {icon321_port_device(0x0af0, 0xd033)}, /* Icon-322 */
456 {USB_DEVICE(0x0af0, 0x7301)}, /* GE40x */ 456 {USB_DEVICE(0x0af0, 0x7301)}, /* GE40x */
457 {USB_DEVICE(0x0af0, 0x7361)}, /* GE40x */ 457 {USB_DEVICE(0x0af0, 0x7361)}, /* GE40x */
458 {USB_DEVICE(0x0af0, 0x7381)}, /* GE40x */
458 {USB_DEVICE(0x0af0, 0x7401)}, /* GI 0401 */ 459 {USB_DEVICE(0x0af0, 0x7401)}, /* GI 0401 */
459 {USB_DEVICE(0x0af0, 0x7501)}, /* GTM 382 */ 460 {USB_DEVICE(0x0af0, 0x7501)}, /* GTM 382 */
460 {USB_DEVICE(0x0af0, 0x7601)}, /* GE40x */ 461 {USB_DEVICE(0x0af0, 0x7601)}, /* GE40x */
@@ -462,7 +463,8 @@ static const struct usb_device_id hso_ids[] = {
462 {USB_DEVICE(0x0af0, 0x7801)}, 463 {USB_DEVICE(0x0af0, 0x7801)},
463 {USB_DEVICE(0x0af0, 0x7901)}, 464 {USB_DEVICE(0x0af0, 0x7901)},
464 {USB_DEVICE(0x0af0, 0x7361)}, 465 {USB_DEVICE(0x0af0, 0x7361)},
465 {icon321_port_device(0x0af0, 0xd051)}, 466 {USB_DEVICE(0x0af0, 0xd057)},
467 {USB_DEVICE(0x0af0, 0xd055)},
466 {} 468 {}
467}; 469};
468MODULE_DEVICE_TABLE(usb, hso_ids); 470MODULE_DEVICE_TABLE(usb, hso_ids);
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 8e93341f3e82..9c2358391147 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -553,12 +553,24 @@ static void detach_groups(struct config_group *group)
553 553
554 child = sd->s_dentry; 554 child = sd->s_dentry;
555 555
556 /*
557 * Note: we hide this from lockdep since we have no way
558 * to teach lockdep about recursive
559 * I_MUTEX_PARENT -> I_MUTEX_CHILD patterns along a path
560 * in an inode tree, which are valid as soon as
561 * I_MUTEX_PARENT -> I_MUTEX_CHILD is valid from a
562 * parent inode to one of its children.
563 */
564 lockdep_off();
556 mutex_lock(&child->d_inode->i_mutex); 565 mutex_lock(&child->d_inode->i_mutex);
566 lockdep_on();
557 567
558 configfs_detach_group(sd->s_element); 568 configfs_detach_group(sd->s_element);
559 child->d_inode->i_flags |= S_DEAD; 569 child->d_inode->i_flags |= S_DEAD;
560 570
571 lockdep_off();
561 mutex_unlock(&child->d_inode->i_mutex); 572 mutex_unlock(&child->d_inode->i_mutex);
573 lockdep_on();
562 574
563 d_delete(child); 575 d_delete(child);
564 dput(child); 576 dput(child);
@@ -748,11 +760,22 @@ static int configfs_attach_item(struct config_item *parent_item,
748 * We are going to remove an inode and its dentry but 760 * We are going to remove an inode and its dentry but
749 * the VFS may already have hit and used them. Thus, 761 * the VFS may already have hit and used them. Thus,
750 * we must lock them as rmdir() would. 762 * we must lock them as rmdir() would.
763 *
764 * Note: we hide this from lockdep since we have no way
765 * to teach lockdep about recursive
766 * I_MUTEX_PARENT -> I_MUTEX_CHILD patterns along a path
767 * in an inode tree, which are valid as soon as
768 * I_MUTEX_PARENT -> I_MUTEX_CHILD is valid from a
769 * parent inode to one of its children.
751 */ 770 */
771 lockdep_off();
752 mutex_lock(&dentry->d_inode->i_mutex); 772 mutex_lock(&dentry->d_inode->i_mutex);
773 lockdep_on();
753 configfs_remove_dir(item); 774 configfs_remove_dir(item);
754 dentry->d_inode->i_flags |= S_DEAD; 775 dentry->d_inode->i_flags |= S_DEAD;
776 lockdep_off();
755 mutex_unlock(&dentry->d_inode->i_mutex); 777 mutex_unlock(&dentry->d_inode->i_mutex);
778 lockdep_on();
756 d_delete(dentry); 779 d_delete(dentry);
757 } 780 }
758 } 781 }
@@ -787,14 +810,25 @@ static int configfs_attach_group(struct config_item *parent_item,
787 * 810 *
788 * We must also lock the inode to remove it safely in case of 811 * We must also lock the inode to remove it safely in case of
789 * error, as rmdir() would. 812 * error, as rmdir() would.
813 *
814 * Note: we hide this from lockdep since we have no way
815 * to teach lockdep about recursive
816 * I_MUTEX_PARENT -> I_MUTEX_CHILD patterns along a path
817 * in an inode tree, which are valid as soon as
818 * I_MUTEX_PARENT -> I_MUTEX_CHILD is valid from a
819 * parent inode to one of its children.
790 */ 820 */
821 lockdep_off();
791 mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_CHILD); 822 mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_CHILD);
823 lockdep_on();
792 ret = populate_groups(to_config_group(item)); 824 ret = populate_groups(to_config_group(item));
793 if (ret) { 825 if (ret) {
794 configfs_detach_item(item); 826 configfs_detach_item(item);
795 dentry->d_inode->i_flags |= S_DEAD; 827 dentry->d_inode->i_flags |= S_DEAD;
796 } 828 }
829 lockdep_off();
797 mutex_unlock(&dentry->d_inode->i_mutex); 830 mutex_unlock(&dentry->d_inode->i_mutex);
831 lockdep_on();
798 if (ret) 832 if (ret)
799 d_delete(dentry); 833 d_delete(dentry);
800 } 834 }
@@ -956,7 +990,17 @@ static int configfs_depend_prep(struct dentry *origin,
956 BUG_ON(!origin || !sd); 990 BUG_ON(!origin || !sd);
957 991
958 /* Lock this guy on the way down */ 992 /* Lock this guy on the way down */
993 /*
994 * Note: we hide this from lockdep since we have no way
995 * to teach lockdep about recursive
996 * I_MUTEX_PARENT -> I_MUTEX_CHILD patterns along a path
997 * in an inode tree, which are valid as soon as
998 * I_MUTEX_PARENT -> I_MUTEX_CHILD is valid from a
999 * parent inode to one of its children.
1000 */
1001 lockdep_off();
959 mutex_lock(&sd->s_dentry->d_inode->i_mutex); 1002 mutex_lock(&sd->s_dentry->d_inode->i_mutex);
1003 lockdep_on();
960 if (sd->s_element == target) /* Boo-yah */ 1004 if (sd->s_element == target) /* Boo-yah */
961 goto out; 1005 goto out;
962 1006
@@ -970,7 +1014,9 @@ static int configfs_depend_prep(struct dentry *origin,
970 } 1014 }
971 1015
972 /* We looped all our children and didn't find target */ 1016 /* We looped all our children and didn't find target */
1017 lockdep_off();
973 mutex_unlock(&sd->s_dentry->d_inode->i_mutex); 1018 mutex_unlock(&sd->s_dentry->d_inode->i_mutex);
1019 lockdep_on();
974 ret = -ENOENT; 1020 ret = -ENOENT;
975 1021
976out: 1022out:
@@ -990,11 +1036,16 @@ static void configfs_depend_rollback(struct dentry *origin,
990 struct dentry *dentry = item->ci_dentry; 1036 struct dentry *dentry = item->ci_dentry;
991 1037
992 while (dentry != origin) { 1038 while (dentry != origin) {
1039 /* See comments in configfs_depend_prep() */
1040 lockdep_off();
993 mutex_unlock(&dentry->d_inode->i_mutex); 1041 mutex_unlock(&dentry->d_inode->i_mutex);
1042 lockdep_on();
994 dentry = dentry->d_parent; 1043 dentry = dentry->d_parent;
995 } 1044 }
996 1045
1046 lockdep_off();
997 mutex_unlock(&origin->d_inode->i_mutex); 1047 mutex_unlock(&origin->d_inode->i_mutex);
1048 lockdep_on();
998} 1049}
999 1050
1000int configfs_depend_item(struct configfs_subsystem *subsys, 1051int configfs_depend_item(struct configfs_subsystem *subsys,
@@ -1329,8 +1380,16 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry)
1329 } 1380 }
1330 1381
1331 /* Wait until the racing operation terminates */ 1382 /* Wait until the racing operation terminates */
1383 /*
1384 * Note: we hide this from lockdep since we are locked
1385 * with subclass I_MUTEX_NORMAL from vfs_rmdir() (why
1386 * not I_MUTEX_CHILD?), and I_MUTEX_XATTR or
1387 * I_MUTEX_QUOTA are not relevant for the locked inode.
1388 */
1389 lockdep_off();
1332 mutex_lock(wait_mutex); 1390 mutex_lock(wait_mutex);
1333 mutex_unlock(wait_mutex); 1391 mutex_unlock(wait_mutex);
1392 lockdep_on();
1334 } 1393 }
1335 } while (ret == -EAGAIN); 1394 } while (ret == -EAGAIN);
1336 1395
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index d861096c9d81..60fe74035db5 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -5390,6 +5390,9 @@ int ocfs2_remove_btree_range(struct inode *inode,
5390 goto out; 5390 goto out;
5391 } 5391 }
5392 5392
5393 vfs_dq_free_space_nodirty(inode,
5394 ocfs2_clusters_to_bytes(inode->i_sb, len));
5395
5393 ret = ocfs2_remove_extent(inode, et, cpos, len, handle, meta_ac, 5396 ret = ocfs2_remove_extent(inode, et, cpos, len, handle, meta_ac,
5394 dealloc); 5397 dealloc);
5395 if (ret) { 5398 if (ret) {
diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c
index b1cc7c381e88..e9d7c2038c0f 100644
--- a/fs/ocfs2/dcache.c
+++ b/fs/ocfs2/dcache.c
@@ -38,6 +38,7 @@
38#include "dlmglue.h" 38#include "dlmglue.h"
39#include "file.h" 39#include "file.h"
40#include "inode.h" 40#include "inode.h"
41#include "super.h"
41 42
42 43
43static int ocfs2_dentry_revalidate(struct dentry *dentry, 44static int ocfs2_dentry_revalidate(struct dentry *dentry,
@@ -294,6 +295,34 @@ out_attach:
294 return ret; 295 return ret;
295} 296}
296 297
298static DEFINE_SPINLOCK(dentry_list_lock);
299
300/* We limit the number of dentry locks to drop in one go. We have
301 * this limit so that we don't starve other users of ocfs2_wq. */
302#define DL_INODE_DROP_COUNT 64
303
304/* Drop inode references from dentry locks */
305void ocfs2_drop_dl_inodes(struct work_struct *work)
306{
307 struct ocfs2_super *osb = container_of(work, struct ocfs2_super,
308 dentry_lock_work);
309 struct ocfs2_dentry_lock *dl;
310 int drop_count = DL_INODE_DROP_COUNT;
311
312 spin_lock(&dentry_list_lock);
313 while (osb->dentry_lock_list && drop_count--) {
314 dl = osb->dentry_lock_list;
315 osb->dentry_lock_list = dl->dl_next;
316 spin_unlock(&dentry_list_lock);
317 iput(dl->dl_inode);
318 kfree(dl);
319 spin_lock(&dentry_list_lock);
320 }
321 if (osb->dentry_lock_list)
322 queue_work(ocfs2_wq, &osb->dentry_lock_work);
323 spin_unlock(&dentry_list_lock);
324}
325
297/* 326/*
298 * ocfs2_dentry_iput() and friends. 327 * ocfs2_dentry_iput() and friends.
299 * 328 *
@@ -318,16 +347,23 @@ out_attach:
318static void ocfs2_drop_dentry_lock(struct ocfs2_super *osb, 347static void ocfs2_drop_dentry_lock(struct ocfs2_super *osb,
319 struct ocfs2_dentry_lock *dl) 348 struct ocfs2_dentry_lock *dl)
320{ 349{
321 iput(dl->dl_inode);
322 ocfs2_simple_drop_lockres(osb, &dl->dl_lockres); 350 ocfs2_simple_drop_lockres(osb, &dl->dl_lockres);
323 ocfs2_lock_res_free(&dl->dl_lockres); 351 ocfs2_lock_res_free(&dl->dl_lockres);
324 kfree(dl); 352
353 /* We leave dropping of inode reference to ocfs2_wq as that can
354 * possibly lead to inode deletion which gets tricky */
355 spin_lock(&dentry_list_lock);
356 if (!osb->dentry_lock_list)
357 queue_work(ocfs2_wq, &osb->dentry_lock_work);
358 dl->dl_next = osb->dentry_lock_list;
359 osb->dentry_lock_list = dl;
360 spin_unlock(&dentry_list_lock);
325} 361}
326 362
327void ocfs2_dentry_lock_put(struct ocfs2_super *osb, 363void ocfs2_dentry_lock_put(struct ocfs2_super *osb,
328 struct ocfs2_dentry_lock *dl) 364 struct ocfs2_dentry_lock *dl)
329{ 365{
330 int unlock = 0; 366 int unlock;
331 367
332 BUG_ON(dl->dl_count == 0); 368 BUG_ON(dl->dl_count == 0);
333 369
diff --git a/fs/ocfs2/dcache.h b/fs/ocfs2/dcache.h
index c091c34d9883..d06e16c06640 100644
--- a/fs/ocfs2/dcache.h
+++ b/fs/ocfs2/dcache.h
@@ -29,8 +29,13 @@
29extern struct dentry_operations ocfs2_dentry_ops; 29extern struct dentry_operations ocfs2_dentry_ops;
30 30
31struct ocfs2_dentry_lock { 31struct ocfs2_dentry_lock {
32 /* Use count of dentry lock */
32 unsigned int dl_count; 33 unsigned int dl_count;
33 u64 dl_parent_blkno; 34 union {
35 /* Linked list of dentry locks to release */
36 struct ocfs2_dentry_lock *dl_next;
37 u64 dl_parent_blkno;
38 };
34 39
35 /* 40 /*
36 * The ocfs2_dentry_lock keeps an inode reference until 41 * The ocfs2_dentry_lock keeps an inode reference until
@@ -47,6 +52,8 @@ int ocfs2_dentry_attach_lock(struct dentry *dentry, struct inode *inode,
47void ocfs2_dentry_lock_put(struct ocfs2_super *osb, 52void ocfs2_dentry_lock_put(struct ocfs2_super *osb,
48 struct ocfs2_dentry_lock *dl); 53 struct ocfs2_dentry_lock *dl);
49 54
55void ocfs2_drop_dl_inodes(struct work_struct *work);
56
50struct dentry *ocfs2_find_local_alias(struct inode *inode, u64 parent_blkno, 57struct dentry *ocfs2_find_local_alias(struct inode *inode, u64 parent_blkno,
51 int skip_unhashed); 58 int skip_unhashed);
52 59
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index b0c4cadd4c45..206a2370876a 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -2860,6 +2860,10 @@ static void ocfs2_unlock_ast(void *opaque, int error)
2860 case OCFS2_UNLOCK_CANCEL_CONVERT: 2860 case OCFS2_UNLOCK_CANCEL_CONVERT:
2861 mlog(0, "Cancel convert success for %s\n", lockres->l_name); 2861 mlog(0, "Cancel convert success for %s\n", lockres->l_name);
2862 lockres->l_action = OCFS2_AST_INVALID; 2862 lockres->l_action = OCFS2_AST_INVALID;
2863 /* Downconvert thread may have requeued this lock, we
2864 * need to wake it. */
2865 if (lockres->l_flags & OCFS2_LOCK_BLOCKED)
2866 ocfs2_wake_downconvert_thread(ocfs2_get_lockres_osb(lockres));
2863 break; 2867 break;
2864 case OCFS2_UNLOCK_DROP_LOCK: 2868 case OCFS2_UNLOCK_DROP_LOCK:
2865 lockres->l_level = DLM_LOCK_IV; 2869 lockres->l_level = DLM_LOCK_IV;
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
index ad5c24a29edd..077384135f4e 100644
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -210,6 +210,7 @@ struct ocfs2_journal;
210struct ocfs2_slot_info; 210struct ocfs2_slot_info;
211struct ocfs2_recovery_map; 211struct ocfs2_recovery_map;
212struct ocfs2_quota_recovery; 212struct ocfs2_quota_recovery;
213struct ocfs2_dentry_lock;
213struct ocfs2_super 214struct ocfs2_super
214{ 215{
215 struct task_struct *commit_task; 216 struct task_struct *commit_task;
@@ -325,6 +326,11 @@ struct ocfs2_super
325 struct list_head blocked_lock_list; 326 struct list_head blocked_lock_list;
326 unsigned long blocked_lock_count; 327 unsigned long blocked_lock_count;
327 328
329 /* List of dentry locks to release. Anyone can add locks to
330 * the list, ocfs2_wq processes the list */
331 struct ocfs2_dentry_lock *dentry_lock_list;
332 struct work_struct dentry_lock_work;
333
328 wait_queue_head_t osb_mount_event; 334 wait_queue_head_t osb_mount_event;
329 335
330 /* Truncate log info */ 336 /* Truncate log info */
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
index f4efa89baee5..1ed0f7c86869 100644
--- a/fs/ocfs2/quota_global.c
+++ b/fs/ocfs2/quota_global.c
@@ -754,7 +754,9 @@ static int ocfs2_mark_dquot_dirty(struct dquot *dquot)
754 if (dquot->dq_flags & mask) 754 if (dquot->dq_flags & mask)
755 sync = 1; 755 sync = 1;
756 spin_unlock(&dq_data_lock); 756 spin_unlock(&dq_data_lock);
757 if (!sync) { 757 /* This is a slight hack but we can't afford getting global quota
758 * lock if we already have a transaction started. */
759 if (!sync || journal_current_handle()) {
758 status = ocfs2_write_dquot(dquot); 760 status = ocfs2_write_dquot(dquot);
759 goto out; 761 goto out;
760 } 762 }
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 43ed11345b59..b1cb38fbe807 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -1887,6 +1887,9 @@ static int ocfs2_initialize_super(struct super_block *sb,
1887 INIT_WORK(&journal->j_recovery_work, ocfs2_complete_recovery); 1887 INIT_WORK(&journal->j_recovery_work, ocfs2_complete_recovery);
1888 journal->j_state = OCFS2_JOURNAL_FREE; 1888 journal->j_state = OCFS2_JOURNAL_FREE;
1889 1889
1890 INIT_WORK(&osb->dentry_lock_work, ocfs2_drop_dl_inodes);
1891 osb->dentry_lock_list = NULL;
1892
1890 /* get some pseudo constants for clustersize bits */ 1893 /* get some pseudo constants for clustersize bits */
1891 osb->s_clustersize_bits = 1894 osb->s_clustersize_bits =
1892 le32_to_cpu(di->id2.i_super.s_clustersize_bits); 1895 le32_to_cpu(di->id2.i_super.s_clustersize_bits);
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index e1d638af6ac3..915039fffe6e 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -4729,13 +4729,6 @@ static int ocfs2_xattr_bucket_value_truncate(struct inode *inode,
4729 vb.vb_xv = (struct ocfs2_xattr_value_root *) 4729 vb.vb_xv = (struct ocfs2_xattr_value_root *)
4730 (vb.vb_bh->b_data + offset % blocksize); 4730 (vb.vb_bh->b_data + offset % blocksize);
4731 4731
4732 ret = ocfs2_xattr_bucket_journal_access(ctxt->handle, bucket,
4733 OCFS2_JOURNAL_ACCESS_WRITE);
4734 if (ret) {
4735 mlog_errno(ret);
4736 goto out;
4737 }
4738
4739 /* 4732 /*
4740 * From here on out we have to dirty the bucket. The generic 4733 * From here on out we have to dirty the bucket. The generic
4741 * value calls only modify one of the bucket's bhs, but we need 4734 * value calls only modify one of the bucket's bhs, but we need
@@ -4748,12 +4741,18 @@ static int ocfs2_xattr_bucket_value_truncate(struct inode *inode,
4748 ret = ocfs2_xattr_value_truncate(inode, &vb, len, ctxt); 4741 ret = ocfs2_xattr_value_truncate(inode, &vb, len, ctxt);
4749 if (ret) { 4742 if (ret) {
4750 mlog_errno(ret); 4743 mlog_errno(ret);
4751 goto out_dirty; 4744 goto out;
4745 }
4746
4747 ret = ocfs2_xattr_bucket_journal_access(ctxt->handle, bucket,
4748 OCFS2_JOURNAL_ACCESS_WRITE);
4749 if (ret) {
4750 mlog_errno(ret);
4751 goto out;
4752 } 4752 }
4753 4753
4754 xe->xe_value_size = cpu_to_le64(len); 4754 xe->xe_value_size = cpu_to_le64(len);
4755 4755
4756out_dirty:
4757 ocfs2_xattr_bucket_journal_dirty(ctxt->handle, bucket); 4756 ocfs2_xattr_bucket_journal_dirty(ctxt->handle, bucket);
4758 4757
4759out: 4758out:
diff --git a/fs/ubifs/budget.c b/fs/ubifs/budget.c
index 175f9c590b77..f393620890ee 100644
--- a/fs/ubifs/budget.c
+++ b/fs/ubifs/budget.c
@@ -689,7 +689,7 @@ long long ubifs_reported_space(const struct ubifs_info *c, long long free)
689} 689}
690 690
691/** 691/**
692 * ubifs_get_free_space - return amount of free space. 692 * ubifs_get_free_space_nolock - return amount of free space.
693 * @c: UBIFS file-system description object 693 * @c: UBIFS file-system description object
694 * 694 *
695 * This function calculates amount of free space to report to user-space. 695 * This function calculates amount of free space to report to user-space.
@@ -704,16 +704,14 @@ long long ubifs_reported_space(const struct ubifs_info *c, long long free)
704 * traditional file-systems, because they have way less overhead than UBIFS. 704 * traditional file-systems, because they have way less overhead than UBIFS.
705 * So, to keep users happy, UBIFS tries to take the overhead into account. 705 * So, to keep users happy, UBIFS tries to take the overhead into account.
706 */ 706 */
707long long ubifs_get_free_space(struct ubifs_info *c) 707long long ubifs_get_free_space_nolock(struct ubifs_info *c)
708{ 708{
709 int min_idx_lebs, rsvd_idx_lebs, lebs; 709 int rsvd_idx_lebs, lebs;
710 long long available, outstanding, free; 710 long long available, outstanding, free;
711 711
712 spin_lock(&c->space_lock); 712 ubifs_assert(c->min_idx_lebs == ubifs_calc_min_idx_lebs(c));
713 min_idx_lebs = c->min_idx_lebs;
714 ubifs_assert(min_idx_lebs == ubifs_calc_min_idx_lebs(c));
715 outstanding = c->budg_data_growth + c->budg_dd_growth; 713 outstanding = c->budg_data_growth + c->budg_dd_growth;
716 available = ubifs_calc_available(c, min_idx_lebs); 714 available = ubifs_calc_available(c, c->min_idx_lebs);
717 715
718 /* 716 /*
719 * When reporting free space to user-space, UBIFS guarantees that it is 717 * When reporting free space to user-space, UBIFS guarantees that it is
@@ -726,15 +724,14 @@ long long ubifs_get_free_space(struct ubifs_info *c)
726 * Note, the calculations below are similar to what we have in 724 * Note, the calculations below are similar to what we have in
727 * 'do_budget_space()', so refer there for comments. 725 * 'do_budget_space()', so refer there for comments.
728 */ 726 */
729 if (min_idx_lebs > c->lst.idx_lebs) 727 if (c->min_idx_lebs > c->lst.idx_lebs)
730 rsvd_idx_lebs = min_idx_lebs - c->lst.idx_lebs; 728 rsvd_idx_lebs = c->min_idx_lebs - c->lst.idx_lebs;
731 else 729 else
732 rsvd_idx_lebs = 0; 730 rsvd_idx_lebs = 0;
733 lebs = c->lst.empty_lebs + c->freeable_cnt + c->idx_gc_cnt - 731 lebs = c->lst.empty_lebs + c->freeable_cnt + c->idx_gc_cnt -
734 c->lst.taken_empty_lebs; 732 c->lst.taken_empty_lebs;
735 lebs -= rsvd_idx_lebs; 733 lebs -= rsvd_idx_lebs;
736 available += lebs * (c->dark_wm - c->leb_overhead); 734 available += lebs * (c->dark_wm - c->leb_overhead);
737 spin_unlock(&c->space_lock);
738 735
739 if (available > outstanding) 736 if (available > outstanding)
740 free = ubifs_reported_space(c, available - outstanding); 737 free = ubifs_reported_space(c, available - outstanding);
@@ -742,3 +739,21 @@ long long ubifs_get_free_space(struct ubifs_info *c)
742 free = 0; 739 free = 0;
743 return free; 740 return free;
744} 741}
742
743/**
744 * ubifs_get_free_space - return amount of free space.
745 * @c: UBIFS file-system description object
746 *
747 * This function calculates and retuns amount of free space to report to
748 * user-space.
749 */
750long long ubifs_get_free_space(struct ubifs_info *c)
751{
752 long long free;
753
754 spin_lock(&c->space_lock);
755 free = ubifs_get_free_space_nolock(c);
756 spin_unlock(&c->space_lock);
757
758 return free;
759}
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c
index 792c5a16c182..e975bd82f38b 100644
--- a/fs/ubifs/debug.c
+++ b/fs/ubifs/debug.c
@@ -620,9 +620,11 @@ void dbg_dump_budg(struct ubifs_info *c)
620 c->dark_wm, c->dead_wm, c->max_idx_node_sz); 620 c->dark_wm, c->dead_wm, c->max_idx_node_sz);
621 printk(KERN_DEBUG "\tgc_lnum %d, ihead_lnum %d\n", 621 printk(KERN_DEBUG "\tgc_lnum %d, ihead_lnum %d\n",
622 c->gc_lnum, c->ihead_lnum); 622 c->gc_lnum, c->ihead_lnum);
623 for (i = 0; i < c->jhead_cnt; i++) 623 /* If we are in R/O mode, journal heads do not exist */
624 printk(KERN_DEBUG "\tjhead %d\t LEB %d\n", 624 if (c->jheads)
625 c->jheads[i].wbuf.jhead, c->jheads[i].wbuf.lnum); 625 for (i = 0; i < c->jhead_cnt; i++)
626 printk(KERN_DEBUG "\tjhead %d\t LEB %d\n",
627 c->jheads[i].wbuf.jhead, c->jheads[i].wbuf.lnum);
626 for (rb = rb_first(&c->buds); rb; rb = rb_next(rb)) { 628 for (rb = rb_first(&c->buds); rb; rb = rb_next(rb)) {
627 bud = rb_entry(rb, struct ubifs_bud, rb); 629 bud = rb_entry(rb, struct ubifs_bud, rb);
628 printk(KERN_DEBUG "\tbud LEB %d\n", bud->lnum); 630 printk(KERN_DEBUG "\tbud LEB %d\n", bud->lnum);
@@ -637,10 +639,7 @@ void dbg_dump_budg(struct ubifs_info *c)
637 /* Print budgeting predictions */ 639 /* Print budgeting predictions */
638 available = ubifs_calc_available(c, c->min_idx_lebs); 640 available = ubifs_calc_available(c, c->min_idx_lebs);
639 outstanding = c->budg_data_growth + c->budg_dd_growth; 641 outstanding = c->budg_data_growth + c->budg_dd_growth;
640 if (available > outstanding) 642 free = ubifs_get_free_space_nolock(c);
641 free = ubifs_reported_space(c, available - outstanding);
642 else
643 free = 0;
644 printk(KERN_DEBUG "Budgeting predictions:\n"); 643 printk(KERN_DEBUG "Budgeting predictions:\n");
645 printk(KERN_DEBUG "\tavailable: %lld, outstanding %lld, free %lld\n", 644 printk(KERN_DEBUG "\tavailable: %lld, outstanding %lld, free %lld\n",
646 available, outstanding, free); 645 available, outstanding, free);
@@ -861,6 +860,65 @@ void dbg_dump_index(struct ubifs_info *c)
861} 860}
862 861
863/** 862/**
863 * dbg_save_space_info - save information about flash space.
864 * @c: UBIFS file-system description object
865 *
866 * This function saves information about UBIFS free space, dirty space, etc, in
867 * order to check it later.
868 */
869void dbg_save_space_info(struct ubifs_info *c)
870{
871 struct ubifs_debug_info *d = c->dbg;
872
873 ubifs_get_lp_stats(c, &d->saved_lst);
874
875 spin_lock(&c->space_lock);
876 d->saved_free = ubifs_get_free_space_nolock(c);
877 spin_unlock(&c->space_lock);
878}
879
880/**
881 * dbg_check_space_info - check flash space information.
882 * @c: UBIFS file-system description object
883 *
884 * This function compares current flash space information with the information
885 * which was saved when the 'dbg_save_space_info()' function was called.
886 * Returns zero if the information has not changed, and %-EINVAL it it has
887 * changed.
888 */
889int dbg_check_space_info(struct ubifs_info *c)
890{
891 struct ubifs_debug_info *d = c->dbg;
892 struct ubifs_lp_stats lst;
893 long long avail, free;
894
895 spin_lock(&c->space_lock);
896 avail = ubifs_calc_available(c, c->min_idx_lebs);
897 spin_unlock(&c->space_lock);
898 free = ubifs_get_free_space(c);
899
900 if (free != d->saved_free) {
901 ubifs_err("free space changed from %lld to %lld",
902 d->saved_free, free);
903 goto out;
904 }
905
906 return 0;
907
908out:
909 ubifs_msg("saved lprops statistics dump");
910 dbg_dump_lstats(&d->saved_lst);
911 ubifs_get_lp_stats(c, &lst);
912 ubifs_msg("current lprops statistics dump");
913 dbg_dump_lstats(&d->saved_lst);
914 spin_lock(&c->space_lock);
915 dbg_dump_budg(c);
916 spin_unlock(&c->space_lock);
917 dump_stack();
918 return -EINVAL;
919}
920
921/**
864 * dbg_check_synced_i_size - check synchronized inode size. 922 * dbg_check_synced_i_size - check synchronized inode size.
865 * @inode: inode to check 923 * @inode: inode to check
866 * 924 *
@@ -1349,7 +1407,7 @@ int dbg_check_tnc(struct ubifs_info *c, int extra)
1349 * @c: UBIFS file-system description object 1407 * @c: UBIFS file-system description object
1350 * @leaf_cb: called for each leaf node 1408 * @leaf_cb: called for each leaf node
1351 * @znode_cb: called for each indexing node 1409 * @znode_cb: called for each indexing node
1352 * @priv: private date which is passed to callbacks 1410 * @priv: private data which is passed to callbacks
1353 * 1411 *
1354 * This function walks the UBIFS index and calls the @leaf_cb for each leaf 1412 * This function walks the UBIFS index and calls the @leaf_cb for each leaf
1355 * node and @znode_cb for each indexing node. Returns zero in case of success 1413 * node and @znode_cb for each indexing node. Returns zero in case of success
@@ -2409,7 +2467,7 @@ void ubifs_debugging_exit(struct ubifs_info *c)
2409 * Root directory for UBIFS stuff in debugfs. Contains sub-directories which 2467 * Root directory for UBIFS stuff in debugfs. Contains sub-directories which
2410 * contain the stuff specific to particular file-system mounts. 2468 * contain the stuff specific to particular file-system mounts.
2411 */ 2469 */
2412static struct dentry *debugfs_rootdir; 2470static struct dentry *dfs_rootdir;
2413 2471
2414/** 2472/**
2415 * dbg_debugfs_init - initialize debugfs file-system. 2473 * dbg_debugfs_init - initialize debugfs file-system.
@@ -2421,9 +2479,9 @@ static struct dentry *debugfs_rootdir;
2421 */ 2479 */
2422int dbg_debugfs_init(void) 2480int dbg_debugfs_init(void)
2423{ 2481{
2424 debugfs_rootdir = debugfs_create_dir("ubifs", NULL); 2482 dfs_rootdir = debugfs_create_dir("ubifs", NULL);
2425 if (IS_ERR(debugfs_rootdir)) { 2483 if (IS_ERR(dfs_rootdir)) {
2426 int err = PTR_ERR(debugfs_rootdir); 2484 int err = PTR_ERR(dfs_rootdir);
2427 ubifs_err("cannot create \"ubifs\" debugfs directory, " 2485 ubifs_err("cannot create \"ubifs\" debugfs directory, "
2428 "error %d\n", err); 2486 "error %d\n", err);
2429 return err; 2487 return err;
@@ -2437,7 +2495,7 @@ int dbg_debugfs_init(void)
2437 */ 2495 */
2438void dbg_debugfs_exit(void) 2496void dbg_debugfs_exit(void)
2439{ 2497{
2440 debugfs_remove(debugfs_rootdir); 2498 debugfs_remove(dfs_rootdir);
2441} 2499}
2442 2500
2443static int open_debugfs_file(struct inode *inode, struct file *file) 2501static int open_debugfs_file(struct inode *inode, struct file *file)
@@ -2452,13 +2510,13 @@ static ssize_t write_debugfs_file(struct file *file, const char __user *buf,
2452 struct ubifs_info *c = file->private_data; 2510 struct ubifs_info *c = file->private_data;
2453 struct ubifs_debug_info *d = c->dbg; 2511 struct ubifs_debug_info *d = c->dbg;
2454 2512
2455 if (file->f_path.dentry == d->dump_lprops) 2513 if (file->f_path.dentry == d->dfs_dump_lprops)
2456 dbg_dump_lprops(c); 2514 dbg_dump_lprops(c);
2457 else if (file->f_path.dentry == d->dump_budg) { 2515 else if (file->f_path.dentry == d->dfs_dump_budg) {
2458 spin_lock(&c->space_lock); 2516 spin_lock(&c->space_lock);
2459 dbg_dump_budg(c); 2517 dbg_dump_budg(c);
2460 spin_unlock(&c->space_lock); 2518 spin_unlock(&c->space_lock);
2461 } else if (file->f_path.dentry == d->dump_tnc) { 2519 } else if (file->f_path.dentry == d->dfs_dump_tnc) {
2462 mutex_lock(&c->tnc_mutex); 2520 mutex_lock(&c->tnc_mutex);
2463 dbg_dump_tnc(c); 2521 dbg_dump_tnc(c);
2464 mutex_unlock(&c->tnc_mutex); 2522 mutex_unlock(&c->tnc_mutex);
@@ -2469,7 +2527,7 @@ static ssize_t write_debugfs_file(struct file *file, const char __user *buf,
2469 return count; 2527 return count;
2470} 2528}
2471 2529
2472static const struct file_operations debugfs_fops = { 2530static const struct file_operations dfs_fops = {
2473 .open = open_debugfs_file, 2531 .open = open_debugfs_file,
2474 .write = write_debugfs_file, 2532 .write = write_debugfs_file,
2475 .owner = THIS_MODULE, 2533 .owner = THIS_MODULE,
@@ -2494,36 +2552,32 @@ int dbg_debugfs_init_fs(struct ubifs_info *c)
2494 struct dentry *dent; 2552 struct dentry *dent;
2495 struct ubifs_debug_info *d = c->dbg; 2553 struct ubifs_debug_info *d = c->dbg;
2496 2554
2497 sprintf(d->debugfs_dir_name, "ubi%d_%d", c->vi.ubi_num, c->vi.vol_id); 2555 sprintf(d->dfs_dir_name, "ubi%d_%d", c->vi.ubi_num, c->vi.vol_id);
2498 d->debugfs_dir = debugfs_create_dir(d->debugfs_dir_name, 2556 d->dfs_dir = debugfs_create_dir(d->dfs_dir_name, dfs_rootdir);
2499 debugfs_rootdir); 2557 if (IS_ERR(d->dfs_dir)) {
2500 if (IS_ERR(d->debugfs_dir)) { 2558 err = PTR_ERR(d->dfs_dir);
2501 err = PTR_ERR(d->debugfs_dir);
2502 ubifs_err("cannot create \"%s\" debugfs directory, error %d\n", 2559 ubifs_err("cannot create \"%s\" debugfs directory, error %d\n",
2503 d->debugfs_dir_name, err); 2560 d->dfs_dir_name, err);
2504 goto out; 2561 goto out;
2505 } 2562 }
2506 2563
2507 fname = "dump_lprops"; 2564 fname = "dump_lprops";
2508 dent = debugfs_create_file(fname, S_IWUGO, d->debugfs_dir, c, 2565 dent = debugfs_create_file(fname, S_IWUGO, d->dfs_dir, c, &dfs_fops);
2509 &debugfs_fops);
2510 if (IS_ERR(dent)) 2566 if (IS_ERR(dent))
2511 goto out_remove; 2567 goto out_remove;
2512 d->dump_lprops = dent; 2568 d->dfs_dump_lprops = dent;
2513 2569
2514 fname = "dump_budg"; 2570 fname = "dump_budg";
2515 dent = debugfs_create_file(fname, S_IWUGO, d->debugfs_dir, c, 2571 dent = debugfs_create_file(fname, S_IWUGO, d->dfs_dir, c, &dfs_fops);
2516 &debugfs_fops);
2517 if (IS_ERR(dent)) 2572 if (IS_ERR(dent))
2518 goto out_remove; 2573 goto out_remove;
2519 d->dump_budg = dent; 2574 d->dfs_dump_budg = dent;
2520 2575
2521 fname = "dump_tnc"; 2576 fname = "dump_tnc";
2522 dent = debugfs_create_file(fname, S_IWUGO, d->debugfs_dir, c, 2577 dent = debugfs_create_file(fname, S_IWUGO, d->dfs_dir, c, &dfs_fops);
2523 &debugfs_fops);
2524 if (IS_ERR(dent)) 2578 if (IS_ERR(dent))
2525 goto out_remove; 2579 goto out_remove;
2526 d->dump_tnc = dent; 2580 d->dfs_dump_tnc = dent;
2527 2581
2528 return 0; 2582 return 0;
2529 2583
@@ -2531,7 +2585,7 @@ out_remove:
2531 err = PTR_ERR(dent); 2585 err = PTR_ERR(dent);
2532 ubifs_err("cannot create \"%s\" debugfs directory, error %d\n", 2586 ubifs_err("cannot create \"%s\" debugfs directory, error %d\n",
2533 fname, err); 2587 fname, err);
2534 debugfs_remove_recursive(d->debugfs_dir); 2588 debugfs_remove_recursive(d->dfs_dir);
2535out: 2589out:
2536 return err; 2590 return err;
2537} 2591}
@@ -2542,7 +2596,7 @@ out:
2542 */ 2596 */
2543void dbg_debugfs_exit_fs(struct ubifs_info *c) 2597void dbg_debugfs_exit_fs(struct ubifs_info *c)
2544{ 2598{
2545 debugfs_remove_recursive(c->dbg->debugfs_dir); 2599 debugfs_remove_recursive(c->dbg->dfs_dir);
2546} 2600}
2547 2601
2548#endif /* CONFIG_UBIFS_FS_DEBUG */ 2602#endif /* CONFIG_UBIFS_FS_DEBUG */
diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h
index 9820d6999f7e..c1cd73b2e06e 100644
--- a/fs/ubifs/debug.h
+++ b/fs/ubifs/debug.h
@@ -41,15 +41,17 @@
41 * @chk_lpt_wastage: used by LPT tree size checker 41 * @chk_lpt_wastage: used by LPT tree size checker
42 * @chk_lpt_lebs: used by LPT tree size checker 42 * @chk_lpt_lebs: used by LPT tree size checker
43 * @new_nhead_offs: used by LPT tree size checker 43 * @new_nhead_offs: used by LPT tree size checker
44 * @new_ihead_lnum: used by debugging to check ihead_lnum 44 * @new_ihead_lnum: used by debugging to check @c->ihead_lnum
45 * @new_ihead_offs: used by debugging to check ihead_offs 45 * @new_ihead_offs: used by debugging to check @c->ihead_offs
46 * 46 *
47 * debugfs_dir_name: name of debugfs directory containing this file-system's 47 * @saved_lst: saved lprops statistics (used by 'dbg_save_space_info()')
48 * files 48 * @saved_free: saved free space (used by 'dbg_save_space_info()')
49 * debugfs_dir: direntry object of the file-system debugfs directory 49 *
50 * dump_lprops: "dump lprops" debugfs knob 50 * dfs_dir_name: name of debugfs directory containing this file-system's files
51 * dump_budg: "dump budgeting information" debugfs knob 51 * dfs_dir: direntry object of the file-system debugfs directory
52 * dump_tnc: "dump TNC" debugfs knob 52 * dfs_dump_lprops: "dump lprops" debugfs knob
53 * dfs_dump_budg: "dump budgeting information" debugfs knob
54 * dfs_dump_tnc: "dump TNC" debugfs knob
53 */ 55 */
54struct ubifs_debug_info { 56struct ubifs_debug_info {
55 void *buf; 57 void *buf;
@@ -69,11 +71,14 @@ struct ubifs_debug_info {
69 int new_ihead_lnum; 71 int new_ihead_lnum;
70 int new_ihead_offs; 72 int new_ihead_offs;
71 73
72 char debugfs_dir_name[100]; 74 struct ubifs_lp_stats saved_lst;
73 struct dentry *debugfs_dir; 75 long long saved_free;
74 struct dentry *dump_lprops; 76
75 struct dentry *dump_budg; 77 char dfs_dir_name[100];
76 struct dentry *dump_tnc; 78 struct dentry *dfs_dir;
79 struct dentry *dfs_dump_lprops;
80 struct dentry *dfs_dump_budg;
81 struct dentry *dfs_dump_tnc;
77}; 82};
78 83
79#define ubifs_assert(expr) do { \ 84#define ubifs_assert(expr) do { \
@@ -297,7 +302,8 @@ int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb,
297 dbg_znode_callback znode_cb, void *priv); 302 dbg_znode_callback znode_cb, void *priv);
298 303
299/* Checking functions */ 304/* Checking functions */
300 305void dbg_save_space_info(struct ubifs_info *c);
306int dbg_check_space_info(struct ubifs_info *c);
301int dbg_check_lprops(struct ubifs_info *c); 307int dbg_check_lprops(struct ubifs_info *c);
302int dbg_old_index_check_init(struct ubifs_info *c, struct ubifs_zbranch *zroot); 308int dbg_old_index_check_init(struct ubifs_info *c, struct ubifs_zbranch *zroot);
303int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot); 309int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot);
@@ -439,6 +445,8 @@ void dbg_debugfs_exit_fs(struct ubifs_info *c);
439 445
440#define dbg_walk_index(c, leaf_cb, znode_cb, priv) 0 446#define dbg_walk_index(c, leaf_cb, znode_cb, priv) 0
441#define dbg_old_index_check_init(c, zroot) 0 447#define dbg_old_index_check_init(c, zroot) 0
448#define dbg_save_space_info(c) ({})
449#define dbg_check_space_info(c) 0
442#define dbg_check_old_index(c, zroot) 0 450#define dbg_check_old_index(c, zroot) 0
443#define dbg_check_cats(c) 0 451#define dbg_check_cats(c) 0
444#define dbg_check_ltab(c) 0 452#define dbg_check_ltab(c) 0
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index f448ab1f9c38..f55d523c52bb 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -482,30 +482,29 @@ static int ubifs_dir_release(struct inode *dir, struct file *file)
482} 482}
483 483
484/** 484/**
485 * lock_2_inodes - lock two UBIFS inodes. 485 * lock_2_inodes - a wrapper for locking two UBIFS inodes.
486 * @inode1: first inode 486 * @inode1: first inode
487 * @inode2: second inode 487 * @inode2: second inode
488 *
489 * We do not implement any tricks to guarantee strict lock ordering, because
490 * VFS has already done it for us on the @i_mutex. So this is just a simple
491 * wrapper function.
488 */ 492 */
489static void lock_2_inodes(struct inode *inode1, struct inode *inode2) 493static void lock_2_inodes(struct inode *inode1, struct inode *inode2)
490{ 494{
491 if (inode1->i_ino < inode2->i_ino) { 495 mutex_lock_nested(&ubifs_inode(inode1)->ui_mutex, WB_MUTEX_1);
492 mutex_lock_nested(&ubifs_inode(inode1)->ui_mutex, WB_MUTEX_2); 496 mutex_lock_nested(&ubifs_inode(inode2)->ui_mutex, WB_MUTEX_2);
493 mutex_lock_nested(&ubifs_inode(inode2)->ui_mutex, WB_MUTEX_3);
494 } else {
495 mutex_lock_nested(&ubifs_inode(inode2)->ui_mutex, WB_MUTEX_2);
496 mutex_lock_nested(&ubifs_inode(inode1)->ui_mutex, WB_MUTEX_3);
497 }
498} 497}
499 498
500/** 499/**
501 * unlock_2_inodes - unlock two UBIFS inodes inodes. 500 * unlock_2_inodes - a wrapper for unlocking two UBIFS inodes.
502 * @inode1: first inode 501 * @inode1: first inode
503 * @inode2: second inode 502 * @inode2: second inode
504 */ 503 */
505static void unlock_2_inodes(struct inode *inode1, struct inode *inode2) 504static void unlock_2_inodes(struct inode *inode1, struct inode *inode2)
506{ 505{
507 mutex_unlock(&ubifs_inode(inode1)->ui_mutex);
508 mutex_unlock(&ubifs_inode(inode2)->ui_mutex); 506 mutex_unlock(&ubifs_inode(inode2)->ui_mutex);
507 mutex_unlock(&ubifs_inode(inode1)->ui_mutex);
509} 508}
510 509
511static int ubifs_link(struct dentry *old_dentry, struct inode *dir, 510static int ubifs_link(struct dentry *old_dentry, struct inode *dir,
@@ -527,6 +526,8 @@ static int ubifs_link(struct dentry *old_dentry, struct inode *dir,
527 dbg_gen("dent '%.*s' to ino %lu (nlink %d) in dir ino %lu", 526 dbg_gen("dent '%.*s' to ino %lu (nlink %d) in dir ino %lu",
528 dentry->d_name.len, dentry->d_name.name, inode->i_ino, 527 dentry->d_name.len, dentry->d_name.name, inode->i_ino,
529 inode->i_nlink, dir->i_ino); 528 inode->i_nlink, dir->i_ino);
529 ubifs_assert(mutex_is_locked(&dir->i_mutex));
530 ubifs_assert(mutex_is_locked(&inode->i_mutex));
530 err = dbg_check_synced_i_size(inode); 531 err = dbg_check_synced_i_size(inode);
531 if (err) 532 if (err)
532 return err; 533 return err;
@@ -580,6 +581,8 @@ static int ubifs_unlink(struct inode *dir, struct dentry *dentry)
580 dbg_gen("dent '%.*s' from ino %lu (nlink %d) in dir ino %lu", 581 dbg_gen("dent '%.*s' from ino %lu (nlink %d) in dir ino %lu",
581 dentry->d_name.len, dentry->d_name.name, inode->i_ino, 582 dentry->d_name.len, dentry->d_name.name, inode->i_ino,
582 inode->i_nlink, dir->i_ino); 583 inode->i_nlink, dir->i_ino);
584 ubifs_assert(mutex_is_locked(&dir->i_mutex));
585 ubifs_assert(mutex_is_locked(&inode->i_mutex));
583 err = dbg_check_synced_i_size(inode); 586 err = dbg_check_synced_i_size(inode);
584 if (err) 587 if (err)
585 return err; 588 return err;
@@ -667,7 +670,8 @@ static int ubifs_rmdir(struct inode *dir, struct dentry *dentry)
667 670
668 dbg_gen("directory '%.*s', ino %lu in dir ino %lu", dentry->d_name.len, 671 dbg_gen("directory '%.*s', ino %lu in dir ino %lu", dentry->d_name.len,
669 dentry->d_name.name, inode->i_ino, dir->i_ino); 672 dentry->d_name.name, inode->i_ino, dir->i_ino);
670 673 ubifs_assert(mutex_is_locked(&dir->i_mutex));
674 ubifs_assert(mutex_is_locked(&inode->i_mutex));
671 err = check_dir_empty(c, dentry->d_inode); 675 err = check_dir_empty(c, dentry->d_inode);
672 if (err) 676 if (err)
673 return err; 677 return err;
@@ -922,59 +926,30 @@ out_budg:
922} 926}
923 927
924/** 928/**
925 * lock_3_inodes - lock three UBIFS inodes for rename. 929 * lock_3_inodes - a wrapper for locking three UBIFS inodes.
926 * @inode1: first inode 930 * @inode1: first inode
927 * @inode2: second inode 931 * @inode2: second inode
928 * @inode3: third inode 932 * @inode3: third inode
929 * 933 *
930 * For 'ubifs_rename()', @inode1 may be the same as @inode2 whereas @inode3 may 934 * This function is used for 'ubifs_rename()' and @inode1 may be the same as
931 * be null. 935 * @inode2 whereas @inode3 may be %NULL.
936 *
937 * We do not implement any tricks to guarantee strict lock ordering, because
938 * VFS has already done it for us on the @i_mutex. So this is just a simple
939 * wrapper function.
932 */ 940 */
933static void lock_3_inodes(struct inode *inode1, struct inode *inode2, 941static void lock_3_inodes(struct inode *inode1, struct inode *inode2,
934 struct inode *inode3) 942 struct inode *inode3)
935{ 943{
936 struct inode *i1, *i2, *i3; 944 mutex_lock_nested(&ubifs_inode(inode1)->ui_mutex, WB_MUTEX_1);
937 945 if (inode2 != inode1)
938 if (!inode3) { 946 mutex_lock_nested(&ubifs_inode(inode2)->ui_mutex, WB_MUTEX_2);
939 if (inode1 != inode2) { 947 if (inode3)
940 lock_2_inodes(inode1, inode2); 948 mutex_lock_nested(&ubifs_inode(inode3)->ui_mutex, WB_MUTEX_3);
941 return;
942 }
943 mutex_lock_nested(&ubifs_inode(inode1)->ui_mutex, WB_MUTEX_1);
944 return;
945 }
946
947 if (inode1 == inode2) {
948 lock_2_inodes(inode1, inode3);
949 return;
950 }
951
952 /* 3 different inodes */
953 if (inode1 < inode2) {
954 i3 = inode2;
955 if (inode1 < inode3) {
956 i1 = inode1;
957 i2 = inode3;
958 } else {
959 i1 = inode3;
960 i2 = inode1;
961 }
962 } else {
963 i3 = inode1;
964 if (inode2 < inode3) {
965 i1 = inode2;
966 i2 = inode3;
967 } else {
968 i1 = inode3;
969 i2 = inode2;
970 }
971 }
972 mutex_lock_nested(&ubifs_inode(i1)->ui_mutex, WB_MUTEX_1);
973 lock_2_inodes(i2, i3);
974} 949}
975 950
976/** 951/**
977 * unlock_3_inodes - unlock three UBIFS inodes for rename. 952 * unlock_3_inodes - a wrapper for unlocking three UBIFS inodes for rename.
978 * @inode1: first inode 953 * @inode1: first inode
979 * @inode2: second inode 954 * @inode2: second inode
980 * @inode3: third inode 955 * @inode3: third inode
@@ -982,11 +957,11 @@ static void lock_3_inodes(struct inode *inode1, struct inode *inode2,
982static void unlock_3_inodes(struct inode *inode1, struct inode *inode2, 957static void unlock_3_inodes(struct inode *inode1, struct inode *inode2,
983 struct inode *inode3) 958 struct inode *inode3)
984{ 959{
985 mutex_unlock(&ubifs_inode(inode1)->ui_mutex);
986 if (inode1 != inode2)
987 mutex_unlock(&ubifs_inode(inode2)->ui_mutex);
988 if (inode3) 960 if (inode3)
989 mutex_unlock(&ubifs_inode(inode3)->ui_mutex); 961 mutex_unlock(&ubifs_inode(inode3)->ui_mutex);
962 if (inode1 != inode2)
963 mutex_unlock(&ubifs_inode(inode2)->ui_mutex);
964 mutex_unlock(&ubifs_inode(inode1)->ui_mutex);
990} 965}
991 966
992static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry, 967static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry,
@@ -1020,6 +995,11 @@ static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry,
1020 "dir ino %lu", old_dentry->d_name.len, old_dentry->d_name.name, 995 "dir ino %lu", old_dentry->d_name.len, old_dentry->d_name.name,
1021 old_inode->i_ino, old_dir->i_ino, new_dentry->d_name.len, 996 old_inode->i_ino, old_dir->i_ino, new_dentry->d_name.len,
1022 new_dentry->d_name.name, new_dir->i_ino); 997 new_dentry->d_name.name, new_dir->i_ino);
998 ubifs_assert(mutex_is_locked(&old_dir->i_mutex));
999 ubifs_assert(mutex_is_locked(&new_dir->i_mutex));
1000 if (unlink)
1001 ubifs_assert(mutex_is_locked(&new_inode->i_mutex));
1002
1023 1003
1024 if (unlink && is_dir) { 1004 if (unlink && is_dir) {
1025 err = check_dir_empty(c, new_inode); 1005 err = check_dir_empty(c, new_inode);
@@ -1199,7 +1179,7 @@ int ubifs_getattr(struct vfsmount *mnt, struct dentry *dentry,
1199 return 0; 1179 return 0;
1200} 1180}
1201 1181
1202struct inode_operations ubifs_dir_inode_operations = { 1182const struct inode_operations ubifs_dir_inode_operations = {
1203 .lookup = ubifs_lookup, 1183 .lookup = ubifs_lookup,
1204 .create = ubifs_create, 1184 .create = ubifs_create,
1205 .link = ubifs_link, 1185 .link = ubifs_link,
@@ -1219,7 +1199,7 @@ struct inode_operations ubifs_dir_inode_operations = {
1219#endif 1199#endif
1220}; 1200};
1221 1201
1222struct file_operations ubifs_dir_operations = { 1202const struct file_operations ubifs_dir_operations = {
1223 .llseek = ubifs_dir_llseek, 1203 .llseek = ubifs_dir_llseek,
1224 .release = ubifs_dir_release, 1204 .release = ubifs_dir_release,
1225 .read = generic_read_dir, 1205 .read = generic_read_dir,
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index bf37374567fa..93b6de51f261 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -432,7 +432,6 @@ static int ubifs_write_begin(struct file *file, struct address_space *mapping,
432 int uninitialized_var(err), appending = !!(pos + len > inode->i_size); 432 int uninitialized_var(err), appending = !!(pos + len > inode->i_size);
433 struct page *page; 433 struct page *page;
434 434
435
436 ubifs_assert(ubifs_inode(inode)->ui_size == inode->i_size); 435 ubifs_assert(ubifs_inode(inode)->ui_size == inode->i_size);
437 436
438 if (unlikely(c->ro_media)) 437 if (unlikely(c->ro_media))
@@ -1541,7 +1540,7 @@ static int ubifs_file_mmap(struct file *file, struct vm_area_struct *vma)
1541 return 0; 1540 return 0;
1542} 1541}
1543 1542
1544struct address_space_operations ubifs_file_address_operations = { 1543const struct address_space_operations ubifs_file_address_operations = {
1545 .readpage = ubifs_readpage, 1544 .readpage = ubifs_readpage,
1546 .writepage = ubifs_writepage, 1545 .writepage = ubifs_writepage,
1547 .write_begin = ubifs_write_begin, 1546 .write_begin = ubifs_write_begin,
@@ -1551,7 +1550,7 @@ struct address_space_operations ubifs_file_address_operations = {
1551 .releasepage = ubifs_releasepage, 1550 .releasepage = ubifs_releasepage,
1552}; 1551};
1553 1552
1554struct inode_operations ubifs_file_inode_operations = { 1553const struct inode_operations ubifs_file_inode_operations = {
1555 .setattr = ubifs_setattr, 1554 .setattr = ubifs_setattr,
1556 .getattr = ubifs_getattr, 1555 .getattr = ubifs_getattr,
1557#ifdef CONFIG_UBIFS_FS_XATTR 1556#ifdef CONFIG_UBIFS_FS_XATTR
@@ -1562,14 +1561,14 @@ struct inode_operations ubifs_file_inode_operations = {
1562#endif 1561#endif
1563}; 1562};
1564 1563
1565struct inode_operations ubifs_symlink_inode_operations = { 1564const struct inode_operations ubifs_symlink_inode_operations = {
1566 .readlink = generic_readlink, 1565 .readlink = generic_readlink,
1567 .follow_link = ubifs_follow_link, 1566 .follow_link = ubifs_follow_link,
1568 .setattr = ubifs_setattr, 1567 .setattr = ubifs_setattr,
1569 .getattr = ubifs_getattr, 1568 .getattr = ubifs_getattr,
1570}; 1569};
1571 1570
1572struct file_operations ubifs_file_operations = { 1571const struct file_operations ubifs_file_operations = {
1573 .llseek = generic_file_llseek, 1572 .llseek = generic_file_llseek,
1574 .read = do_sync_read, 1573 .read = do_sync_read,
1575 .write = do_sync_write, 1574 .write = do_sync_write,
diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c
index 9832f9abe28e..a711d33b3d3e 100644
--- a/fs/ubifs/gc.c
+++ b/fs/ubifs/gc.c
@@ -31,6 +31,26 @@
31 * to be reused. Garbage collection will cause the number of dirty index nodes 31 * to be reused. Garbage collection will cause the number of dirty index nodes
32 * to grow, however sufficient space is reserved for the index to ensure the 32 * to grow, however sufficient space is reserved for the index to ensure the
33 * commit will never run out of space. 33 * commit will never run out of space.
34 *
35 * Notes about dead watermark. At current UBIFS implementation we assume that
36 * LEBs which have less than @c->dead_wm bytes of free + dirty space are full
37 * and not worth garbage-collecting. The dead watermark is one min. I/O unit
38 * size, or min. UBIFS node size, depending on what is greater. Indeed, UBIFS
39 * Garbage Collector has to synchronize the GC head's write buffer before
40 * returning, so this is about wasting one min. I/O unit. However, UBIFS GC can
41 * actually reclaim even very small pieces of dirty space by garbage collecting
42 * enough dirty LEBs, but we do not bother doing this at this implementation.
43 *
44 * Notes about dark watermark. The results of GC work depends on how big are
45 * the UBIFS nodes GC deals with. Large nodes make GC waste more space. Indeed,
46 * if GC move data from LEB A to LEB B and nodes in LEB A are large, GC would
47 * have to waste large pieces of free space at the end of LEB B, because nodes
48 * from LEB A would not fit. And the worst situation is when all nodes are of
49 * maximum size. So dark watermark is the amount of free + dirty space in LEB
50 * which are guaranteed to be reclaimable. If LEB has less space, the GC migh
51 * be unable to reclaim it. So, LEBs with free + dirty greater than dark
52 * watermark are "good" LEBs from GC's point of few. The other LEBs are not so
53 * good, and GC takes extra care when moving them.
34 */ 54 */
35 55
36#include <linux/pagemap.h> 56#include <linux/pagemap.h>
@@ -381,7 +401,7 @@ int ubifs_garbage_collect_leb(struct ubifs_info *c, struct ubifs_lprops *lp)
381 401
382 /* 402 /*
383 * Don't release the LEB until after the next commit, because 403 * Don't release the LEB until after the next commit, because
384 * it may contain date which is needed for recovery. So 404 * it may contain data which is needed for recovery. So
385 * although we freed this LEB, it will become usable only after 405 * although we freed this LEB, it will become usable only after
386 * the commit. 406 * the commit.
387 */ 407 */
@@ -810,8 +830,9 @@ out:
810 * ubifs_destroy_idx_gc - destroy idx_gc list. 830 * ubifs_destroy_idx_gc - destroy idx_gc list.
811 * @c: UBIFS file-system description object 831 * @c: UBIFS file-system description object
812 * 832 *
813 * This function destroys the idx_gc list. It is called when unmounting or 833 * This function destroys the @c->idx_gc list. It is called when unmounting
814 * remounting read-only so locks are not needed. 834 * so locks are not needed. Returns zero in case of success and a negative
835 * error code in case of failure.
815 */ 836 */
816void ubifs_destroy_idx_gc(struct ubifs_info *c) 837void ubifs_destroy_idx_gc(struct ubifs_info *c)
817{ 838{
@@ -824,7 +845,6 @@ void ubifs_destroy_idx_gc(struct ubifs_info *c)
824 list_del(&idx_gc->list); 845 list_del(&idx_gc->list);
825 kfree(idx_gc); 846 kfree(idx_gc);
826 } 847 }
827
828} 848}
829 849
830/** 850/**
diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c
index 01682713af69..e8e632a1dcdf 100644
--- a/fs/ubifs/io.c
+++ b/fs/ubifs/io.c
@@ -29,7 +29,7 @@
29 * would have been wasted for padding to the nearest minimal I/O unit boundary. 29 * would have been wasted for padding to the nearest minimal I/O unit boundary.
30 * Instead, data first goes to the write-buffer and is flushed when the 30 * Instead, data first goes to the write-buffer and is flushed when the
31 * buffer is full or when it is not used for some time (by timer). This is 31 * buffer is full or when it is not used for some time (by timer). This is
32 * similarto the mechanism is used by JFFS2. 32 * similar to the mechanism is used by JFFS2.
33 * 33 *
34 * Write-buffers are defined by 'struct ubifs_wbuf' objects and protected by 34 * Write-buffers are defined by 'struct ubifs_wbuf' objects and protected by
35 * mutexes defined inside these objects. Since sometimes upper-level code 35 * mutexes defined inside these objects. Since sometimes upper-level code
@@ -75,7 +75,7 @@ void ubifs_ro_mode(struct ubifs_info *c, int err)
75 * @lnum: logical eraseblock number 75 * @lnum: logical eraseblock number
76 * @offs: offset within the logical eraseblock 76 * @offs: offset within the logical eraseblock
77 * @quiet: print no messages 77 * @quiet: print no messages
78 * @chk_crc: indicates whether to always check the CRC 78 * @must_chk_crc: indicates whether to always check the CRC
79 * 79 *
80 * This function checks node magic number and CRC checksum. This function also 80 * This function checks node magic number and CRC checksum. This function also
81 * validates node length to prevent UBIFS from becoming crazy when an attacker 81 * validates node length to prevent UBIFS from becoming crazy when an attacker
@@ -83,11 +83,17 @@ void ubifs_ro_mode(struct ubifs_info *c, int err)
83 * node length in the common header could cause UBIFS to read memory outside of 83 * node length in the common header could cause UBIFS to read memory outside of
84 * allocated buffer when checking the CRC checksum. 84 * allocated buffer when checking the CRC checksum.
85 * 85 *
86 * This function returns zero in case of success %-EUCLEAN in case of bad CRC 86 * This function may skip data nodes CRC checking if @c->no_chk_data_crc is
87 * or magic. 87 * true, which is controlled by corresponding UBIFS mount option. However, if
88 * @must_chk_crc is true, then @c->no_chk_data_crc is ignored and CRC is
89 * checked. Similarly, if @c->always_chk_crc is true, @c->no_chk_data_crc is
90 * ignored and CRC is checked.
91 *
92 * This function returns zero in case of success and %-EUCLEAN in case of bad
93 * CRC or magic.
88 */ 94 */
89int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum, 95int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum,
90 int offs, int quiet, int chk_crc) 96 int offs, int quiet, int must_chk_crc)
91{ 97{
92 int err = -EINVAL, type, node_len; 98 int err = -EINVAL, type, node_len;
93 uint32_t crc, node_crc, magic; 99 uint32_t crc, node_crc, magic;
@@ -123,9 +129,9 @@ int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum,
123 node_len > c->ranges[type].max_len) 129 node_len > c->ranges[type].max_len)
124 goto out_len; 130 goto out_len;
125 131
126 if (!chk_crc && type == UBIFS_DATA_NODE && !c->always_chk_crc) 132 if (!must_chk_crc && type == UBIFS_DATA_NODE && !c->always_chk_crc &&
127 if (c->no_chk_data_crc) 133 c->no_chk_data_crc)
128 return 0; 134 return 0;
129 135
130 crc = crc32(UBIFS_CRC32_INIT, buf + 8, node_len - 8); 136 crc = crc32(UBIFS_CRC32_INIT, buf + 8, node_len - 8);
131 node_crc = le32_to_cpu(ch->crc); 137 node_crc = le32_to_cpu(ch->crc);
diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c
index 9b7c54e0cd2a..a11ca0958a23 100644
--- a/fs/ubifs/journal.c
+++ b/fs/ubifs/journal.c
@@ -208,7 +208,7 @@ again:
208 offs = 0; 208 offs = 0;
209 209
210out: 210out:
211 err = ubifs_wbuf_seek_nolock(wbuf, lnum, offs, UBI_SHORTTERM); 211 err = ubifs_wbuf_seek_nolock(wbuf, lnum, offs, wbuf->dtype);
212 if (err) 212 if (err)
213 goto out_unlock; 213 goto out_unlock;
214 214
diff --git a/fs/ubifs/lprops.c b/fs/ubifs/lprops.c
index dfd2bcece27a..4cdd284dea56 100644
--- a/fs/ubifs/lprops.c
+++ b/fs/ubifs/lprops.c
@@ -635,10 +635,10 @@ const struct ubifs_lprops *ubifs_change_lp(struct ubifs_info *c,
635 * @c: UBIFS file-system description object 635 * @c: UBIFS file-system description object
636 * @st: return statistics 636 * @st: return statistics
637 */ 637 */
638void ubifs_get_lp_stats(struct ubifs_info *c, struct ubifs_lp_stats *st) 638void ubifs_get_lp_stats(struct ubifs_info *c, struct ubifs_lp_stats *lst)
639{ 639{
640 spin_lock(&c->space_lock); 640 spin_lock(&c->space_lock);
641 memcpy(st, &c->lst, sizeof(struct ubifs_lp_stats)); 641 memcpy(lst, &c->lst, sizeof(struct ubifs_lp_stats));
642 spin_unlock(&c->space_lock); 642 spin_unlock(&c->space_lock);
643} 643}
644 644
@@ -678,6 +678,9 @@ int ubifs_change_one_lp(struct ubifs_info *c, int lnum, int free, int dirty,
678 678
679out: 679out:
680 ubifs_release_lprops(c); 680 ubifs_release_lprops(c);
681 if (err)
682 ubifs_err("cannot change properties of LEB %d, error %d",
683 lnum, err);
681 return err; 684 return err;
682} 685}
683 686
@@ -714,6 +717,9 @@ int ubifs_update_one_lp(struct ubifs_info *c, int lnum, int free, int dirty,
714 717
715out: 718out:
716 ubifs_release_lprops(c); 719 ubifs_release_lprops(c);
720 if (err)
721 ubifs_err("cannot update properties of LEB %d, error %d",
722 lnum, err);
717 return err; 723 return err;
718} 724}
719 725
@@ -737,6 +743,8 @@ int ubifs_read_one_lp(struct ubifs_info *c, int lnum, struct ubifs_lprops *lp)
737 lpp = ubifs_lpt_lookup(c, lnum); 743 lpp = ubifs_lpt_lookup(c, lnum);
738 if (IS_ERR(lpp)) { 744 if (IS_ERR(lpp)) {
739 err = PTR_ERR(lpp); 745 err = PTR_ERR(lpp);
746 ubifs_err("cannot read properties of LEB %d, error %d",
747 lnum, err);
740 goto out; 748 goto out;
741 } 749 }
742 750
diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c
index 96ca95707175..3216a1f277f8 100644
--- a/fs/ubifs/lpt_commit.c
+++ b/fs/ubifs/lpt_commit.c
@@ -556,23 +556,23 @@ no_space:
556} 556}
557 557
558/** 558/**
559 * next_pnode - find next pnode. 559 * next_pnode_to_dirty - find next pnode to dirty.
560 * @c: UBIFS file-system description object 560 * @c: UBIFS file-system description object
561 * @pnode: pnode 561 * @pnode: pnode
562 * 562 *
563 * This function returns the next pnode or %NULL if there are no more pnodes. 563 * This function returns the next pnode to dirty or %NULL if there are no more
564 * pnodes. Note that pnodes that have never been written (lnum == 0) are
565 * skipped.
564 */ 566 */
565static struct ubifs_pnode *next_pnode(struct ubifs_info *c, 567static struct ubifs_pnode *next_pnode_to_dirty(struct ubifs_info *c,
566 struct ubifs_pnode *pnode) 568 struct ubifs_pnode *pnode)
567{ 569{
568 struct ubifs_nnode *nnode; 570 struct ubifs_nnode *nnode;
569 int iip; 571 int iip;
570 572
571 /* Try to go right */ 573 /* Try to go right */
572 nnode = pnode->parent; 574 nnode = pnode->parent;
573 iip = pnode->iip + 1; 575 for (iip = pnode->iip + 1; iip < UBIFS_LPT_FANOUT; iip++) {
574 if (iip < UBIFS_LPT_FANOUT) {
575 /* We assume here that LEB zero is never an LPT LEB */
576 if (nnode->nbranch[iip].lnum) 576 if (nnode->nbranch[iip].lnum)
577 return ubifs_get_pnode(c, nnode, iip); 577 return ubifs_get_pnode(c, nnode, iip);
578 } 578 }
@@ -583,8 +583,11 @@ static struct ubifs_pnode *next_pnode(struct ubifs_info *c,
583 nnode = nnode->parent; 583 nnode = nnode->parent;
584 if (!nnode) 584 if (!nnode)
585 return NULL; 585 return NULL;
586 /* We assume here that LEB zero is never an LPT LEB */ 586 for (; iip < UBIFS_LPT_FANOUT; iip++) {
587 } while (iip >= UBIFS_LPT_FANOUT || !nnode->nbranch[iip].lnum); 587 if (nnode->nbranch[iip].lnum)
588 break;
589 }
590 } while (iip >= UBIFS_LPT_FANOUT);
588 591
589 /* Go right */ 592 /* Go right */
590 nnode = ubifs_get_nnode(c, nnode, iip); 593 nnode = ubifs_get_nnode(c, nnode, iip);
@@ -593,12 +596,29 @@ static struct ubifs_pnode *next_pnode(struct ubifs_info *c,
593 596
594 /* Go down to level 1 */ 597 /* Go down to level 1 */
595 while (nnode->level > 1) { 598 while (nnode->level > 1) {
596 nnode = ubifs_get_nnode(c, nnode, 0); 599 for (iip = 0; iip < UBIFS_LPT_FANOUT; iip++) {
600 if (nnode->nbranch[iip].lnum)
601 break;
602 }
603 if (iip >= UBIFS_LPT_FANOUT) {
604 /*
605 * Should not happen, but we need to keep going
606 * if it does.
607 */
608 iip = 0;
609 }
610 nnode = ubifs_get_nnode(c, nnode, iip);
597 if (IS_ERR(nnode)) 611 if (IS_ERR(nnode))
598 return (void *)nnode; 612 return (void *)nnode;
599 } 613 }
600 614
601 return ubifs_get_pnode(c, nnode, 0); 615 for (iip = 0; iip < UBIFS_LPT_FANOUT; iip++)
616 if (nnode->nbranch[iip].lnum)
617 break;
618 if (iip >= UBIFS_LPT_FANOUT)
619 /* Should not happen, but we need to keep going if it does */
620 iip = 0;
621 return ubifs_get_pnode(c, nnode, iip);
602} 622}
603 623
604/** 624/**
@@ -688,7 +708,7 @@ static int make_tree_dirty(struct ubifs_info *c)
688 pnode = pnode_lookup(c, 0); 708 pnode = pnode_lookup(c, 0);
689 while (pnode) { 709 while (pnode) {
690 do_make_pnode_dirty(c, pnode); 710 do_make_pnode_dirty(c, pnode);
691 pnode = next_pnode(c, pnode); 711 pnode = next_pnode_to_dirty(c, pnode);
692 if (IS_ERR(pnode)) 712 if (IS_ERR(pnode))
693 return PTR_ERR(pnode); 713 return PTR_ERR(pnode);
694 } 714 }
diff --git a/fs/ubifs/master.c b/fs/ubifs/master.c
index 71d5493bf565..a88f33801b98 100644
--- a/fs/ubifs/master.c
+++ b/fs/ubifs/master.c
@@ -354,7 +354,7 @@ int ubifs_write_master(struct ubifs_info *c)
354 int err, lnum, offs, len; 354 int err, lnum, offs, len;
355 355
356 if (c->ro_media) 356 if (c->ro_media)
357 return -EINVAL; 357 return -EROFS;
358 358
359 lnum = UBIFS_MST_LNUM; 359 lnum = UBIFS_MST_LNUM;
360 offs = c->mst_offs + c->mst_node_alsz; 360 offs = c->mst_offs + c->mst_node_alsz;
diff --git a/fs/ubifs/orphan.c b/fs/ubifs/orphan.c
index 9e6f403f170e..152a7b34a141 100644
--- a/fs/ubifs/orphan.c
+++ b/fs/ubifs/orphan.c
@@ -46,7 +46,7 @@
46 * Orphans are accumulated in a rb-tree. When an inode's link count drops to 46 * Orphans are accumulated in a rb-tree. When an inode's link count drops to
47 * zero, the inode number is added to the rb-tree. It is removed from the tree 47 * zero, the inode number is added to the rb-tree. It is removed from the tree
48 * when the inode is deleted. Any new orphans that are in the orphan tree when 48 * when the inode is deleted. Any new orphans that are in the orphan tree when
49 * the commit is run, are written to the orphan area in 1 or more orph nodes. 49 * the commit is run, are written to the orphan area in 1 or more orphan nodes.
50 * If the orphan area is full, it is consolidated to make space. There is 50 * If the orphan area is full, it is consolidated to make space. There is
51 * always enough space because validation prevents the user from creating more 51 * always enough space because validation prevents the user from creating more
52 * than the maximum number of orphans allowed. 52 * than the maximum number of orphans allowed.
@@ -231,7 +231,7 @@ static int tot_avail_orphs(struct ubifs_info *c)
231} 231}
232 232
233/** 233/**
234 * do_write_orph_node - write a node 234 * do_write_orph_node - write a node to the orphan head.
235 * @c: UBIFS file-system description object 235 * @c: UBIFS file-system description object
236 * @len: length of node 236 * @len: length of node
237 * @atomic: write atomically 237 * @atomic: write atomically
@@ -264,11 +264,11 @@ static int do_write_orph_node(struct ubifs_info *c, int len, int atomic)
264} 264}
265 265
266/** 266/**
267 * write_orph_node - write an orph node 267 * write_orph_node - write an orphan node.
268 * @c: UBIFS file-system description object 268 * @c: UBIFS file-system description object
269 * @atomic: write atomically 269 * @atomic: write atomically
270 * 270 *
271 * This function builds an orph node from the cnext list and writes it to the 271 * This function builds an orphan node from the cnext list and writes it to the
272 * orphan head. On success, %0 is returned, otherwise a negative error code 272 * orphan head. On success, %0 is returned, otherwise a negative error code
273 * is returned. 273 * is returned.
274 */ 274 */
@@ -326,11 +326,11 @@ static int write_orph_node(struct ubifs_info *c, int atomic)
326} 326}
327 327
328/** 328/**
329 * write_orph_nodes - write orph nodes until there are no more to commit 329 * write_orph_nodes - write orphan nodes until there are no more to commit.
330 * @c: UBIFS file-system description object 330 * @c: UBIFS file-system description object
331 * @atomic: write atomically 331 * @atomic: write atomically
332 * 332 *
333 * This function writes orph nodes for all the orphans to commit. On success, 333 * This function writes orphan nodes for all the orphans to commit. On success,
334 * %0 is returned, otherwise a negative error code is returned. 334 * %0 is returned, otherwise a negative error code is returned.
335 */ 335 */
336static int write_orph_nodes(struct ubifs_info *c, int atomic) 336static int write_orph_nodes(struct ubifs_info *c, int atomic)
@@ -478,14 +478,14 @@ int ubifs_orphan_end_commit(struct ubifs_info *c)
478} 478}
479 479
480/** 480/**
481 * clear_orphans - erase all LEBs used for orphans. 481 * ubifs_clear_orphans - erase all LEBs used for orphans.
482 * @c: UBIFS file-system description object 482 * @c: UBIFS file-system description object
483 * 483 *
484 * If recovery is not required, then the orphans from the previous session 484 * If recovery is not required, then the orphans from the previous session
485 * are not needed. This function locates the LEBs used to record 485 * are not needed. This function locates the LEBs used to record
486 * orphans, and un-maps them. 486 * orphans, and un-maps them.
487 */ 487 */
488static int clear_orphans(struct ubifs_info *c) 488int ubifs_clear_orphans(struct ubifs_info *c)
489{ 489{
490 int lnum, err; 490 int lnum, err;
491 491
@@ -547,9 +547,9 @@ static int insert_dead_orphan(struct ubifs_info *c, ino_t inum)
547 * do_kill_orphans - remove orphan inodes from the index. 547 * do_kill_orphans - remove orphan inodes from the index.
548 * @c: UBIFS file-system description object 548 * @c: UBIFS file-system description object
549 * @sleb: scanned LEB 549 * @sleb: scanned LEB
550 * @last_cmt_no: cmt_no of last orph node read is passed and returned here 550 * @last_cmt_no: cmt_no of last orphan node read is passed and returned here
551 * @outofdate: whether the LEB is out of date is returned here 551 * @outofdate: whether the LEB is out of date is returned here
552 * @last_flagged: whether the end orph node is encountered 552 * @last_flagged: whether the end orphan node is encountered
553 * 553 *
554 * This function is a helper to the 'kill_orphans()' function. It goes through 554 * This function is a helper to the 'kill_orphans()' function. It goes through
555 * every orphan node in a LEB and for every inode number recorded, removes 555 * every orphan node in a LEB and for every inode number recorded, removes
@@ -580,8 +580,8 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb,
580 /* 580 /*
581 * The commit number on the master node may be less, because 581 * The commit number on the master node may be less, because
582 * of a failed commit. If there are several failed commits in a 582 * of a failed commit. If there are several failed commits in a
583 * row, the commit number written on orph nodes will continue to 583 * row, the commit number written on orphan nodes will continue
584 * increase (because the commit number is adjusted here) even 584 * to increase (because the commit number is adjusted here) even
585 * though the commit number on the master node stays the same 585 * though the commit number on the master node stays the same
586 * because the master node has not been re-written. 586 * because the master node has not been re-written.
587 */ 587 */
@@ -589,9 +589,9 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb,
589 c->cmt_no = cmt_no; 589 c->cmt_no = cmt_no;
590 if (cmt_no < *last_cmt_no && *last_flagged) { 590 if (cmt_no < *last_cmt_no && *last_flagged) {
591 /* 591 /*
592 * The last orph node had a higher commit number and was 592 * The last orphan node had a higher commit number and
593 * flagged as the last written for that commit number. 593 * was flagged as the last written for that commit
594 * That makes this orph node, out of date. 594 * number. That makes this orphan node, out of date.
595 */ 595 */
596 if (!first) { 596 if (!first) {
597 ubifs_err("out of order commit number %llu in " 597 ubifs_err("out of order commit number %llu in "
@@ -658,10 +658,10 @@ static int kill_orphans(struct ubifs_info *c)
658 /* 658 /*
659 * Orph nodes always start at c->orph_first and are written to each 659 * Orph nodes always start at c->orph_first and are written to each
660 * successive LEB in turn. Generally unused LEBs will have been unmapped 660 * successive LEB in turn. Generally unused LEBs will have been unmapped
661 * but may contain out of date orph nodes if the unmap didn't go 661 * but may contain out of date orphan nodes if the unmap didn't go
662 * through. In addition, the last orph node written for each commit is 662 * through. In addition, the last orphan node written for each commit is
663 * marked (top bit of orph->cmt_no is set to 1). It is possible that 663 * marked (top bit of orph->cmt_no is set to 1). It is possible that
664 * there are orph nodes from the next commit (i.e. the commit did not 664 * there are orphan nodes from the next commit (i.e. the commit did not
665 * complete successfully). In that case, no orphans will have been lost 665 * complete successfully). In that case, no orphans will have been lost
666 * due to the way that orphans are written, and any orphans added will 666 * due to the way that orphans are written, and any orphans added will
667 * be valid orphans anyway and so can be deleted. 667 * be valid orphans anyway and so can be deleted.
@@ -718,7 +718,7 @@ int ubifs_mount_orphans(struct ubifs_info *c, int unclean, int read_only)
718 if (unclean) 718 if (unclean)
719 err = kill_orphans(c); 719 err = kill_orphans(c);
720 else if (!read_only) 720 else if (!read_only)
721 err = clear_orphans(c); 721 err = ubifs_clear_orphans(c);
722 722
723 return err; 723 return err;
724} 724}
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 89556ee72518..1182b66a5491 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -397,6 +397,7 @@ static int ubifs_statfs(struct dentry *dentry, struct kstatfs *buf)
397 buf->f_namelen = UBIFS_MAX_NLEN; 397 buf->f_namelen = UBIFS_MAX_NLEN;
398 buf->f_fsid.val[0] = le32_to_cpu(uuid[0]) ^ le32_to_cpu(uuid[2]); 398 buf->f_fsid.val[0] = le32_to_cpu(uuid[0]) ^ le32_to_cpu(uuid[2]);
399 buf->f_fsid.val[1] = le32_to_cpu(uuid[1]) ^ le32_to_cpu(uuid[3]); 399 buf->f_fsid.val[1] = le32_to_cpu(uuid[1]) ^ le32_to_cpu(uuid[3]);
400 ubifs_assert(buf->f_bfree <= c->block_cnt);
400 return 0; 401 return 0;
401} 402}
402 403
@@ -432,33 +433,24 @@ static int ubifs_sync_fs(struct super_block *sb, int wait)
432 int i, err; 433 int i, err;
433 struct ubifs_info *c = sb->s_fs_info; 434 struct ubifs_info *c = sb->s_fs_info;
434 struct writeback_control wbc = { 435 struct writeback_control wbc = {
435 .sync_mode = wait ? WB_SYNC_ALL : WB_SYNC_NONE, 436 .sync_mode = WB_SYNC_ALL,
436 .range_start = 0, 437 .range_start = 0,
437 .range_end = LLONG_MAX, 438 .range_end = LLONG_MAX,
438 .nr_to_write = LONG_MAX, 439 .nr_to_write = LONG_MAX,
439 }; 440 };
440 441
441 /* 442 /*
442 * Note by akpm about WB_SYNC_NONE used above: zero @wait is just an 443 * Zero @wait is just an advisory thing to help the file system shove
443 * advisory thing to help the file system shove lots of data into the 444 * lots of data into the queues, and there will be the second
444 * queues. If some gets missed then it'll be picked up on the second
445 * '->sync_fs()' call, with non-zero @wait. 445 * '->sync_fs()' call, with non-zero @wait.
446 */ 446 */
447 if (!wait)
448 return 0;
447 449
448 if (sb->s_flags & MS_RDONLY) 450 if (sb->s_flags & MS_RDONLY)
449 return 0; 451 return 0;
450 452
451 /* 453 /*
452 * Synchronize write buffers, because 'ubifs_run_commit()' does not
453 * do this if it waits for an already running commit.
454 */
455 for (i = 0; i < c->jhead_cnt; i++) {
456 err = ubifs_wbuf_sync(&c->jheads[i].wbuf);
457 if (err)
458 return err;
459 }
460
461 /*
462 * VFS calls '->sync_fs()' before synchronizing all dirty inodes and 454 * VFS calls '->sync_fs()' before synchronizing all dirty inodes and
463 * pages, so synchronize them first, then commit the journal. Strictly 455 * pages, so synchronize them first, then commit the journal. Strictly
464 * speaking, it is not necessary to commit the journal here, 456 * speaking, it is not necessary to commit the journal here,
@@ -469,6 +461,16 @@ static int ubifs_sync_fs(struct super_block *sb, int wait)
469 */ 461 */
470 generic_sync_sb_inodes(sb, &wbc); 462 generic_sync_sb_inodes(sb, &wbc);
471 463
464 /*
465 * Synchronize write buffers, because 'ubifs_run_commit()' does not
466 * do this if it waits for an already running commit.
467 */
468 for (i = 0; i < c->jhead_cnt; i++) {
469 err = ubifs_wbuf_sync(&c->jheads[i].wbuf);
470 if (err)
471 return err;
472 }
473
472 err = ubifs_run_commit(c); 474 err = ubifs_run_commit(c);
473 if (err) 475 if (err)
474 return err; 476 return err;
@@ -572,15 +574,8 @@ static int init_constants_early(struct ubifs_info *c)
572 c->ranges[UBIFS_IDX_NODE].max_len = INT_MAX; 574 c->ranges[UBIFS_IDX_NODE].max_len = INT_MAX;
573 575
574 /* 576 /*
575 * Initialize dead and dark LEB space watermarks. 577 * Initialize dead and dark LEB space watermarks. See gc.c for comments
576 * 578 * about these values.
577 * Dead space is the space which cannot be used. Its watermark is
578 * equivalent to min. I/O unit or minimum node size if it is greater
579 * then min. I/O unit.
580 *
581 * Dark space is the space which might be used, or might not, depending
582 * on which node should be written to the LEB. Its watermark is
583 * equivalent to maximum UBIFS node size.
584 */ 579 */
585 c->dead_wm = ALIGN(MIN_WRITE_SZ, c->min_io_size); 580 c->dead_wm = ALIGN(MIN_WRITE_SZ, c->min_io_size);
586 c->dark_wm = ALIGN(UBIFS_MAX_NODE_SZ, c->min_io_size); 581 c->dark_wm = ALIGN(UBIFS_MAX_NODE_SZ, c->min_io_size);
@@ -741,12 +736,12 @@ static void init_constants_master(struct ubifs_info *c)
741 * take_gc_lnum - reserve GC LEB. 736 * take_gc_lnum - reserve GC LEB.
742 * @c: UBIFS file-system description object 737 * @c: UBIFS file-system description object
743 * 738 *
744 * This function ensures that the LEB reserved for garbage collection is 739 * This function ensures that the LEB reserved for garbage collection is marked
745 * unmapped and is marked as "taken" in lprops. We also have to set free space 740 * as "taken" in lprops. We also have to set free space to LEB size and dirty
746 * to LEB size and dirty space to zero, because lprops may contain out-of-date 741 * space to zero, because lprops may contain out-of-date information if the
747 * information if the file-system was un-mounted before it has been committed. 742 * file-system was un-mounted before it has been committed. This function
748 * This function returns zero in case of success and a negative error code in 743 * returns zero in case of success and a negative error code in case of
749 * case of failure. 744 * failure.
750 */ 745 */
751static int take_gc_lnum(struct ubifs_info *c) 746static int take_gc_lnum(struct ubifs_info *c)
752{ 747{
@@ -757,10 +752,6 @@ static int take_gc_lnum(struct ubifs_info *c)
757 return -EINVAL; 752 return -EINVAL;
758 } 753 }
759 754
760 err = ubifs_leb_unmap(c, c->gc_lnum);
761 if (err)
762 return err;
763
764 /* And we have to tell lprops that this LEB is taken */ 755 /* And we have to tell lprops that this LEB is taken */
765 err = ubifs_change_one_lp(c, c->gc_lnum, c->leb_size, 0, 756 err = ubifs_change_one_lp(c, c->gc_lnum, c->leb_size, 0,
766 LPROPS_TAKEN, 0, 0); 757 LPROPS_TAKEN, 0, 0);
@@ -966,13 +957,16 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options,
966 957
967 token = match_token(p, tokens, args); 958 token = match_token(p, tokens, args);
968 switch (token) { 959 switch (token) {
960 /*
961 * %Opt_fast_unmount and %Opt_norm_unmount options are ignored.
962 * We accepte them in order to be backware-compatible. But this
963 * should be removed at some point.
964 */
969 case Opt_fast_unmount: 965 case Opt_fast_unmount:
970 c->mount_opts.unmount_mode = 2; 966 c->mount_opts.unmount_mode = 2;
971 c->fast_unmount = 1;
972 break; 967 break;
973 case Opt_norm_unmount: 968 case Opt_norm_unmount:
974 c->mount_opts.unmount_mode = 1; 969 c->mount_opts.unmount_mode = 1;
975 c->fast_unmount = 0;
976 break; 970 break;
977 case Opt_bulk_read: 971 case Opt_bulk_read:
978 c->mount_opts.bulk_read = 2; 972 c->mount_opts.bulk_read = 2;
@@ -1094,12 +1088,7 @@ static int check_free_space(struct ubifs_info *c)
1094 ubifs_err("insufficient free space to mount in read/write mode"); 1088 ubifs_err("insufficient free space to mount in read/write mode");
1095 dbg_dump_budg(c); 1089 dbg_dump_budg(c);
1096 dbg_dump_lprops(c); 1090 dbg_dump_lprops(c);
1097 /* 1091 return -ENOSPC;
1098 * We return %-EINVAL instead of %-ENOSPC because it seems to
1099 * be the closest error code mentioned in the mount function
1100 * documentation.
1101 */
1102 return -EINVAL;
1103 } 1092 }
1104 return 0; 1093 return 0;
1105} 1094}
@@ -1286,10 +1275,19 @@ static int mount_ubifs(struct ubifs_info *c)
1286 if (err) 1275 if (err)
1287 goto out_orphans; 1276 goto out_orphans;
1288 err = ubifs_rcvry_gc_commit(c); 1277 err = ubifs_rcvry_gc_commit(c);
1289 } else 1278 } else {
1290 err = take_gc_lnum(c); 1279 err = take_gc_lnum(c);
1291 if (err) 1280 if (err)
1292 goto out_orphans; 1281 goto out_orphans;
1282
1283 /*
1284 * GC LEB may contain garbage if there was an unclean
1285 * reboot, and it should be un-mapped.
1286 */
1287 err = ubifs_leb_unmap(c, c->gc_lnum);
1288 if (err)
1289 return err;
1290 }
1293 1291
1294 err = dbg_check_lprops(c); 1292 err = dbg_check_lprops(c);
1295 if (err) 1293 if (err)
@@ -1298,6 +1296,16 @@ static int mount_ubifs(struct ubifs_info *c)
1298 err = ubifs_recover_size(c); 1296 err = ubifs_recover_size(c);
1299 if (err) 1297 if (err)
1300 goto out_orphans; 1298 goto out_orphans;
1299 } else {
1300 /*
1301 * Even if we mount read-only, we have to set space in GC LEB
1302 * to proper value because this affects UBIFS free space
1303 * reporting. We do not want to have a situation when
1304 * re-mounting from R/O to R/W changes amount of free space.
1305 */
1306 err = take_gc_lnum(c);
1307 if (err)
1308 goto out_orphans;
1301 } 1309 }
1302 1310
1303 spin_lock(&ubifs_infos_lock); 1311 spin_lock(&ubifs_infos_lock);
@@ -1310,14 +1318,17 @@ static int mount_ubifs(struct ubifs_info *c)
1310 else { 1318 else {
1311 c->need_recovery = 0; 1319 c->need_recovery = 0;
1312 ubifs_msg("recovery completed"); 1320 ubifs_msg("recovery completed");
1321 /* GC LEB has to be empty and taken at this point */
1322 ubifs_assert(c->lst.taken_empty_lebs == 1);
1313 } 1323 }
1314 } 1324 } else
1325 ubifs_assert(c->lst.taken_empty_lebs == 1);
1315 1326
1316 err = dbg_debugfs_init_fs(c); 1327 err = dbg_check_filesystem(c);
1317 if (err) 1328 if (err)
1318 goto out_infos; 1329 goto out_infos;
1319 1330
1320 err = dbg_check_filesystem(c); 1331 err = dbg_debugfs_init_fs(c);
1321 if (err) 1332 if (err)
1322 goto out_infos; 1333 goto out_infos;
1323 1334
@@ -1351,7 +1362,6 @@ static int mount_ubifs(struct ubifs_info *c)
1351 c->uuid[4], c->uuid[5], c->uuid[6], c->uuid[7], 1362 c->uuid[4], c->uuid[5], c->uuid[6], c->uuid[7],
1352 c->uuid[8], c->uuid[9], c->uuid[10], c->uuid[11], 1363 c->uuid[8], c->uuid[9], c->uuid[10], c->uuid[11],
1353 c->uuid[12], c->uuid[13], c->uuid[14], c->uuid[15]); 1364 c->uuid[12], c->uuid[13], c->uuid[14], c->uuid[15]);
1354 dbg_msg("fast unmount: %d", c->fast_unmount);
1355 dbg_msg("big_lpt %d", c->big_lpt); 1365 dbg_msg("big_lpt %d", c->big_lpt);
1356 dbg_msg("log LEBs: %d (%d - %d)", 1366 dbg_msg("log LEBs: %d (%d - %d)",
1357 c->log_lebs, UBIFS_LOG_LNUM, c->log_last); 1367 c->log_lebs, UBIFS_LOG_LNUM, c->log_last);
@@ -1475,10 +1485,8 @@ static int ubifs_remount_rw(struct ubifs_info *c)
1475{ 1485{
1476 int err, lnum; 1486 int err, lnum;
1477 1487
1478 if (c->ro_media)
1479 return -EINVAL;
1480
1481 mutex_lock(&c->umount_mutex); 1488 mutex_lock(&c->umount_mutex);
1489 dbg_save_space_info(c);
1482 c->remounting_rw = 1; 1490 c->remounting_rw = 1;
1483 c->always_chk_crc = 1; 1491 c->always_chk_crc = 1;
1484 1492
@@ -1514,6 +1522,12 @@ static int ubifs_remount_rw(struct ubifs_info *c)
1514 err = ubifs_recover_inl_heads(c, c->sbuf); 1522 err = ubifs_recover_inl_heads(c, c->sbuf);
1515 if (err) 1523 if (err)
1516 goto out; 1524 goto out;
1525 } else {
1526 /* A readonly mount is not allowed to have orphans */
1527 ubifs_assert(c->tot_orphans == 0);
1528 err = ubifs_clear_orphans(c);
1529 if (err)
1530 goto out;
1517 } 1531 }
1518 1532
1519 if (!(c->mst_node->flags & cpu_to_le32(UBIFS_MST_DIRTY))) { 1533 if (!(c->mst_node->flags & cpu_to_le32(UBIFS_MST_DIRTY))) {
@@ -1569,7 +1583,7 @@ static int ubifs_remount_rw(struct ubifs_info *c)
1569 if (c->need_recovery) 1583 if (c->need_recovery)
1570 err = ubifs_rcvry_gc_commit(c); 1584 err = ubifs_rcvry_gc_commit(c);
1571 else 1585 else
1572 err = take_gc_lnum(c); 1586 err = ubifs_leb_unmap(c, c->gc_lnum);
1573 if (err) 1587 if (err)
1574 goto out; 1588 goto out;
1575 1589
@@ -1582,8 +1596,9 @@ static int ubifs_remount_rw(struct ubifs_info *c)
1582 c->vfs_sb->s_flags &= ~MS_RDONLY; 1596 c->vfs_sb->s_flags &= ~MS_RDONLY;
1583 c->remounting_rw = 0; 1597 c->remounting_rw = 0;
1584 c->always_chk_crc = 0; 1598 c->always_chk_crc = 0;
1599 err = dbg_check_space_info(c);
1585 mutex_unlock(&c->umount_mutex); 1600 mutex_unlock(&c->umount_mutex);
1586 return 0; 1601 return err;
1587 1602
1588out: 1603out:
1589 vfree(c->orph_buf); 1604 vfree(c->orph_buf);
@@ -1603,43 +1618,18 @@ out:
1603} 1618}
1604 1619
1605/** 1620/**
1606 * commit_on_unmount - commit the journal when un-mounting.
1607 * @c: UBIFS file-system description object
1608 *
1609 * This function is called during un-mounting and re-mounting, and it commits
1610 * the journal unless the "fast unmount" mode is enabled.
1611 */
1612static void commit_on_unmount(struct ubifs_info *c)
1613{
1614 struct super_block *sb = c->vfs_sb;
1615 long long bud_bytes;
1616
1617 /*
1618 * This function is called before the background thread is stopped, so
1619 * we may race with ongoing commit, which means we have to take
1620 * @c->bud_lock to access @c->bud_bytes.
1621 */
1622 spin_lock(&c->buds_lock);
1623 bud_bytes = c->bud_bytes;
1624 spin_unlock(&c->buds_lock);
1625
1626 if (!c->fast_unmount && !(sb->s_flags & MS_RDONLY) && bud_bytes)
1627 ubifs_run_commit(c);
1628}
1629
1630/**
1631 * ubifs_remount_ro - re-mount in read-only mode. 1621 * ubifs_remount_ro - re-mount in read-only mode.
1632 * @c: UBIFS file-system description object 1622 * @c: UBIFS file-system description object
1633 * 1623 *
1634 * We rely on VFS to have stopped writing. Possibly the background thread could 1624 * We assume VFS has stopped writing. Possibly the background thread could be
1635 * be running a commit, however kthread_stop will wait in that case. 1625 * running a commit, however kthread_stop will wait in that case.
1636 */ 1626 */
1637static void ubifs_remount_ro(struct ubifs_info *c) 1627static void ubifs_remount_ro(struct ubifs_info *c)
1638{ 1628{
1639 int i, err; 1629 int i, err;
1640 1630
1641 ubifs_assert(!c->need_recovery); 1631 ubifs_assert(!c->need_recovery);
1642 commit_on_unmount(c); 1632 ubifs_assert(!(c->vfs_sb->s_flags & MS_RDONLY));
1643 1633
1644 mutex_lock(&c->umount_mutex); 1634 mutex_lock(&c->umount_mutex);
1645 if (c->bgt) { 1635 if (c->bgt) {
@@ -1647,27 +1637,29 @@ static void ubifs_remount_ro(struct ubifs_info *c)
1647 c->bgt = NULL; 1637 c->bgt = NULL;
1648 } 1638 }
1649 1639
1640 dbg_save_space_info(c);
1641
1650 for (i = 0; i < c->jhead_cnt; i++) { 1642 for (i = 0; i < c->jhead_cnt; i++) {
1651 ubifs_wbuf_sync(&c->jheads[i].wbuf); 1643 ubifs_wbuf_sync(&c->jheads[i].wbuf);
1652 del_timer_sync(&c->jheads[i].wbuf.timer); 1644 del_timer_sync(&c->jheads[i].wbuf.timer);
1653 } 1645 }
1654 1646
1655 if (!c->ro_media) { 1647 c->mst_node->flags &= ~cpu_to_le32(UBIFS_MST_DIRTY);
1656 c->mst_node->flags &= ~cpu_to_le32(UBIFS_MST_DIRTY); 1648 c->mst_node->flags |= cpu_to_le32(UBIFS_MST_NO_ORPHS);
1657 c->mst_node->flags |= cpu_to_le32(UBIFS_MST_NO_ORPHS); 1649 c->mst_node->gc_lnum = cpu_to_le32(c->gc_lnum);
1658 c->mst_node->gc_lnum = cpu_to_le32(c->gc_lnum); 1650 err = ubifs_write_master(c);
1659 err = ubifs_write_master(c); 1651 if (err)
1660 if (err) 1652 ubifs_ro_mode(c, err);
1661 ubifs_ro_mode(c, err);
1662 }
1663 1653
1664 ubifs_destroy_idx_gc(c);
1665 free_wbufs(c); 1654 free_wbufs(c);
1666 vfree(c->orph_buf); 1655 vfree(c->orph_buf);
1667 c->orph_buf = NULL; 1656 c->orph_buf = NULL;
1668 vfree(c->ileb_buf); 1657 vfree(c->ileb_buf);
1669 c->ileb_buf = NULL; 1658 c->ileb_buf = NULL;
1670 ubifs_lpt_free(c, 1); 1659 ubifs_lpt_free(c, 1);
1660 err = dbg_check_space_info(c);
1661 if (err)
1662 ubifs_ro_mode(c, err);
1671 mutex_unlock(&c->umount_mutex); 1663 mutex_unlock(&c->umount_mutex);
1672} 1664}
1673 1665
@@ -1760,11 +1752,20 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data)
1760 } 1752 }
1761 1753
1762 if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) { 1754 if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) {
1755 if (c->ro_media) {
1756 ubifs_msg("cannot re-mount due to prior errors");
1757 return -EROFS;
1758 }
1763 err = ubifs_remount_rw(c); 1759 err = ubifs_remount_rw(c);
1764 if (err) 1760 if (err)
1765 return err; 1761 return err;
1766 } else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) 1762 } else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) {
1763 if (c->ro_media) {
1764 ubifs_msg("cannot re-mount due to prior errors");
1765 return -EROFS;
1766 }
1767 ubifs_remount_ro(c); 1767 ubifs_remount_ro(c);
1768 }
1768 1769
1769 if (c->bulk_read == 1) 1770 if (c->bulk_read == 1)
1770 bu_init(c); 1771 bu_init(c);
@@ -1774,10 +1775,11 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data)
1774 c->bu.buf = NULL; 1775 c->bu.buf = NULL;
1775 } 1776 }
1776 1777
1778 ubifs_assert(c->lst.taken_empty_lebs == 1);
1777 return 0; 1779 return 0;
1778} 1780}
1779 1781
1780struct super_operations ubifs_super_operations = { 1782const struct super_operations ubifs_super_operations = {
1781 .alloc_inode = ubifs_alloc_inode, 1783 .alloc_inode = ubifs_alloc_inode,
1782 .destroy_inode = ubifs_destroy_inode, 1784 .destroy_inode = ubifs_destroy_inode,
1783 .put_super = ubifs_put_super, 1785 .put_super = ubifs_put_super,
@@ -2044,15 +2046,6 @@ out_close:
2044 2046
2045static void ubifs_kill_sb(struct super_block *sb) 2047static void ubifs_kill_sb(struct super_block *sb)
2046{ 2048{
2047 struct ubifs_info *c = sb->s_fs_info;
2048
2049 /*
2050 * We do 'commit_on_unmount()' here instead of 'ubifs_put_super()'
2051 * in order to be outside BKL.
2052 */
2053 if (sb->s_root)
2054 commit_on_unmount(c);
2055 /* The un-mount routine is actually done in put_super() */
2056 generic_shutdown_super(sb); 2049 generic_shutdown_super(sb);
2057} 2050}
2058 2051
diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c
index f7e36f545527..fa28a84c6a1b 100644
--- a/fs/ubifs/tnc.c
+++ b/fs/ubifs/tnc.c
@@ -443,6 +443,11 @@ static int tnc_read_node_nm(struct ubifs_info *c, struct ubifs_zbranch *zbr,
443 * This function performs that same function as ubifs_read_node except that 443 * This function performs that same function as ubifs_read_node except that
444 * it does not require that there is actually a node present and instead 444 * it does not require that there is actually a node present and instead
445 * the return code indicates if a node was read. 445 * the return code indicates if a node was read.
446 *
447 * Note, this function does not check CRC of data nodes if @c->no_chk_data_crc
448 * is true (it is controlled by corresponding mount option). However, if
449 * @c->always_chk_crc is true, @c->no_chk_data_crc is ignored and CRC is always
450 * checked.
446 */ 451 */
447static int try_read_node(const struct ubifs_info *c, void *buf, int type, 452static int try_read_node(const struct ubifs_info *c, void *buf, int type,
448 int len, int lnum, int offs) 453 int len, int lnum, int offs)
@@ -470,9 +475,8 @@ static int try_read_node(const struct ubifs_info *c, void *buf, int type,
470 if (node_len != len) 475 if (node_len != len)
471 return 0; 476 return 0;
472 477
473 if (type == UBIFS_DATA_NODE && !c->always_chk_crc) 478 if (type == UBIFS_DATA_NODE && !c->always_chk_crc && c->no_chk_data_crc)
474 if (c->no_chk_data_crc) 479 return 1;
475 return 0;
476 480
477 crc = crc32(UBIFS_CRC32_INIT, buf + 8, node_len - 8); 481 crc = crc32(UBIFS_CRC32_INIT, buf + 8, node_len - 8);
478 node_crc = le32_to_cpu(ch->crc); 482 node_crc = le32_to_cpu(ch->crc);
@@ -1506,7 +1510,7 @@ out:
1506 * 1510 *
1507 * Note, if the bulk-read buffer length (@bu->buf_len) is known, this function 1511 * Note, if the bulk-read buffer length (@bu->buf_len) is known, this function
1508 * makes sure bulk-read nodes fit the buffer. Otherwise, this function prepares 1512 * makes sure bulk-read nodes fit the buffer. Otherwise, this function prepares
1509 * maxumum possible amount of nodes for bulk-read. 1513 * maximum possible amount of nodes for bulk-read.
1510 */ 1514 */
1511int ubifs_tnc_get_bu_keys(struct ubifs_info *c, struct bu_info *bu) 1515int ubifs_tnc_get_bu_keys(struct ubifs_info *c, struct bu_info *bu)
1512{ 1516{
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index fc2a4cc66d03..039a68bee29a 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -426,9 +426,9 @@ struct ubifs_unclean_leb {
426 * LEB properties flags. 426 * LEB properties flags.
427 * 427 *
428 * LPROPS_UNCAT: not categorized 428 * LPROPS_UNCAT: not categorized
429 * LPROPS_DIRTY: dirty > 0, not index 429 * LPROPS_DIRTY: dirty > free, dirty >= @c->dead_wm, not index
430 * LPROPS_DIRTY_IDX: dirty + free > @c->min_idx_node_sze and index 430 * LPROPS_DIRTY_IDX: dirty + free > @c->min_idx_node_sze and index
431 * LPROPS_FREE: free > 0, not empty, not index 431 * LPROPS_FREE: free > 0, dirty < @c->dead_wm, not empty, not index
432 * LPROPS_HEAP_CNT: number of heaps used for storing categorized LEBs 432 * LPROPS_HEAP_CNT: number of heaps used for storing categorized LEBs
433 * LPROPS_EMPTY: LEB is empty, not taken 433 * LPROPS_EMPTY: LEB is empty, not taken
434 * LPROPS_FREEABLE: free + dirty == leb_size, not index, not taken 434 * LPROPS_FREEABLE: free + dirty == leb_size, not index, not taken
@@ -961,7 +961,6 @@ struct ubifs_debug_info;
961 * @cs_lock: commit state lock 961 * @cs_lock: commit state lock
962 * @cmt_wq: wait queue to sleep on if the log is full and a commit is running 962 * @cmt_wq: wait queue to sleep on if the log is full and a commit is running
963 * 963 *
964 * @fast_unmount: do not run journal commit before un-mounting
965 * @big_lpt: flag that LPT is too big to write whole during commit 964 * @big_lpt: flag that LPT is too big to write whole during commit
966 * @no_chk_data_crc: do not check CRCs when reading data nodes (except during 965 * @no_chk_data_crc: do not check CRCs when reading data nodes (except during
967 * recovery) 966 * recovery)
@@ -1202,7 +1201,6 @@ struct ubifs_info {
1202 spinlock_t cs_lock; 1201 spinlock_t cs_lock;
1203 wait_queue_head_t cmt_wq; 1202 wait_queue_head_t cmt_wq;
1204 1203
1205 unsigned int fast_unmount:1;
1206 unsigned int big_lpt:1; 1204 unsigned int big_lpt:1;
1207 unsigned int no_chk_data_crc:1; 1205 unsigned int no_chk_data_crc:1;
1208 unsigned int bulk_read:1; 1206 unsigned int bulk_read:1;
@@ -1405,13 +1403,13 @@ extern struct list_head ubifs_infos;
1405extern spinlock_t ubifs_infos_lock; 1403extern spinlock_t ubifs_infos_lock;
1406extern atomic_long_t ubifs_clean_zn_cnt; 1404extern atomic_long_t ubifs_clean_zn_cnt;
1407extern struct kmem_cache *ubifs_inode_slab; 1405extern struct kmem_cache *ubifs_inode_slab;
1408extern struct super_operations ubifs_super_operations; 1406extern const struct super_operations ubifs_super_operations;
1409extern struct address_space_operations ubifs_file_address_operations; 1407extern const struct address_space_operations ubifs_file_address_operations;
1410extern struct file_operations ubifs_file_operations; 1408extern const struct file_operations ubifs_file_operations;
1411extern struct inode_operations ubifs_file_inode_operations; 1409extern const struct inode_operations ubifs_file_inode_operations;
1412extern struct file_operations ubifs_dir_operations; 1410extern const struct file_operations ubifs_dir_operations;
1413extern struct inode_operations ubifs_dir_inode_operations; 1411extern const struct inode_operations ubifs_dir_inode_operations;
1414extern struct inode_operations ubifs_symlink_inode_operations; 1412extern const struct inode_operations ubifs_symlink_inode_operations;
1415extern struct backing_dev_info ubifs_backing_dev_info; 1413extern struct backing_dev_info ubifs_backing_dev_info;
1416extern struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT]; 1414extern struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT];
1417 1415
@@ -1428,7 +1426,7 @@ int ubifs_read_node_wbuf(struct ubifs_wbuf *wbuf, void *buf, int type, int len,
1428int ubifs_write_node(struct ubifs_info *c, void *node, int len, int lnum, 1426int ubifs_write_node(struct ubifs_info *c, void *node, int len, int lnum,
1429 int offs, int dtype); 1427 int offs, int dtype);
1430int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum, 1428int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum,
1431 int offs, int quiet, int chk_crc); 1429 int offs, int quiet, int must_chk_crc);
1432void ubifs_prepare_node(struct ubifs_info *c, void *buf, int len, int pad); 1430void ubifs_prepare_node(struct ubifs_info *c, void *buf, int len, int pad);
1433void ubifs_prep_grp_node(struct ubifs_info *c, void *node, int len, int last); 1431void ubifs_prep_grp_node(struct ubifs_info *c, void *node, int len, int last);
1434int ubifs_io_init(struct ubifs_info *c); 1432int ubifs_io_init(struct ubifs_info *c);
@@ -1495,6 +1493,7 @@ void ubifs_release_ino_dirty(struct ubifs_info *c, struct inode *inode,
1495void ubifs_cancel_ino_op(struct ubifs_info *c, struct inode *inode, 1493void ubifs_cancel_ino_op(struct ubifs_info *c, struct inode *inode,
1496 struct ubifs_budget_req *req); 1494 struct ubifs_budget_req *req);
1497long long ubifs_get_free_space(struct ubifs_info *c); 1495long long ubifs_get_free_space(struct ubifs_info *c);
1496long long ubifs_get_free_space_nolock(struct ubifs_info *c);
1498int ubifs_calc_min_idx_lebs(struct ubifs_info *c); 1497int ubifs_calc_min_idx_lebs(struct ubifs_info *c);
1499void ubifs_convert_page_budget(struct ubifs_info *c); 1498void ubifs_convert_page_budget(struct ubifs_info *c);
1500long long ubifs_reported_space(const struct ubifs_info *c, long long free); 1499long long ubifs_reported_space(const struct ubifs_info *c, long long free);
@@ -1603,6 +1602,7 @@ void ubifs_delete_orphan(struct ubifs_info *c, ino_t inum);
1603int ubifs_orphan_start_commit(struct ubifs_info *c); 1602int ubifs_orphan_start_commit(struct ubifs_info *c);
1604int ubifs_orphan_end_commit(struct ubifs_info *c); 1603int ubifs_orphan_end_commit(struct ubifs_info *c);
1605int ubifs_mount_orphans(struct ubifs_info *c, int unclean, int read_only); 1604int ubifs_mount_orphans(struct ubifs_info *c, int unclean, int read_only);
1605int ubifs_clear_orphans(struct ubifs_info *c);
1606 1606
1607/* lpt.c */ 1607/* lpt.c */
1608int ubifs_calc_lpt_geom(struct ubifs_info *c); 1608int ubifs_calc_lpt_geom(struct ubifs_info *c);
@@ -1646,7 +1646,7 @@ const struct ubifs_lprops *ubifs_change_lp(struct ubifs_info *c,
1646 const struct ubifs_lprops *lp, 1646 const struct ubifs_lprops *lp,
1647 int free, int dirty, int flags, 1647 int free, int dirty, int flags,
1648 int idx_gc_cnt); 1648 int idx_gc_cnt);
1649void ubifs_get_lp_stats(struct ubifs_info *c, struct ubifs_lp_stats *stats); 1649void ubifs_get_lp_stats(struct ubifs_info *c, struct ubifs_lp_stats *lst);
1650void ubifs_add_to_cat(struct ubifs_info *c, struct ubifs_lprops *lprops, 1650void ubifs_add_to_cat(struct ubifs_info *c, struct ubifs_lprops *lprops,
1651 int cat); 1651 int cat);
1652void ubifs_replace_cat(struct ubifs_info *c, struct ubifs_lprops *old_lprops, 1652void ubifs_replace_cat(struct ubifs_info *c, struct ubifs_lprops *old_lprops,
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c
index 2ed035354c26..a608e72fa405 100644
--- a/fs/xfs/linux-2.6/xfs_sync.c
+++ b/fs/xfs/linux-2.6/xfs_sync.c
@@ -371,7 +371,11 @@ xfs_quiesce_attr(
371 /* flush inodes and push all remaining buffers out to disk */ 371 /* flush inodes and push all remaining buffers out to disk */
372 xfs_quiesce_fs(mp); 372 xfs_quiesce_fs(mp);
373 373
374 ASSERT_ALWAYS(atomic_read(&mp->m_active_trans) == 0); 374 /*
375 * Just warn here till VFS can correctly support
376 * read-only remount without racing.
377 */
378 WARN_ON(atomic_read(&mp->m_active_trans) != 0);
375 379
376 /* Push the superblock and write an unmount record */ 380 /* Push the superblock and write an unmount record */
377 error = xfs_log_sbcount(mp, 1); 381 error = xfs_log_sbcount(mp, 1);
diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c
index b4c1ee713492..f8278cfcc1d3 100644
--- a/fs/xfs/xfs_dfrag.c
+++ b/fs/xfs/xfs_dfrag.c
@@ -55,17 +55,11 @@ xfs_swapext(
55 struct file *file, *target_file; 55 struct file *file, *target_file;
56 int error = 0; 56 int error = 0;
57 57
58 sxp = kmem_alloc(sizeof(xfs_swapext_t), KM_MAYFAIL);
59 if (!sxp) {
60 error = XFS_ERROR(ENOMEM);
61 goto out;
62 }
63
64 /* Pull information for the target fd */ 58 /* Pull information for the target fd */
65 file = fget((int)sxp->sx_fdtarget); 59 file = fget((int)sxp->sx_fdtarget);
66 if (!file) { 60 if (!file) {
67 error = XFS_ERROR(EINVAL); 61 error = XFS_ERROR(EINVAL);
68 goto out_free_sxp; 62 goto out;
69 } 63 }
70 64
71 if (!(file->f_mode & FMODE_WRITE) || (file->f_flags & O_APPEND)) { 65 if (!(file->f_mode & FMODE_WRITE) || (file->f_flags & O_APPEND)) {
@@ -109,8 +103,6 @@ xfs_swapext(
109 fput(target_file); 103 fput(target_file);
110 out_put_file: 104 out_put_file:
111 fput(file); 105 fput(file);
112 out_free_sxp:
113 kmem_free(sxp);
114 out: 106 out:
115 return error; 107 return error;
116} 108}
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 35cca98bd94c..b1047de2fffd 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -70,16 +70,21 @@ STATIC void xlog_recover_check_summary(xlog_t *);
70xfs_buf_t * 70xfs_buf_t *
71xlog_get_bp( 71xlog_get_bp(
72 xlog_t *log, 72 xlog_t *log,
73 int num_bblks) 73 int nbblks)
74{ 74{
75 ASSERT(num_bblks > 0); 75 if (nbblks <= 0 || nbblks > log->l_logBBsize) {
76 xlog_warn("XFS: Invalid block length (0x%x) given for buffer", nbblks);
77 XFS_ERROR_REPORT("xlog_get_bp(1)",
78 XFS_ERRLEVEL_HIGH, log->l_mp);
79 return NULL;
80 }
76 81
77 if (log->l_sectbb_log) { 82 if (log->l_sectbb_log) {
78 if (num_bblks > 1) 83 if (nbblks > 1)
79 num_bblks += XLOG_SECTOR_ROUNDUP_BBCOUNT(log, 1); 84 nbblks += XLOG_SECTOR_ROUNDUP_BBCOUNT(log, 1);
80 num_bblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, num_bblks); 85 nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks);
81 } 86 }
82 return xfs_buf_get_noaddr(BBTOB(num_bblks), log->l_mp->m_logdev_targp); 87 return xfs_buf_get_noaddr(BBTOB(nbblks), log->l_mp->m_logdev_targp);
83} 88}
84 89
85void 90void
@@ -102,6 +107,13 @@ xlog_bread(
102{ 107{
103 int error; 108 int error;
104 109
110 if (nbblks <= 0 || nbblks > log->l_logBBsize) {
111 xlog_warn("XFS: Invalid block length (0x%x) given for buffer", nbblks);
112 XFS_ERROR_REPORT("xlog_bread(1)",
113 XFS_ERRLEVEL_HIGH, log->l_mp);
114 return EFSCORRUPTED;
115 }
116
105 if (log->l_sectbb_log) { 117 if (log->l_sectbb_log) {
106 blk_no = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, blk_no); 118 blk_no = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, blk_no);
107 nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks); 119 nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks);
@@ -139,6 +151,13 @@ xlog_bwrite(
139{ 151{
140 int error; 152 int error;
141 153
154 if (nbblks <= 0 || nbblks > log->l_logBBsize) {
155 xlog_warn("XFS: Invalid block length (0x%x) given for buffer", nbblks);
156 XFS_ERROR_REPORT("xlog_bwrite(1)",
157 XFS_ERRLEVEL_HIGH, log->l_mp);
158 return EFSCORRUPTED;
159 }
160
142 if (log->l_sectbb_log) { 161 if (log->l_sectbb_log) {
143 blk_no = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, blk_no); 162 blk_no = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, blk_no);
144 nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks); 163 nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks);
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 2124c063a7ef..b97cdc516a8f 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -90,7 +90,6 @@ header-y += if_ppp.h
90header-y += if_slip.h 90header-y += if_slip.h
91header-y += if_strip.h 91header-y += if_strip.h
92header-y += if_tun.h 92header-y += if_tun.h
93header-y += if_tunnel.h
94header-y += in_route.h 93header-y += in_route.h
95header-y += ioctl.h 94header-y += ioctl.h
96header-y += ip6_tunnel.h 95header-y += ip6_tunnel.h
@@ -236,6 +235,7 @@ unifdef-y += if_phonet.h
236unifdef-y += if_pppol2tp.h 235unifdef-y += if_pppol2tp.h
237unifdef-y += if_pppox.h 236unifdef-y += if_pppox.h
238unifdef-y += if_tr.h 237unifdef-y += if_tr.h
238unifdef-y += if_tunnel.h
239unifdef-y += if_vlan.h 239unifdef-y += if_vlan.h
240unifdef-y += igmp.h 240unifdef-y += igmp.h
241unifdef-y += inet_diag.h 241unifdef-y += inet_diag.h
diff --git a/include/linux/ata.h b/include/linux/ata.h
index a53318b8cbd0..08a86d5cdf1b 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -731,12 +731,17 @@ static inline int ata_id_current_chs_valid(const u16 *id)
731 731
732static inline int ata_id_is_cfa(const u16 *id) 732static inline int ata_id_is_cfa(const u16 *id)
733{ 733{
734 if (id[ATA_ID_CONFIG] == 0x848A) /* Standard CF */ 734 if (id[ATA_ID_CONFIG] == 0x848A) /* Traditional CF */
735 return 1; 735 return 1;
736 /* Could be CF hiding as standard ATA */ 736 /*
737 if (ata_id_major_version(id) >= 3 && 737 * CF specs don't require specific value in the word 0 anymore and yet
738 id[ATA_ID_COMMAND_SET_1] != 0xFFFF && 738 * they forbid to report the ATA version in the word 80 and require the
739 (id[ATA_ID_COMMAND_SET_1] & (1 << 2))) 739 * CFA feature set support to be indicated in the word 83 in this case.
740 * Unfortunately, some cards only follow either of this requirements,
741 * and while those that don't indicate CFA feature support need some
742 * sort of quirk list, it seems impractical for the ones that do...
743 */
744 if ((id[ATA_ID_COMMAND_SET_2] & 0xC004) == 0x4004)
740 return 1; 745 return 1;
741 return 0; 746 return 0;
742} 747}
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index aeab2cb32a9c..82c43624c067 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -2,7 +2,10 @@
2#define _IF_TUNNEL_H_ 2#define _IF_TUNNEL_H_
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5
6#ifdef __KERNEL__
5#include <linux/ip.h> 7#include <linux/ip.h>
8#endif
6 9
7#define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0) 10#define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0)
8#define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1) 11#define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1)
diff --git a/include/linux/libata.h b/include/linux/libata.h
index bca3ba25f52a..5d87bc09a1f5 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -380,6 +380,7 @@ enum {
380 ATA_HORKAGE_ATAPI_MOD16_DMA = (1 << 11), /* use ATAPI DMA for commands 380 ATA_HORKAGE_ATAPI_MOD16_DMA = (1 << 11), /* use ATAPI DMA for commands
381 not multiple of 16 bytes */ 381 not multiple of 16 bytes */
382 ATA_HORKAGE_FIRMWARE_WARN = (1 << 12), /* firwmare update warning */ 382 ATA_HORKAGE_FIRMWARE_WARN = (1 << 12), /* firwmare update warning */
383 ATA_HORKAGE_1_5_GBPS = (1 << 13), /* force 1.5 Gbps */
383 384
384 /* DMA mask for user DMA control: User visible values; DO NOT 385 /* DMA mask for user DMA control: User visible values; DO NOT
385 renumber */ 386 renumber */
@@ -580,7 +581,7 @@ struct ata_device {
580 acpi_handle acpi_handle; 581 acpi_handle acpi_handle;
581 union acpi_object *gtf_cache; 582 union acpi_object *gtf_cache;
582#endif 583#endif
583 /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */ 584 /* n_sector is CLEAR_BEGIN, read comment above CLEAR_BEGIN */
584 u64 n_sectors; /* size of device, if ATA */ 585 u64 n_sectors; /* size of device, if ATA */
585 unsigned int class; /* ATA_DEV_xxx */ 586 unsigned int class; /* ATA_DEV_xxx */
586 unsigned long unpark_deadline; 587 unsigned long unpark_deadline;
@@ -605,20 +606,22 @@ struct ata_device {
605 u16 heads; /* Number of heads */ 606 u16 heads; /* Number of heads */
606 u16 sectors; /* Number of sectors per track */ 607 u16 sectors; /* Number of sectors per track */
607 608
608 /* error history */
609 int spdn_cnt;
610 struct ata_ering ering;
611
612 union { 609 union {
613 u16 id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */ 610 u16 id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */
614 u32 gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */ 611 u32 gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */
615 }; 612 };
613
614 /* error history */
615 int spdn_cnt;
616 /* ering is CLEAR_END, read comment above CLEAR_END */
617 struct ata_ering ering;
616}; 618};
617 619
618/* Offset into struct ata_device. Fields above it are maintained 620/* Fields between ATA_DEVICE_CLEAR_BEGIN and ATA_DEVICE_CLEAR_END are
619 * acress device init. Fields below are zeroed. 621 * cleared to zero on ata_dev_init().
620 */ 622 */
621#define ATA_DEVICE_CLEAR_OFFSET offsetof(struct ata_device, n_sectors) 623#define ATA_DEVICE_CLEAR_BEGIN offsetof(struct ata_device, n_sectors)
624#define ATA_DEVICE_CLEAR_END offsetof(struct ata_device, ering)
622 625
623struct ata_eh_info { 626struct ata_eh_info {
624 struct ata_device *dev; /* offending device */ 627 struct ata_device *dev; /* offending device */
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index b493db7841dc..dc32dae01e5f 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -1051,13 +1051,22 @@ continue_unlock:
1051 } 1051 }
1052 } 1052 }
1053 1053
1054 if (wbc->sync_mode == WB_SYNC_NONE) { 1054 if (nr_to_write > 0)
1055 wbc->nr_to_write--; 1055 nr_to_write--;
1056 if (wbc->nr_to_write <= 0) { 1056 else if (wbc->sync_mode == WB_SYNC_NONE) {
1057 done = 1; 1057 /*
1058 break; 1058 * We stop writing back only if we are not
1059 } 1059 * doing integrity sync. In case of integrity
1060 * sync we have to keep going because someone
1061 * may be concurrently dirtying pages, and we
1062 * might have synced a lot of newly appeared
1063 * dirty pages, but have not synced all of the
1064 * old dirty pages.
1065 */
1066 done = 1;
1067 break;
1060 } 1068 }
1069
1061 if (wbc->nonblocking && bdi_write_congested(bdi)) { 1070 if (wbc->nonblocking && bdi_write_congested(bdi)) {
1062 wbc->encountered_congestion = 1; 1071 wbc->encountered_congestion = 1;
1063 done = 1; 1072 done = 1;
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index b7faffe5c029..1ab180bad72a 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1015,9 +1015,11 @@ static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
1015 1015
1016 if ((rc = sock_queue_rcv_skb(sk, skb)) < 0) { 1016 if ((rc = sock_queue_rcv_skb(sk, skb)) < 0) {
1017 /* Note that an ENOMEM error is charged twice */ 1017 /* Note that an ENOMEM error is charged twice */
1018 if (rc == -ENOMEM) 1018 if (rc == -ENOMEM) {
1019 UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_RCVBUFERRORS, 1019 UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_RCVBUFERRORS,
1020 is_udplite); 1020 is_udplite);
1021 atomic_inc(&sk->sk_drops);
1022 }
1021 goto drop; 1023 goto drop;
1022 } 1024 }
1023 1025
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 9454d4ae46df..1fc4a7885c41 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -222,13 +222,13 @@ static void *packet_lookup_frame(struct packet_sock *po, unsigned int position,
222 h.raw = po->pg_vec[pg_vec_pos] + (frame_offset * po->frame_size); 222 h.raw = po->pg_vec[pg_vec_pos] + (frame_offset * po->frame_size);
223 switch (po->tp_version) { 223 switch (po->tp_version) {
224 case TPACKET_V1: 224 case TPACKET_V1:
225 if (status != h.h1->tp_status ? TP_STATUS_USER : 225 if (status != (h.h1->tp_status ? TP_STATUS_USER :
226 TP_STATUS_KERNEL) 226 TP_STATUS_KERNEL))
227 return NULL; 227 return NULL;
228 break; 228 break;
229 case TPACKET_V2: 229 case TPACKET_V2:
230 if (status != h.h2->tp_status ? TP_STATUS_USER : 230 if (status != (h.h2->tp_status ? TP_STATUS_USER :
231 TP_STATUS_KERNEL) 231 TP_STATUS_KERNEL))
232 return NULL; 232 return NULL;
233 break; 233 break;
234 } 234 }
diff --git a/net/sunrpc/Kconfig b/net/sunrpc/Kconfig
index dcef600d0bf5..5592883e1e4a 100644
--- a/net/sunrpc/Kconfig
+++ b/net/sunrpc/Kconfig
@@ -6,7 +6,7 @@ config SUNRPC_GSS
6 6
7config SUNRPC_XPRT_RDMA 7config SUNRPC_XPRT_RDMA
8 tristate 8 tristate
9 depends on SUNRPC && INFINIBAND && EXPERIMENTAL 9 depends on SUNRPC && INFINIBAND && INFINIBAND_ADDR_TRANS && EXPERIMENTAL
10 default SUNRPC && INFINIBAND 10 default SUNRPC && INFINIBAND
11 help 11 help
12 This option allows the NFS client and server to support 12 This option allows the NFS client and server to support