diff options
189 files changed, 5213 insertions, 2734 deletions
diff --git a/Documentation/cpu-freq/core.txt b/Documentation/cpu-freq/core.txt index 29b3f9ffc66c..ce0666e51036 100644 --- a/Documentation/cpu-freq/core.txt +++ b/Documentation/cpu-freq/core.txt | |||
@@ -24,7 +24,7 @@ Contents: | |||
24 | 1. General Information | 24 | 1. General Information |
25 | ======================= | 25 | ======================= |
26 | 26 | ||
27 | The CPUFreq core code is located in linux/kernel/cpufreq.c. This | 27 | The CPUFreq core code is located in drivers/cpufreq/cpufreq.c. This |
28 | cpufreq code offers a standardized interface for the CPUFreq | 28 | cpufreq code offers a standardized interface for the CPUFreq |
29 | architecture drivers (those pieces of code that do actual | 29 | architecture drivers (those pieces of code that do actual |
30 | frequency transitions), as well as to "notifiers". These are device | 30 | frequency transitions), as well as to "notifiers". These are device |
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 46f2a559b27c..64ce44da5936 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -216,17 +216,6 @@ Who: Thomas Gleixner <tglx@linutronix.de> | |||
216 | 216 | ||
217 | --------------------------- | 217 | --------------------------- |
218 | 218 | ||
219 | What: i2c-ite and i2c-algo-ite drivers | ||
220 | When: September 2006 | ||
221 | Why: These drivers never compiled since they were added to the kernel | ||
222 | tree 5 years ago. This feature removal can be reevaluated if | ||
223 | someone shows interest in the drivers, fixes them and takes over | ||
224 | maintenance. | ||
225 | http://marc.theaimsgroup.com/?l=linux-mips&m=115040510817448 | ||
226 | Who: Jean Delvare <khali@linux-fr.org> | ||
227 | |||
228 | --------------------------- | ||
229 | |||
230 | What: Bridge netfilter deferred IPv4/IPv6 output hook calling | 219 | What: Bridge netfilter deferred IPv4/IPv6 output hook calling |
231 | When: January 2007 | 220 | When: January 2007 |
232 | Why: The deferred output hooks are a layering violation causing unusual | 221 | Why: The deferred output hooks are a layering violation causing unusual |
@@ -270,3 +259,25 @@ Why: The new layer 3 independant connection tracking replaces the old | |||
270 | Who: Patrick McHardy <kaber@trash.net> | 259 | Who: Patrick McHardy <kaber@trash.net> |
271 | 260 | ||
272 | --------------------------- | 261 | --------------------------- |
262 | |||
263 | What: ACPI hooks (X86_SPEEDSTEP_CENTRINO_ACPI) in speedstep-centrino driver | ||
264 | When: December 2006 | ||
265 | Why: Speedstep-centrino driver with ACPI hooks and acpi-cpufreq driver are | ||
266 | functionally very much similar. They talk to ACPI in same way. Only | ||
267 | difference between them is the way they do frequency transitions. | ||
268 | One uses MSRs and the other one uses IO ports. Functionaliy of | ||
269 | speedstep_centrino with ACPI hooks is now merged into acpi-cpufreq. | ||
270 | That means one common driver will support all Intel Enhanced Speedstep | ||
271 | capable CPUs. That means less confusion over name of | ||
272 | speedstep-centrino driver (with that driver supposed to be used on | ||
273 | non-centrino platforms). That means less duplication of code and | ||
274 | less maintenance effort and no possibility of these two drivers | ||
275 | going out of sync. | ||
276 | Current users of speedstep_centrino with ACPI hooks are requested to | ||
277 | switch over to acpi-cpufreq driver. speedstep-centrino will continue | ||
278 | to work using older non-ACPI static table based scheme even after this | ||
279 | date. | ||
280 | |||
281 | Who: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> | ||
282 | |||
283 | --------------------------- | ||
diff --git a/Documentation/filesystems/ocfs2.txt b/Documentation/filesystems/ocfs2.txt index af6defd10cb6..8ccf0c1b58ed 100644 --- a/Documentation/filesystems/ocfs2.txt +++ b/Documentation/filesystems/ocfs2.txt | |||
@@ -54,3 +54,6 @@ errors=panic Panic and halt the machine if an error occurs. | |||
54 | intr (*) Allow signals to interrupt cluster operations. | 54 | intr (*) Allow signals to interrupt cluster operations. |
55 | nointr Do not allow signals to interrupt cluster | 55 | nointr Do not allow signals to interrupt cluster |
56 | operations. | 56 | operations. |
57 | atime_quantum=60(*) OCFS2 will not update atime unless this number | ||
58 | of seconds has passed since the last update. | ||
59 | Set to zero to always update atime. | ||
diff --git a/Documentation/i2c/busses/i2c-amd8111 b/Documentation/i2c/busses/i2c-amd8111 index db294ee7455a..460dd6635fd2 100644 --- a/Documentation/i2c/busses/i2c-amd8111 +++ b/Documentation/i2c/busses/i2c-amd8111 | |||
@@ -5,7 +5,7 @@ Supported adapters: | |||
5 | 5 | ||
6 | Datasheets: | 6 | Datasheets: |
7 | AMD datasheet not yet available, but almost everything can be found | 7 | AMD datasheet not yet available, but almost everything can be found |
8 | in publically available ACPI 2.0 specification, which the adapter | 8 | in the publicly available ACPI 2.0 specification, which the adapter |
9 | follows. | 9 | follows. |
10 | 10 | ||
11 | Author: Vojtech Pavlik <vojtech@suse.cz> | 11 | Author: Vojtech Pavlik <vojtech@suse.cz> |
diff --git a/Documentation/i2c/busses/i2c-i801 b/Documentation/i2c/busses/i2c-i801 index e46c23458242..3db69a086c41 100644 --- a/Documentation/i2c/busses/i2c-i801 +++ b/Documentation/i2c/busses/i2c-i801 | |||
@@ -9,7 +9,10 @@ Supported adapters: | |||
9 | * Intel 82801EB/ER (ICH5) (HW PEC supported, 32 byte buffer not supported) | 9 | * Intel 82801EB/ER (ICH5) (HW PEC supported, 32 byte buffer not supported) |
10 | * Intel 6300ESB | 10 | * Intel 6300ESB |
11 | * Intel 82801FB/FR/FW/FRW (ICH6) | 11 | * Intel 82801FB/FR/FW/FRW (ICH6) |
12 | * Intel ICH7 | 12 | * Intel 82801G (ICH7) |
13 | * Intel 631xESB/632xESB (ESB2) | ||
14 | * Intel 82801H (ICH8) | ||
15 | * Intel ICH9 | ||
13 | Datasheets: Publicly available at the Intel website | 16 | Datasheets: Publicly available at the Intel website |
14 | 17 | ||
15 | Authors: | 18 | Authors: |
diff --git a/Documentation/i2c/busses/i2c-nforce2 b/Documentation/i2c/busses/i2c-nforce2 index cd49c428a3ab..7f61fbc03f7f 100644 --- a/Documentation/i2c/busses/i2c-nforce2 +++ b/Documentation/i2c/busses/i2c-nforce2 | |||
@@ -10,11 +10,11 @@ Supported adapters: | |||
10 | * nForce4 MCP51 10de:0264 | 10 | * nForce4 MCP51 10de:0264 |
11 | * nForce4 MCP55 10de:0368 | 11 | * nForce4 MCP55 10de:0368 |
12 | 12 | ||
13 | Datasheet: not publically available, but seems to be similar to the | 13 | Datasheet: not publicly available, but seems to be similar to the |
14 | AMD-8111 SMBus 2.0 adapter. | 14 | AMD-8111 SMBus 2.0 adapter. |
15 | 15 | ||
16 | Authors: | 16 | Authors: |
17 | Hans-Frieder Vogt <hfvogt@arcor.de>, | 17 | Hans-Frieder Vogt <hfvogt@gmx.net>, |
18 | Thomas Leibold <thomas@plx.com>, | 18 | Thomas Leibold <thomas@plx.com>, |
19 | Patrick Dreker <patrick@dreker.de> | 19 | Patrick Dreker <patrick@dreker.de> |
20 | 20 | ||
@@ -38,7 +38,7 @@ Notes | |||
38 | ----- | 38 | ----- |
39 | 39 | ||
40 | The SMBus adapter in the nForce2 chipset seems to be very similar to the | 40 | The SMBus adapter in the nForce2 chipset seems to be very similar to the |
41 | SMBus 2.0 adapter in the AMD-8111 southbridge. However, I could only get | 41 | SMBus 2.0 adapter in the AMD-8111 south bridge. However, I could only get |
42 | the driver to work with direct I/O access, which is different to the EC | 42 | the driver to work with direct I/O access, which is different to the EC |
43 | interface of the AMD-8111. Tested on Asus A7N8X. The ACPI DSDT table of the | 43 | interface of the AMD-8111. Tested on Asus A7N8X. The ACPI DSDT table of the |
44 | Asus A7N8X lists two SMBuses, both of which are supported by this driver. | 44 | Asus A7N8X lists two SMBuses, both of which are supported by this driver. |
diff --git a/MAINTAINERS b/MAINTAINERS index 9649ed90e793..8a0bfeca55c9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -740,7 +740,7 @@ P: Dave Jones | |||
740 | M: davej@codemonkey.org.uk | 740 | M: davej@codemonkey.org.uk |
741 | L: cpufreq@lists.linux.org.uk | 741 | L: cpufreq@lists.linux.org.uk |
742 | W: http://www.codemonkey.org.uk/projects/cpufreq/ | 742 | W: http://www.codemonkey.org.uk/projects/cpufreq/ |
743 | T: git kernel.org/pub/scm/linux/kernel/davej/cpufreq.git | 743 | T: git kernel.org/pub/scm/linux/kernel/git/davej/cpufreq.git |
744 | S: Maintained | 744 | S: Maintained |
745 | 745 | ||
746 | CPUID/MSR DRIVER | 746 | CPUID/MSR DRIVER |
diff --git a/arch/arm/mach-pnx4008/Makefile b/arch/arm/mach-pnx4008/Makefile index b457ca0a431a..777564c90a12 100644 --- a/arch/arm/mach-pnx4008/Makefile +++ b/arch/arm/mach-pnx4008/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for the linux kernel. | 2 | # Makefile for the linux kernel. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := core.o irq.o time.o clock.o gpio.o serial.o dma.o | 5 | obj-y := core.o irq.o time.o clock.o gpio.o serial.o dma.o i2c.o |
6 | obj-m := | 6 | obj-m := |
7 | obj-n := | 7 | obj-n := |
8 | obj- := | 8 | obj- := |
diff --git a/arch/arm/mach-pnx4008/i2c.c b/arch/arm/mach-pnx4008/i2c.c new file mode 100644 index 000000000000..6f308827c4fe --- /dev/null +++ b/arch/arm/mach-pnx4008/i2c.c | |||
@@ -0,0 +1,167 @@ | |||
1 | /* | ||
2 | * I2C initialization for PNX4008. | ||
3 | * | ||
4 | * Author: Vitaly Wool <vitalywool@gmail.com> | ||
5 | * | ||
6 | * 2005-2006 (c) MontaVista Software, Inc. This file is licensed under | ||
7 | * the terms of the GNU General Public License version 2. This program | ||
8 | * is licensed "as is" without any warranty of any kind, whether express | ||
9 | * or implied. | ||
10 | */ | ||
11 | |||
12 | #include <linux/clk.h> | ||
13 | #include <linux/i2c.h> | ||
14 | #include <linux/i2c-pnx.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/err.h> | ||
17 | #include <asm/arch/platform.h> | ||
18 | #include <asm/arch/i2c.h> | ||
19 | |||
20 | static int set_clock_run(struct platform_device *pdev) | ||
21 | { | ||
22 | struct clk *clk; | ||
23 | char name[10]; | ||
24 | int retval = 0; | ||
25 | |||
26 | snprintf(name, 10, "i2c%d_ck", pdev->id); | ||
27 | clk = clk_get(&pdev->dev, name); | ||
28 | if (!IS_ERR(clk)) { | ||
29 | clk_set_rate(clk, 1); | ||
30 | clk_put(clk); | ||
31 | } else | ||
32 | retval = -ENOENT; | ||
33 | |||
34 | return retval; | ||
35 | } | ||
36 | |||
37 | static int set_clock_stop(struct platform_device *pdev) | ||
38 | { | ||
39 | struct clk *clk; | ||
40 | char name[10]; | ||
41 | int retval = 0; | ||
42 | |||
43 | snprintf(name, 10, "i2c%d_ck", pdev->id); | ||
44 | clk = clk_get(&pdev->dev, name); | ||
45 | if (!IS_ERR(clk)) { | ||
46 | clk_set_rate(clk, 0); | ||
47 | clk_put(clk); | ||
48 | } else | ||
49 | retval = -ENOENT; | ||
50 | |||
51 | return retval; | ||
52 | } | ||
53 | |||
54 | static int i2c_pnx_suspend(struct platform_device *pdev, pm_message_t state) | ||
55 | { | ||
56 | int retval = 0; | ||
57 | #ifdef CONFIG_PM | ||
58 | retval = set_clock_run(pdev); | ||
59 | #endif | ||
60 | return retval; | ||
61 | } | ||
62 | |||
63 | static int i2c_pnx_resume(struct platform_device *pdev) | ||
64 | { | ||
65 | int retval = 0; | ||
66 | #ifdef CONFIG_PM | ||
67 | retval = set_clock_run(pdev); | ||
68 | #endif | ||
69 | return retval; | ||
70 | } | ||
71 | |||
72 | static u32 calculate_input_freq(struct platform_device *pdev) | ||
73 | { | ||
74 | return HCLK_MHZ; | ||
75 | } | ||
76 | |||
77 | |||
78 | static struct i2c_pnx_algo_data pnx_algo_data0 = { | ||
79 | .base = PNX4008_I2C1_BASE, | ||
80 | .irq = I2C_1_INT, | ||
81 | }; | ||
82 | |||
83 | static struct i2c_pnx_algo_data pnx_algo_data1 = { | ||
84 | .base = PNX4008_I2C2_BASE, | ||
85 | .irq = I2C_2_INT, | ||
86 | }; | ||
87 | |||
88 | static struct i2c_pnx_algo_data pnx_algo_data2 = { | ||
89 | .base = (PNX4008_USB_CONFIG_BASE + 0x300), | ||
90 | .irq = USB_I2C_INT, | ||
91 | }; | ||
92 | |||
93 | static struct i2c_adapter pnx_adapter0 = { | ||
94 | .name = I2C_CHIP_NAME "0", | ||
95 | .algo_data = &pnx_algo_data0, | ||
96 | }; | ||
97 | static struct i2c_adapter pnx_adapter1 = { | ||
98 | .name = I2C_CHIP_NAME "1", | ||
99 | .algo_data = &pnx_algo_data1, | ||
100 | }; | ||
101 | |||
102 | static struct i2c_adapter pnx_adapter2 = { | ||
103 | .name = "USB-I2C", | ||
104 | .algo_data = &pnx_algo_data2, | ||
105 | }; | ||
106 | |||
107 | static struct i2c_pnx_data i2c0_data = { | ||
108 | .suspend = i2c_pnx_suspend, | ||
109 | .resume = i2c_pnx_resume, | ||
110 | .calculate_input_freq = calculate_input_freq, | ||
111 | .set_clock_run = set_clock_run, | ||
112 | .set_clock_stop = set_clock_stop, | ||
113 | .adapter = &pnx_adapter0, | ||
114 | }; | ||
115 | |||
116 | static struct i2c_pnx_data i2c1_data = { | ||
117 | .suspend = i2c_pnx_suspend, | ||
118 | .resume = i2c_pnx_resume, | ||
119 | .calculate_input_freq = calculate_input_freq, | ||
120 | .set_clock_run = set_clock_run, | ||
121 | .set_clock_stop = set_clock_stop, | ||
122 | .adapter = &pnx_adapter1, | ||
123 | }; | ||
124 | |||
125 | static struct i2c_pnx_data i2c2_data = { | ||
126 | .suspend = i2c_pnx_suspend, | ||
127 | .resume = i2c_pnx_resume, | ||
128 | .calculate_input_freq = calculate_input_freq, | ||
129 | .set_clock_run = set_clock_run, | ||
130 | .set_clock_stop = set_clock_stop, | ||
131 | .adapter = &pnx_adapter2, | ||
132 | }; | ||
133 | |||
134 | static struct platform_device i2c0_device = { | ||
135 | .name = "pnx-i2c", | ||
136 | .id = 0, | ||
137 | .dev = { | ||
138 | .platform_data = &i2c0_data, | ||
139 | }, | ||
140 | }; | ||
141 | |||
142 | static struct platform_device i2c1_device = { | ||
143 | .name = "pnx-i2c", | ||
144 | .id = 1, | ||
145 | .dev = { | ||
146 | .platform_data = &i2c1_data, | ||
147 | }, | ||
148 | }; | ||
149 | |||
150 | static struct platform_device i2c2_device = { | ||
151 | .name = "pnx-i2c", | ||
152 | .id = 2, | ||
153 | .dev = { | ||
154 | .platform_data = &i2c2_data, | ||
155 | }, | ||
156 | }; | ||
157 | |||
158 | static struct platform_device *devices[] __initdata = { | ||
159 | &i2c0_device, | ||
160 | &i2c1_device, | ||
161 | &i2c2_device, | ||
162 | }; | ||
163 | |||
164 | void __init pnx4008_register_i2c_devices(void) | ||
165 | { | ||
166 | platform_add_devices(devices, ARRAY_SIZE(devices)); | ||
167 | } | ||
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c index 68c67053f479..84d3fe76e94e 100644 --- a/arch/arm/mach-realview/core.c +++ b/arch/arm/mach-realview/core.c | |||
@@ -141,6 +141,19 @@ struct platform_device realview_smc91x_device = { | |||
141 | .resource = realview_smc91x_resources, | 141 | .resource = realview_smc91x_resources, |
142 | }; | 142 | }; |
143 | 143 | ||
144 | static struct resource realview_i2c_resource = { | ||
145 | .start = REALVIEW_I2C_BASE, | ||
146 | .end = REALVIEW_I2C_BASE + SZ_4K - 1, | ||
147 | .flags = IORESOURCE_MEM, | ||
148 | }; | ||
149 | |||
150 | struct platform_device realview_i2c_device = { | ||
151 | .name = "versatile-i2c", | ||
152 | .id = -1, | ||
153 | .num_resources = 1, | ||
154 | .resource = &realview_i2c_resource, | ||
155 | }; | ||
156 | |||
144 | #define REALVIEW_SYSMCI (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_MCI_OFFSET) | 157 | #define REALVIEW_SYSMCI (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_MCI_OFFSET) |
145 | 158 | ||
146 | static unsigned int realview_mmc_status(struct device *dev) | 159 | static unsigned int realview_mmc_status(struct device *dev) |
diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h index 93e86d9f439c..2b53420f9c1b 100644 --- a/arch/arm/mach-realview/core.h +++ b/arch/arm/mach-realview/core.h | |||
@@ -108,6 +108,7 @@ static struct amba_device name##_device = { \ | |||
108 | 108 | ||
109 | extern struct platform_device realview_flash_device; | 109 | extern struct platform_device realview_flash_device; |
110 | extern struct platform_device realview_smc91x_device; | 110 | extern struct platform_device realview_smc91x_device; |
111 | extern struct platform_device realview_i2c_device; | ||
111 | extern struct mmc_platform_data realview_mmc0_plat_data; | 112 | extern struct mmc_platform_data realview_mmc0_plat_data; |
112 | extern struct mmc_platform_data realview_mmc1_plat_data; | 113 | extern struct mmc_platform_data realview_mmc1_plat_data; |
113 | extern struct clk realview_clcd_clk; | 114 | extern struct clk realview_clcd_clk; |
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c index 84a959530fb6..9741b4d3c9cf 100644 --- a/arch/arm/mach-realview/realview_eb.c +++ b/arch/arm/mach-realview/realview_eb.c | |||
@@ -155,6 +155,7 @@ static void __init realview_eb_init(void) | |||
155 | 155 | ||
156 | platform_device_register(&realview_flash_device); | 156 | platform_device_register(&realview_flash_device); |
157 | platform_device_register(&realview_smc91x_device); | 157 | platform_device_register(&realview_smc91x_device); |
158 | platform_device_register(&realview_i2c_device); | ||
158 | 159 | ||
159 | for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { | 160 | for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { |
160 | struct amba_device *d = amba_devs[i]; | 161 | struct amba_device *d = amba_devs[i]; |
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c index 57196947559f..bf71507c76fd 100644 --- a/arch/arm/mach-versatile/core.c +++ b/arch/arm/mach-versatile/core.c | |||
@@ -325,6 +325,19 @@ static struct platform_device smc91x_device = { | |||
325 | .resource = smc91x_resources, | 325 | .resource = smc91x_resources, |
326 | }; | 326 | }; |
327 | 327 | ||
328 | static struct resource versatile_i2c_resource = { | ||
329 | .start = VERSATILE_I2C_BASE, | ||
330 | .end = VERSATILE_I2C_BASE + SZ_4K - 1, | ||
331 | .flags = IORESOURCE_MEM, | ||
332 | }; | ||
333 | |||
334 | static struct platform_device versatile_i2c_device = { | ||
335 | .name = "versatile-i2c", | ||
336 | .id = -1, | ||
337 | .num_resources = 1, | ||
338 | .resource = &versatile_i2c_resource, | ||
339 | }; | ||
340 | |||
328 | #define VERSATILE_SYSMCI (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_MCI_OFFSET) | 341 | #define VERSATILE_SYSMCI (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_MCI_OFFSET) |
329 | 342 | ||
330 | unsigned int mmc_status(struct device *dev) | 343 | unsigned int mmc_status(struct device *dev) |
@@ -775,6 +788,7 @@ void __init versatile_init(void) | |||
775 | clk_register(&versatile_clcd_clk); | 788 | clk_register(&versatile_clcd_clk); |
776 | 789 | ||
777 | platform_device_register(&versatile_flash_device); | 790 | platform_device_register(&versatile_flash_device); |
791 | platform_device_register(&versatile_i2c_device); | ||
778 | platform_device_register(&smc91x_device); | 792 | platform_device_register(&smc91x_device); |
779 | 793 | ||
780 | for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { | 794 | for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { |
diff --git a/arch/i386/kernel/cpu/cpufreq/Kconfig b/arch/i386/kernel/cpu/cpufreq/Kconfig index ccc1edff5c97..5299c5bf4454 100644 --- a/arch/i386/kernel/cpu/cpufreq/Kconfig +++ b/arch/i386/kernel/cpu/cpufreq/Kconfig | |||
@@ -17,6 +17,7 @@ config X86_ACPI_CPUFREQ | |||
17 | help | 17 | help |
18 | This driver adds a CPUFreq driver which utilizes the ACPI | 18 | This driver adds a CPUFreq driver which utilizes the ACPI |
19 | Processor Performance States. | 19 | Processor Performance States. |
20 | This driver also supports Intel Enhanced Speedstep. | ||
20 | 21 | ||
21 | For details, take a look at <file:Documentation/cpu-freq/>. | 22 | For details, take a look at <file:Documentation/cpu-freq/>. |
22 | 23 | ||
@@ -121,11 +122,14 @@ config X86_SPEEDSTEP_CENTRINO | |||
121 | If in doubt, say N. | 122 | If in doubt, say N. |
122 | 123 | ||
123 | config X86_SPEEDSTEP_CENTRINO_ACPI | 124 | config X86_SPEEDSTEP_CENTRINO_ACPI |
124 | bool "Use ACPI tables to decode valid frequency/voltage pairs" | 125 | bool "Use ACPI tables to decode valid frequency/voltage (deprecated)" |
125 | depends on X86_SPEEDSTEP_CENTRINO && ACPI_PROCESSOR | 126 | depends on X86_SPEEDSTEP_CENTRINO && ACPI_PROCESSOR |
126 | depends on !(X86_SPEEDSTEP_CENTRINO = y && ACPI_PROCESSOR = m) | 127 | depends on !(X86_SPEEDSTEP_CENTRINO = y && ACPI_PROCESSOR = m) |
127 | default y | 128 | default y |
128 | help | 129 | help |
130 | This is deprecated and this functionality is now merged into | ||
131 | acpi_cpufreq (X86_ACPI_CPUFREQ). Use that driver instead of | ||
132 | speedstep_centrino. | ||
129 | Use primarily the information provided in the BIOS ACPI tables | 133 | Use primarily the information provided in the BIOS ACPI tables |
130 | to determine valid CPU frequency and voltage pairings. It is | 134 | to determine valid CPU frequency and voltage pairings. It is |
131 | required for the driver to work on non-Banias CPUs. | 135 | required for the driver to work on non-Banias CPUs. |
diff --git a/arch/i386/kernel/cpu/cpufreq/Makefile b/arch/i386/kernel/cpu/cpufreq/Makefile index 2e894f1c8910..8de3abe322a9 100644 --- a/arch/i386/kernel/cpu/cpufreq/Makefile +++ b/arch/i386/kernel/cpu/cpufreq/Makefile | |||
@@ -7,9 +7,9 @@ obj-$(CONFIG_SC520_CPUFREQ) += sc520_freq.o | |||
7 | obj-$(CONFIG_X86_LONGRUN) += longrun.o | 7 | obj-$(CONFIG_X86_LONGRUN) += longrun.o |
8 | obj-$(CONFIG_X86_GX_SUSPMOD) += gx-suspmod.o | 8 | obj-$(CONFIG_X86_GX_SUSPMOD) += gx-suspmod.o |
9 | obj-$(CONFIG_X86_SPEEDSTEP_ICH) += speedstep-ich.o | 9 | obj-$(CONFIG_X86_SPEEDSTEP_ICH) += speedstep-ich.o |
10 | obj-$(CONFIG_X86_SPEEDSTEP_CENTRINO) += speedstep-centrino.o | ||
11 | obj-$(CONFIG_X86_SPEEDSTEP_LIB) += speedstep-lib.o | 10 | obj-$(CONFIG_X86_SPEEDSTEP_LIB) += speedstep-lib.o |
12 | obj-$(CONFIG_X86_SPEEDSTEP_SMI) += speedstep-smi.o | 11 | obj-$(CONFIG_X86_SPEEDSTEP_SMI) += speedstep-smi.o |
13 | obj-$(CONFIG_X86_ACPI_CPUFREQ) += acpi-cpufreq.o | 12 | obj-$(CONFIG_X86_ACPI_CPUFREQ) += acpi-cpufreq.o |
13 | obj-$(CONFIG_X86_SPEEDSTEP_CENTRINO) += speedstep-centrino.o | ||
14 | obj-$(CONFIG_X86_P4_CLOCKMOD) += p4-clockmod.o | 14 | obj-$(CONFIG_X86_P4_CLOCKMOD) += p4-clockmod.o |
15 | obj-$(CONFIG_X86_CPUFREQ_NFORCE2) += cpufreq-nforce2.o | 15 | obj-$(CONFIG_X86_CPUFREQ_NFORCE2) += cpufreq-nforce2.o |
diff --git a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c index 57c880bf0bd6..18f4715c655d 100644 --- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c | |||
@@ -1,9 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | * acpi-cpufreq.c - ACPI Processor P-States Driver ($Revision: 1.3 $) | 2 | * acpi-cpufreq.c - ACPI Processor P-States Driver ($Revision: 1.4 $) |
3 | * | 3 | * |
4 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> | 4 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> |
5 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> | 5 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> |
6 | * Copyright (C) 2002 - 2004 Dominik Brodowski <linux@brodo.de> | 6 | * Copyright (C) 2002 - 2004 Dominik Brodowski <linux@brodo.de> |
7 | * Copyright (C) 2006 Denis Sadykov <denis.m.sadykov@intel.com> | ||
7 | * | 8 | * |
8 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 9 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
9 | * | 10 | * |
@@ -27,202 +28,387 @@ | |||
27 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
28 | #include <linux/module.h> | 29 | #include <linux/module.h> |
29 | #include <linux/init.h> | 30 | #include <linux/init.h> |
31 | #include <linux/smp.h> | ||
32 | #include <linux/sched.h> | ||
30 | #include <linux/cpufreq.h> | 33 | #include <linux/cpufreq.h> |
31 | #include <linux/proc_fs.h> | ||
32 | #include <linux/seq_file.h> | ||
33 | #include <linux/compiler.h> | 34 | #include <linux/compiler.h> |
34 | #include <linux/sched.h> /* current */ | ||
35 | #include <linux/dmi.h> | 35 | #include <linux/dmi.h> |
36 | #include <asm/io.h> | ||
37 | #include <asm/delay.h> | ||
38 | #include <asm/uaccess.h> | ||
39 | 36 | ||
40 | #include <linux/acpi.h> | 37 | #include <linux/acpi.h> |
41 | #include <acpi/processor.h> | 38 | #include <acpi/processor.h> |
42 | 39 | ||
40 | #include <asm/io.h> | ||
41 | #include <asm/msr.h> | ||
42 | #include <asm/processor.h> | ||
43 | #include <asm/cpufeature.h> | ||
44 | #include <asm/delay.h> | ||
45 | #include <asm/uaccess.h> | ||
46 | |||
43 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "acpi-cpufreq", msg) | 47 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "acpi-cpufreq", msg) |
44 | 48 | ||
45 | MODULE_AUTHOR("Paul Diefenbaugh, Dominik Brodowski"); | 49 | MODULE_AUTHOR("Paul Diefenbaugh, Dominik Brodowski"); |
46 | MODULE_DESCRIPTION("ACPI Processor P-States Driver"); | 50 | MODULE_DESCRIPTION("ACPI Processor P-States Driver"); |
47 | MODULE_LICENSE("GPL"); | 51 | MODULE_LICENSE("GPL"); |
48 | 52 | ||
53 | enum { | ||
54 | UNDEFINED_CAPABLE = 0, | ||
55 | SYSTEM_INTEL_MSR_CAPABLE, | ||
56 | SYSTEM_IO_CAPABLE, | ||
57 | }; | ||
58 | |||
59 | #define INTEL_MSR_RANGE (0xffff) | ||
60 | #define CPUID_6_ECX_APERFMPERF_CAPABILITY (0x1) | ||
49 | 61 | ||
50 | struct cpufreq_acpi_io { | 62 | struct acpi_cpufreq_data { |
51 | struct acpi_processor_performance *acpi_data; | 63 | struct acpi_processor_performance *acpi_data; |
52 | struct cpufreq_frequency_table *freq_table; | 64 | struct cpufreq_frequency_table *freq_table; |
53 | unsigned int resume; | 65 | unsigned int max_freq; |
66 | unsigned int resume; | ||
67 | unsigned int cpu_feature; | ||
54 | }; | 68 | }; |
55 | 69 | ||
56 | static struct cpufreq_acpi_io *acpi_io_data[NR_CPUS]; | 70 | static struct acpi_cpufreq_data *drv_data[NR_CPUS]; |
57 | static struct acpi_processor_performance *acpi_perf_data[NR_CPUS]; | 71 | static struct acpi_processor_performance *acpi_perf_data[NR_CPUS]; |
58 | 72 | ||
59 | static struct cpufreq_driver acpi_cpufreq_driver; | 73 | static struct cpufreq_driver acpi_cpufreq_driver; |
60 | 74 | ||
61 | static unsigned int acpi_pstate_strict; | 75 | static unsigned int acpi_pstate_strict; |
62 | 76 | ||
63 | static int | 77 | static int check_est_cpu(unsigned int cpuid) |
64 | acpi_processor_write_port( | 78 | { |
65 | u16 port, | 79 | struct cpuinfo_x86 *cpu = &cpu_data[cpuid]; |
66 | u8 bit_width, | 80 | |
67 | u32 value) | 81 | if (cpu->x86_vendor != X86_VENDOR_INTEL || |
82 | !cpu_has(cpu, X86_FEATURE_EST)) | ||
83 | return 0; | ||
84 | |||
85 | return 1; | ||
86 | } | ||
87 | |||
88 | static unsigned extract_io(u32 value, struct acpi_cpufreq_data *data) | ||
89 | { | ||
90 | struct acpi_processor_performance *perf; | ||
91 | int i; | ||
92 | |||
93 | perf = data->acpi_data; | ||
94 | |||
95 | for (i=0; i<perf->state_count; i++) { | ||
96 | if (value == perf->states[i].status) | ||
97 | return data->freq_table[i].frequency; | ||
98 | } | ||
99 | return 0; | ||
100 | } | ||
101 | |||
102 | static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data) | ||
68 | { | 103 | { |
69 | if (bit_width <= 8) { | 104 | int i; |
105 | struct acpi_processor_performance *perf; | ||
106 | |||
107 | msr &= INTEL_MSR_RANGE; | ||
108 | perf = data->acpi_data; | ||
109 | |||
110 | for (i=0; data->freq_table[i].frequency != CPUFREQ_TABLE_END; i++) { | ||
111 | if (msr == perf->states[data->freq_table[i].index].status) | ||
112 | return data->freq_table[i].frequency; | ||
113 | } | ||
114 | return data->freq_table[0].frequency; | ||
115 | } | ||
116 | |||
117 | static unsigned extract_freq(u32 val, struct acpi_cpufreq_data *data) | ||
118 | { | ||
119 | switch (data->cpu_feature) { | ||
120 | case SYSTEM_INTEL_MSR_CAPABLE: | ||
121 | return extract_msr(val, data); | ||
122 | case SYSTEM_IO_CAPABLE: | ||
123 | return extract_io(val, data); | ||
124 | default: | ||
125 | return 0; | ||
126 | } | ||
127 | } | ||
128 | |||
129 | static void wrport(u16 port, u8 bit_width, u32 value) | ||
130 | { | ||
131 | if (bit_width <= 8) | ||
70 | outb(value, port); | 132 | outb(value, port); |
71 | } else if (bit_width <= 16) { | 133 | else if (bit_width <= 16) |
72 | outw(value, port); | 134 | outw(value, port); |
73 | } else if (bit_width <= 32) { | 135 | else if (bit_width <= 32) |
74 | outl(value, port); | 136 | outl(value, port); |
75 | } else { | ||
76 | return -ENODEV; | ||
77 | } | ||
78 | return 0; | ||
79 | } | 137 | } |
80 | 138 | ||
81 | static int | 139 | static void rdport(u16 port, u8 bit_width, u32 * ret) |
82 | acpi_processor_read_port( | ||
83 | u16 port, | ||
84 | u8 bit_width, | ||
85 | u32 *ret) | ||
86 | { | 140 | { |
87 | *ret = 0; | 141 | *ret = 0; |
88 | if (bit_width <= 8) { | 142 | if (bit_width <= 8) |
89 | *ret = inb(port); | 143 | *ret = inb(port); |
90 | } else if (bit_width <= 16) { | 144 | else if (bit_width <= 16) |
91 | *ret = inw(port); | 145 | *ret = inw(port); |
92 | } else if (bit_width <= 32) { | 146 | else if (bit_width <= 32) |
93 | *ret = inl(port); | 147 | *ret = inl(port); |
94 | } else { | 148 | } |
95 | return -ENODEV; | 149 | |
150 | struct msr_addr { | ||
151 | u32 reg; | ||
152 | }; | ||
153 | |||
154 | struct io_addr { | ||
155 | u16 port; | ||
156 | u8 bit_width; | ||
157 | }; | ||
158 | |||
159 | typedef union { | ||
160 | struct msr_addr msr; | ||
161 | struct io_addr io; | ||
162 | } drv_addr_union; | ||
163 | |||
164 | struct drv_cmd { | ||
165 | unsigned int type; | ||
166 | cpumask_t mask; | ||
167 | drv_addr_union addr; | ||
168 | u32 val; | ||
169 | }; | ||
170 | |||
171 | static void do_drv_read(struct drv_cmd *cmd) | ||
172 | { | ||
173 | u32 h; | ||
174 | |||
175 | switch (cmd->type) { | ||
176 | case SYSTEM_INTEL_MSR_CAPABLE: | ||
177 | rdmsr(cmd->addr.msr.reg, cmd->val, h); | ||
178 | break; | ||
179 | case SYSTEM_IO_CAPABLE: | ||
180 | rdport(cmd->addr.io.port, cmd->addr.io.bit_width, &cmd->val); | ||
181 | break; | ||
182 | default: | ||
183 | break; | ||
96 | } | 184 | } |
97 | return 0; | ||
98 | } | 185 | } |
99 | 186 | ||
100 | static int | 187 | static void do_drv_write(struct drv_cmd *cmd) |
101 | acpi_processor_set_performance ( | ||
102 | struct cpufreq_acpi_io *data, | ||
103 | unsigned int cpu, | ||
104 | int state) | ||
105 | { | 188 | { |
106 | u16 port = 0; | 189 | u32 h = 0; |
107 | u8 bit_width = 0; | 190 | |
108 | int i = 0; | 191 | switch (cmd->type) { |
109 | int ret = 0; | 192 | case SYSTEM_INTEL_MSR_CAPABLE: |
110 | u32 value = 0; | 193 | wrmsr(cmd->addr.msr.reg, cmd->val, h); |
111 | int retval; | 194 | break; |
112 | struct acpi_processor_performance *perf; | 195 | case SYSTEM_IO_CAPABLE: |
113 | 196 | wrport(cmd->addr.io.port, cmd->addr.io.bit_width, cmd->val); | |
114 | dprintk("acpi_processor_set_performance\n"); | 197 | break; |
115 | 198 | default: | |
116 | retval = 0; | 199 | break; |
117 | perf = data->acpi_data; | ||
118 | if (state == perf->state) { | ||
119 | if (unlikely(data->resume)) { | ||
120 | dprintk("Called after resume, resetting to P%d\n", state); | ||
121 | data->resume = 0; | ||
122 | } else { | ||
123 | dprintk("Already at target state (P%d)\n", state); | ||
124 | return (retval); | ||
125 | } | ||
126 | } | 200 | } |
201 | } | ||
127 | 202 | ||
128 | dprintk("Transitioning from P%d to P%d\n", perf->state, state); | 203 | static void drv_read(struct drv_cmd *cmd) |
204 | { | ||
205 | cpumask_t saved_mask = current->cpus_allowed; | ||
206 | cmd->val = 0; | ||
129 | 207 | ||
130 | /* | 208 | set_cpus_allowed(current, cmd->mask); |
131 | * First we write the target state's 'control' value to the | 209 | do_drv_read(cmd); |
132 | * control_register. | 210 | set_cpus_allowed(current, saved_mask); |
133 | */ | 211 | } |
212 | |||
213 | static void drv_write(struct drv_cmd *cmd) | ||
214 | { | ||
215 | cpumask_t saved_mask = current->cpus_allowed; | ||
216 | unsigned int i; | ||
217 | |||
218 | for_each_cpu_mask(i, cmd->mask) { | ||
219 | set_cpus_allowed(current, cpumask_of_cpu(i)); | ||
220 | do_drv_write(cmd); | ||
221 | } | ||
222 | |||
223 | set_cpus_allowed(current, saved_mask); | ||
224 | return; | ||
225 | } | ||
226 | |||
227 | static u32 get_cur_val(cpumask_t mask) | ||
228 | { | ||
229 | struct acpi_processor_performance *perf; | ||
230 | struct drv_cmd cmd; | ||
231 | |||
232 | if (unlikely(cpus_empty(mask))) | ||
233 | return 0; | ||
234 | |||
235 | switch (drv_data[first_cpu(mask)]->cpu_feature) { | ||
236 | case SYSTEM_INTEL_MSR_CAPABLE: | ||
237 | cmd.type = SYSTEM_INTEL_MSR_CAPABLE; | ||
238 | cmd.addr.msr.reg = MSR_IA32_PERF_STATUS; | ||
239 | break; | ||
240 | case SYSTEM_IO_CAPABLE: | ||
241 | cmd.type = SYSTEM_IO_CAPABLE; | ||
242 | perf = drv_data[first_cpu(mask)]->acpi_data; | ||
243 | cmd.addr.io.port = perf->control_register.address; | ||
244 | cmd.addr.io.bit_width = perf->control_register.bit_width; | ||
245 | break; | ||
246 | default: | ||
247 | return 0; | ||
248 | } | ||
249 | |||
250 | cmd.mask = mask; | ||
134 | 251 | ||
135 | port = perf->control_register.address; | 252 | drv_read(&cmd); |
136 | bit_width = perf->control_register.bit_width; | ||
137 | value = (u32) perf->states[state].control; | ||
138 | 253 | ||
139 | dprintk("Writing 0x%08x to port 0x%04x\n", value, port); | 254 | dprintk("get_cur_val = %u\n", cmd.val); |
140 | 255 | ||
141 | ret = acpi_processor_write_port(port, bit_width, value); | 256 | return cmd.val; |
142 | if (ret) { | 257 | } |
143 | dprintk("Invalid port width 0x%04x\n", bit_width); | 258 | |
144 | return (ret); | 259 | /* |
260 | * Return the measured active (C0) frequency on this CPU since last call | ||
261 | * to this function. | ||
262 | * Input: cpu number | ||
263 | * Return: Average CPU frequency in terms of max frequency (zero on error) | ||
264 | * | ||
265 | * We use IA32_MPERF and IA32_APERF MSRs to get the measured performance | ||
266 | * over a period of time, while CPU is in C0 state. | ||
267 | * IA32_MPERF counts at the rate of max advertised frequency | ||
268 | * IA32_APERF counts at the rate of actual CPU frequency | ||
269 | * Only IA32_APERF/IA32_MPERF ratio is architecturally defined and | ||
270 | * no meaning should be associated with absolute values of these MSRs. | ||
271 | */ | ||
272 | static unsigned int get_measured_perf(unsigned int cpu) | ||
273 | { | ||
274 | union { | ||
275 | struct { | ||
276 | u32 lo; | ||
277 | u32 hi; | ||
278 | } split; | ||
279 | u64 whole; | ||
280 | } aperf_cur, mperf_cur; | ||
281 | |||
282 | cpumask_t saved_mask; | ||
283 | unsigned int perf_percent; | ||
284 | unsigned int retval; | ||
285 | |||
286 | saved_mask = current->cpus_allowed; | ||
287 | set_cpus_allowed(current, cpumask_of_cpu(cpu)); | ||
288 | if (get_cpu() != cpu) { | ||
289 | /* We were not able to run on requested processor */ | ||
290 | put_cpu(); | ||
291 | return 0; | ||
145 | } | 292 | } |
146 | 293 | ||
294 | rdmsr(MSR_IA32_APERF, aperf_cur.split.lo, aperf_cur.split.hi); | ||
295 | rdmsr(MSR_IA32_MPERF, mperf_cur.split.lo, mperf_cur.split.hi); | ||
296 | |||
297 | wrmsr(MSR_IA32_APERF, 0,0); | ||
298 | wrmsr(MSR_IA32_MPERF, 0,0); | ||
299 | |||
300 | #ifdef __i386__ | ||
147 | /* | 301 | /* |
148 | * Assume the write went through when acpi_pstate_strict is not used. | 302 | * We dont want to do 64 bit divide with 32 bit kernel |
149 | * As read status_register is an expensive operation and there | 303 | * Get an approximate value. Return failure in case we cannot get |
150 | * are no specific error cases where an IO port write will fail. | 304 | * an approximate value. |
151 | */ | 305 | */ |
152 | if (acpi_pstate_strict) { | 306 | if (unlikely(aperf_cur.split.hi || mperf_cur.split.hi)) { |
153 | /* Then we read the 'status_register' and compare the value | 307 | int shift_count; |
154 | * with the target state's 'status' to make sure the | 308 | u32 h; |
155 | * transition was successful. | 309 | |
156 | * Note that we'll poll for up to 1ms (100 cycles of 10us) | 310 | h = max_t(u32, aperf_cur.split.hi, mperf_cur.split.hi); |
157 | * before giving up. | 311 | shift_count = fls(h); |
158 | */ | 312 | |
159 | 313 | aperf_cur.whole >>= shift_count; | |
160 | port = perf->status_register.address; | 314 | mperf_cur.whole >>= shift_count; |
161 | bit_width = perf->status_register.bit_width; | 315 | } |
162 | 316 | ||
163 | dprintk("Looking for 0x%08x from port 0x%04x\n", | 317 | if (((unsigned long)(-1) / 100) < aperf_cur.split.lo) { |
164 | (u32) perf->states[state].status, port); | 318 | int shift_count = 7; |
165 | 319 | aperf_cur.split.lo >>= shift_count; | |
166 | for (i = 0; i < 100; i++) { | 320 | mperf_cur.split.lo >>= shift_count; |
167 | ret = acpi_processor_read_port(port, bit_width, &value); | 321 | } |
168 | if (ret) { | 322 | |
169 | dprintk("Invalid port width 0x%04x\n", bit_width); | 323 | if (aperf_cur.split.lo && mperf_cur.split.lo) |
170 | return (ret); | 324 | perf_percent = (aperf_cur.split.lo * 100) / mperf_cur.split.lo; |
171 | } | 325 | else |
172 | if (value == (u32) perf->states[state].status) | 326 | perf_percent = 0; |
173 | break; | 327 | |
174 | udelay(10); | 328 | #else |
175 | } | 329 | if (unlikely(((unsigned long)(-1) / 100) < aperf_cur.whole)) { |
176 | } else { | 330 | int shift_count = 7; |
177 | value = (u32) perf->states[state].status; | 331 | aperf_cur.whole >>= shift_count; |
332 | mperf_cur.whole >>= shift_count; | ||
178 | } | 333 | } |
179 | 334 | ||
180 | if (unlikely(value != (u32) perf->states[state].status)) { | 335 | if (aperf_cur.whole && mperf_cur.whole) |
181 | printk(KERN_WARNING "acpi-cpufreq: Transition failed\n"); | 336 | perf_percent = (aperf_cur.whole * 100) / mperf_cur.whole; |
182 | retval = -ENODEV; | 337 | else |
183 | return (retval); | 338 | perf_percent = 0; |
339 | |||
340 | #endif | ||
341 | |||
342 | retval = drv_data[cpu]->max_freq * perf_percent / 100; | ||
343 | |||
344 | put_cpu(); | ||
345 | set_cpus_allowed(current, saved_mask); | ||
346 | |||
347 | dprintk("cpu %d: performance percent %d\n", cpu, perf_percent); | ||
348 | return retval; | ||
349 | } | ||
350 | |||
351 | static unsigned int get_cur_freq_on_cpu(unsigned int cpu) | ||
352 | { | ||
353 | struct acpi_cpufreq_data *data = drv_data[cpu]; | ||
354 | unsigned int freq; | ||
355 | |||
356 | dprintk("get_cur_freq_on_cpu (%d)\n", cpu); | ||
357 | |||
358 | if (unlikely(data == NULL || | ||
359 | data->acpi_data == NULL || data->freq_table == NULL)) { | ||
360 | return 0; | ||
184 | } | 361 | } |
185 | 362 | ||
186 | dprintk("Transition successful after %d microseconds\n", i * 10); | 363 | freq = extract_freq(get_cur_val(cpumask_of_cpu(cpu)), data); |
364 | dprintk("cur freq = %u\n", freq); | ||
187 | 365 | ||
188 | perf->state = state; | 366 | return freq; |
189 | return (retval); | ||
190 | } | 367 | } |
191 | 368 | ||
369 | static unsigned int check_freqs(cpumask_t mask, unsigned int freq, | ||
370 | struct acpi_cpufreq_data *data) | ||
371 | { | ||
372 | unsigned int cur_freq; | ||
373 | unsigned int i; | ||
374 | |||
375 | for (i=0; i<100; i++) { | ||
376 | cur_freq = extract_freq(get_cur_val(mask), data); | ||
377 | if (cur_freq == freq) | ||
378 | return 1; | ||
379 | udelay(10); | ||
380 | } | ||
381 | return 0; | ||
382 | } | ||
192 | 383 | ||
193 | static int | 384 | static int acpi_cpufreq_target(struct cpufreq_policy *policy, |
194 | acpi_cpufreq_target ( | 385 | unsigned int target_freq, unsigned int relation) |
195 | struct cpufreq_policy *policy, | ||
196 | unsigned int target_freq, | ||
197 | unsigned int relation) | ||
198 | { | 386 | { |
199 | struct cpufreq_acpi_io *data = acpi_io_data[policy->cpu]; | 387 | struct acpi_cpufreq_data *data = drv_data[policy->cpu]; |
200 | struct acpi_processor_performance *perf; | 388 | struct acpi_processor_performance *perf; |
201 | struct cpufreq_freqs freqs; | 389 | struct cpufreq_freqs freqs; |
202 | cpumask_t online_policy_cpus; | 390 | cpumask_t online_policy_cpus; |
203 | cpumask_t saved_mask; | 391 | struct drv_cmd cmd; |
204 | cpumask_t set_mask; | 392 | unsigned int msr; |
205 | cpumask_t covered_cpus; | ||
206 | unsigned int cur_state = 0; | ||
207 | unsigned int next_state = 0; | 393 | unsigned int next_state = 0; |
208 | unsigned int result = 0; | 394 | unsigned int next_perf_state = 0; |
209 | unsigned int j; | 395 | unsigned int i; |
210 | unsigned int tmp; | 396 | int result = 0; |
211 | 397 | ||
212 | dprintk("acpi_cpufreq_setpolicy\n"); | 398 | dprintk("acpi_cpufreq_target %d (%d)\n", target_freq, policy->cpu); |
213 | 399 | ||
214 | result = cpufreq_frequency_table_target(policy, | 400 | if (unlikely(data == NULL || |
215 | data->freq_table, | 401 | data->acpi_data == NULL || data->freq_table == NULL)) { |
216 | target_freq, | 402 | return -ENODEV; |
217 | relation, | 403 | } |
218 | &next_state); | ||
219 | if (unlikely(result)) | ||
220 | return (result); | ||
221 | 404 | ||
222 | perf = data->acpi_data; | 405 | perf = data->acpi_data; |
223 | cur_state = perf->state; | 406 | result = cpufreq_frequency_table_target(policy, |
224 | freqs.old = data->freq_table[cur_state].frequency; | 407 | data->freq_table, |
225 | freqs.new = data->freq_table[next_state].frequency; | 408 | target_freq, |
409 | relation, &next_state); | ||
410 | if (unlikely(result)) | ||
411 | return -ENODEV; | ||
226 | 412 | ||
227 | #ifdef CONFIG_HOTPLUG_CPU | 413 | #ifdef CONFIG_HOTPLUG_CPU |
228 | /* cpufreq holds the hotplug lock, so we are safe from here on */ | 414 | /* cpufreq holds the hotplug lock, so we are safe from here on */ |
@@ -231,106 +417,84 @@ acpi_cpufreq_target ( | |||
231 | online_policy_cpus = policy->cpus; | 417 | online_policy_cpus = policy->cpus; |
232 | #endif | 418 | #endif |
233 | 419 | ||
234 | for_each_cpu_mask(j, online_policy_cpus) { | 420 | next_perf_state = data->freq_table[next_state].index; |
235 | freqs.cpu = j; | 421 | if (perf->state == next_perf_state) { |
236 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 422 | if (unlikely(data->resume)) { |
423 | dprintk("Called after resume, resetting to P%d\n", | ||
424 | next_perf_state); | ||
425 | data->resume = 0; | ||
426 | } else { | ||
427 | dprintk("Already at target state (P%d)\n", | ||
428 | next_perf_state); | ||
429 | return 0; | ||
430 | } | ||
237 | } | 431 | } |
238 | 432 | ||
239 | /* | 433 | switch (data->cpu_feature) { |
240 | * We need to call driver->target() on all or any CPU in | 434 | case SYSTEM_INTEL_MSR_CAPABLE: |
241 | * policy->cpus, depending on policy->shared_type. | 435 | cmd.type = SYSTEM_INTEL_MSR_CAPABLE; |
242 | */ | 436 | cmd.addr.msr.reg = MSR_IA32_PERF_CTL; |
243 | saved_mask = current->cpus_allowed; | 437 | msr = |
244 | cpus_clear(covered_cpus); | 438 | (u32) perf->states[next_perf_state]. |
245 | for_each_cpu_mask(j, online_policy_cpus) { | 439 | control & INTEL_MSR_RANGE; |
246 | /* | 440 | cmd.val = (cmd.val & ~INTEL_MSR_RANGE) | msr; |
247 | * Support for SMP systems. | 441 | break; |
248 | * Make sure we are running on CPU that wants to change freq | 442 | case SYSTEM_IO_CAPABLE: |
249 | */ | 443 | cmd.type = SYSTEM_IO_CAPABLE; |
250 | cpus_clear(set_mask); | 444 | cmd.addr.io.port = perf->control_register.address; |
251 | if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) | 445 | cmd.addr.io.bit_width = perf->control_register.bit_width; |
252 | cpus_or(set_mask, set_mask, online_policy_cpus); | 446 | cmd.val = (u32) perf->states[next_perf_state].control; |
253 | else | 447 | break; |
254 | cpu_set(j, set_mask); | 448 | default: |
255 | 449 | return -ENODEV; | |
256 | set_cpus_allowed(current, set_mask); | 450 | } |
257 | if (unlikely(!cpu_isset(smp_processor_id(), set_mask))) { | ||
258 | dprintk("couldn't limit to CPUs in this domain\n"); | ||
259 | result = -EAGAIN; | ||
260 | break; | ||
261 | } | ||
262 | 451 | ||
263 | result = acpi_processor_set_performance (data, j, next_state); | 452 | cpus_clear(cmd.mask); |
264 | if (result) { | ||
265 | result = -EAGAIN; | ||
266 | break; | ||
267 | } | ||
268 | 453 | ||
269 | if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) | 454 | if (policy->shared_type != CPUFREQ_SHARED_TYPE_ANY) |
270 | break; | 455 | cmd.mask = online_policy_cpus; |
271 | 456 | else | |
272 | cpu_set(j, covered_cpus); | 457 | cpu_set(policy->cpu, cmd.mask); |
273 | } | ||
274 | 458 | ||
275 | for_each_cpu_mask(j, online_policy_cpus) { | 459 | freqs.old = data->freq_table[perf->state].frequency; |
276 | freqs.cpu = j; | 460 | freqs.new = data->freq_table[next_perf_state].frequency; |
277 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 461 | for_each_cpu_mask(i, cmd.mask) { |
462 | freqs.cpu = i; | ||
463 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
278 | } | 464 | } |
279 | 465 | ||
280 | if (unlikely(result)) { | 466 | drv_write(&cmd); |
281 | /* | ||
282 | * We have failed halfway through the frequency change. | ||
283 | * We have sent callbacks to online_policy_cpus and | ||
284 | * acpi_processor_set_performance() has been called on | ||
285 | * coverd_cpus. Best effort undo.. | ||
286 | */ | ||
287 | |||
288 | if (!cpus_empty(covered_cpus)) { | ||
289 | for_each_cpu_mask(j, covered_cpus) { | ||
290 | policy->cpu = j; | ||
291 | acpi_processor_set_performance (data, | ||
292 | j, | ||
293 | cur_state); | ||
294 | } | ||
295 | } | ||
296 | 467 | ||
297 | tmp = freqs.new; | 468 | if (acpi_pstate_strict) { |
298 | freqs.new = freqs.old; | 469 | if (!check_freqs(cmd.mask, freqs.new, data)) { |
299 | freqs.old = tmp; | 470 | dprintk("acpi_cpufreq_target failed (%d)\n", |
300 | for_each_cpu_mask(j, online_policy_cpus) { | 471 | policy->cpu); |
301 | freqs.cpu = j; | 472 | return -EAGAIN; |
302 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
303 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
304 | } | 473 | } |
305 | } | 474 | } |
306 | 475 | ||
307 | set_cpus_allowed(current, saved_mask); | 476 | for_each_cpu_mask(i, cmd.mask) { |
308 | return (result); | 477 | freqs.cpu = i; |
309 | } | 478 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); |
479 | } | ||
480 | perf->state = next_perf_state; | ||
310 | 481 | ||
482 | return result; | ||
483 | } | ||
311 | 484 | ||
312 | static int | 485 | static int acpi_cpufreq_verify(struct cpufreq_policy *policy) |
313 | acpi_cpufreq_verify ( | ||
314 | struct cpufreq_policy *policy) | ||
315 | { | 486 | { |
316 | unsigned int result = 0; | 487 | struct acpi_cpufreq_data *data = drv_data[policy->cpu]; |
317 | struct cpufreq_acpi_io *data = acpi_io_data[policy->cpu]; | ||
318 | 488 | ||
319 | dprintk("acpi_cpufreq_verify\n"); | 489 | dprintk("acpi_cpufreq_verify\n"); |
320 | 490 | ||
321 | result = cpufreq_frequency_table_verify(policy, | 491 | return cpufreq_frequency_table_verify(policy, data->freq_table); |
322 | data->freq_table); | ||
323 | |||
324 | return (result); | ||
325 | } | 492 | } |
326 | 493 | ||
327 | |||
328 | static unsigned long | 494 | static unsigned long |
329 | acpi_cpufreq_guess_freq ( | 495 | acpi_cpufreq_guess_freq(struct acpi_cpufreq_data *data, unsigned int cpu) |
330 | struct cpufreq_acpi_io *data, | ||
331 | unsigned int cpu) | ||
332 | { | 496 | { |
333 | struct acpi_processor_performance *perf = data->acpi_data; | 497 | struct acpi_processor_performance *perf = data->acpi_data; |
334 | 498 | ||
335 | if (cpu_khz) { | 499 | if (cpu_khz) { |
336 | /* search the closest match to cpu_khz */ | 500 | /* search the closest match to cpu_khz */ |
@@ -338,16 +502,16 @@ acpi_cpufreq_guess_freq ( | |||
338 | unsigned long freq; | 502 | unsigned long freq; |
339 | unsigned long freqn = perf->states[0].core_frequency * 1000; | 503 | unsigned long freqn = perf->states[0].core_frequency * 1000; |
340 | 504 | ||
341 | for (i = 0; i < (perf->state_count - 1); i++) { | 505 | for (i=0; i<(perf->state_count-1); i++) { |
342 | freq = freqn; | 506 | freq = freqn; |
343 | freqn = perf->states[i+1].core_frequency * 1000; | 507 | freqn = perf->states[i+1].core_frequency * 1000; |
344 | if ((2 * cpu_khz) > (freqn + freq)) { | 508 | if ((2 * cpu_khz) > (freqn + freq)) { |
345 | perf->state = i; | 509 | perf->state = i; |
346 | return (freq); | 510 | return freq; |
347 | } | 511 | } |
348 | } | 512 | } |
349 | perf->state = perf->state_count - 1; | 513 | perf->state = perf->state_count-1; |
350 | return (freqn); | 514 | return freqn; |
351 | } else { | 515 | } else { |
352 | /* assume CPU is at P0... */ | 516 | /* assume CPU is at P0... */ |
353 | perf->state = 0; | 517 | perf->state = 0; |
@@ -355,7 +519,6 @@ acpi_cpufreq_guess_freq ( | |||
355 | } | 519 | } |
356 | } | 520 | } |
357 | 521 | ||
358 | |||
359 | /* | 522 | /* |
360 | * acpi_cpufreq_early_init - initialize ACPI P-States library | 523 | * acpi_cpufreq_early_init - initialize ACPI P-States library |
361 | * | 524 | * |
@@ -364,30 +527,34 @@ acpi_cpufreq_guess_freq ( | |||
364 | * do _PDC and _PSD and find out the processor dependency for the | 527 | * do _PDC and _PSD and find out the processor dependency for the |
365 | * actual init that will happen later... | 528 | * actual init that will happen later... |
366 | */ | 529 | */ |
367 | static int acpi_cpufreq_early_init_acpi(void) | 530 | static int acpi_cpufreq_early_init(void) |
368 | { | 531 | { |
369 | struct acpi_processor_performance *data; | 532 | struct acpi_processor_performance *data; |
370 | unsigned int i, j; | 533 | cpumask_t covered; |
534 | unsigned int i, j; | ||
371 | 535 | ||
372 | dprintk("acpi_cpufreq_early_init\n"); | 536 | dprintk("acpi_cpufreq_early_init\n"); |
373 | 537 | ||
374 | for_each_possible_cpu(i) { | 538 | for_each_possible_cpu(i) { |
375 | data = kzalloc(sizeof(struct acpi_processor_performance), | 539 | data = kzalloc(sizeof(struct acpi_processor_performance), |
376 | GFP_KERNEL); | 540 | GFP_KERNEL); |
377 | if (!data) { | 541 | if (!data) { |
378 | for_each_possible_cpu(j) { | 542 | for_each_cpu_mask(j, covered) { |
379 | kfree(acpi_perf_data[j]); | 543 | kfree(acpi_perf_data[j]); |
380 | acpi_perf_data[j] = NULL; | 544 | acpi_perf_data[j] = NULL; |
381 | } | 545 | } |
382 | return (-ENOMEM); | 546 | return -ENOMEM; |
383 | } | 547 | } |
384 | acpi_perf_data[i] = data; | 548 | acpi_perf_data[i] = data; |
549 | cpu_set(i, covered); | ||
385 | } | 550 | } |
386 | 551 | ||
387 | /* Do initialization in ACPI core */ | 552 | /* Do initialization in ACPI core */ |
388 | return acpi_processor_preregister_performance(acpi_perf_data); | 553 | acpi_processor_preregister_performance(acpi_perf_data); |
554 | return 0; | ||
389 | } | 555 | } |
390 | 556 | ||
557 | #ifdef CONFIG_SMP | ||
391 | /* | 558 | /* |
392 | * Some BIOSes do SW_ANY coordination internally, either set it up in hw | 559 | * Some BIOSes do SW_ANY coordination internally, either set it up in hw |
393 | * or do it in BIOS firmware and won't inform about it to OS. If not | 560 | * or do it in BIOS firmware and won't inform about it to OS. If not |
@@ -414,39 +581,42 @@ static struct dmi_system_id sw_any_bug_dmi_table[] = { | |||
414 | }, | 581 | }, |
415 | { } | 582 | { } |
416 | }; | 583 | }; |
584 | #endif | ||
417 | 585 | ||
418 | static int | 586 | static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) |
419 | acpi_cpufreq_cpu_init ( | ||
420 | struct cpufreq_policy *policy) | ||
421 | { | 587 | { |
422 | unsigned int i; | 588 | unsigned int i; |
423 | unsigned int cpu = policy->cpu; | 589 | unsigned int valid_states = 0; |
424 | struct cpufreq_acpi_io *data; | 590 | unsigned int cpu = policy->cpu; |
425 | unsigned int result = 0; | 591 | struct acpi_cpufreq_data *data; |
592 | unsigned int result = 0; | ||
426 | struct cpuinfo_x86 *c = &cpu_data[policy->cpu]; | 593 | struct cpuinfo_x86 *c = &cpu_data[policy->cpu]; |
427 | struct acpi_processor_performance *perf; | 594 | struct acpi_processor_performance *perf; |
428 | 595 | ||
429 | dprintk("acpi_cpufreq_cpu_init\n"); | 596 | dprintk("acpi_cpufreq_cpu_init\n"); |
430 | 597 | ||
431 | if (!acpi_perf_data[cpu]) | 598 | if (!acpi_perf_data[cpu]) |
432 | return (-ENODEV); | 599 | return -ENODEV; |
433 | 600 | ||
434 | data = kzalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL); | 601 | data = kzalloc(sizeof(struct acpi_cpufreq_data), GFP_KERNEL); |
435 | if (!data) | 602 | if (!data) |
436 | return (-ENOMEM); | 603 | return -ENOMEM; |
437 | 604 | ||
438 | data->acpi_data = acpi_perf_data[cpu]; | 605 | data->acpi_data = acpi_perf_data[cpu]; |
439 | acpi_io_data[cpu] = data; | 606 | drv_data[cpu] = data; |
440 | 607 | ||
441 | result = acpi_processor_register_performance(data->acpi_data, cpu); | 608 | if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) |
609 | acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS; | ||
442 | 610 | ||
611 | result = acpi_processor_register_performance(data->acpi_data, cpu); | ||
443 | if (result) | 612 | if (result) |
444 | goto err_free; | 613 | goto err_free; |
445 | 614 | ||
446 | perf = data->acpi_data; | 615 | perf = data->acpi_data; |
447 | policy->shared_type = perf->shared_type; | 616 | policy->shared_type = perf->shared_type; |
617 | |||
448 | /* | 618 | /* |
449 | * Will let policy->cpus know about dependency only when software | 619 | * Will let policy->cpus know about dependency only when software |
450 | * coordination is required. | 620 | * coordination is required. |
451 | */ | 621 | */ |
452 | if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL || | 622 | if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL || |
@@ -462,10 +632,6 @@ acpi_cpufreq_cpu_init ( | |||
462 | } | 632 | } |
463 | #endif | 633 | #endif |
464 | 634 | ||
465 | if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) { | ||
466 | acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS; | ||
467 | } | ||
468 | |||
469 | /* capability check */ | 635 | /* capability check */ |
470 | if (perf->state_count <= 1) { | 636 | if (perf->state_count <= 1) { |
471 | dprintk("No P-States\n"); | 637 | dprintk("No P-States\n"); |
@@ -473,17 +639,33 @@ acpi_cpufreq_cpu_init ( | |||
473 | goto err_unreg; | 639 | goto err_unreg; |
474 | } | 640 | } |
475 | 641 | ||
476 | if ((perf->control_register.space_id != ACPI_ADR_SPACE_SYSTEM_IO) || | 642 | if (perf->control_register.space_id != perf->status_register.space_id) { |
477 | (perf->status_register.space_id != ACPI_ADR_SPACE_SYSTEM_IO)) { | 643 | result = -ENODEV; |
478 | dprintk("Unsupported address space [%d, %d]\n", | 644 | goto err_unreg; |
479 | (u32) (perf->control_register.space_id), | 645 | } |
480 | (u32) (perf->status_register.space_id)); | 646 | |
647 | switch (perf->control_register.space_id) { | ||
648 | case ACPI_ADR_SPACE_SYSTEM_IO: | ||
649 | dprintk("SYSTEM IO addr space\n"); | ||
650 | data->cpu_feature = SYSTEM_IO_CAPABLE; | ||
651 | break; | ||
652 | case ACPI_ADR_SPACE_FIXED_HARDWARE: | ||
653 | dprintk("HARDWARE addr space\n"); | ||
654 | if (!check_est_cpu(cpu)) { | ||
655 | result = -ENODEV; | ||
656 | goto err_unreg; | ||
657 | } | ||
658 | data->cpu_feature = SYSTEM_INTEL_MSR_CAPABLE; | ||
659 | break; | ||
660 | default: | ||
661 | dprintk("Unknown addr space %d\n", | ||
662 | (u32) (perf->control_register.space_id)); | ||
481 | result = -ENODEV; | 663 | result = -ENODEV; |
482 | goto err_unreg; | 664 | goto err_unreg; |
483 | } | 665 | } |
484 | 666 | ||
485 | /* alloc freq_table */ | 667 | data->freq_table = kmalloc(sizeof(struct cpufreq_frequency_table) * |
486 | data->freq_table = kmalloc(sizeof(struct cpufreq_frequency_table) * (perf->state_count + 1), GFP_KERNEL); | 668 | (perf->state_count+1), GFP_KERNEL); |
487 | if (!data->freq_table) { | 669 | if (!data->freq_table) { |
488 | result = -ENOMEM; | 670 | result = -ENOMEM; |
489 | goto err_unreg; | 671 | goto err_unreg; |
@@ -492,129 +674,140 @@ acpi_cpufreq_cpu_init ( | |||
492 | /* detect transition latency */ | 674 | /* detect transition latency */ |
493 | policy->cpuinfo.transition_latency = 0; | 675 | policy->cpuinfo.transition_latency = 0; |
494 | for (i=0; i<perf->state_count; i++) { | 676 | for (i=0; i<perf->state_count; i++) { |
495 | if ((perf->states[i].transition_latency * 1000) > policy->cpuinfo.transition_latency) | 677 | if ((perf->states[i].transition_latency * 1000) > |
496 | policy->cpuinfo.transition_latency = perf->states[i].transition_latency * 1000; | 678 | policy->cpuinfo.transition_latency) |
679 | policy->cpuinfo.transition_latency = | ||
680 | perf->states[i].transition_latency * 1000; | ||
497 | } | 681 | } |
498 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | 682 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; |
499 | 683 | ||
500 | /* The current speed is unknown and not detectable by ACPI... */ | 684 | data->max_freq = perf->states[0].core_frequency * 1000; |
501 | policy->cur = acpi_cpufreq_guess_freq(data, policy->cpu); | ||
502 | |||
503 | /* table init */ | 685 | /* table init */ |
504 | for (i=0; i<=perf->state_count; i++) | 686 | for (i=0; i<perf->state_count; i++) { |
505 | { | 687 | if (i>0 && perf->states[i].core_frequency == |
506 | data->freq_table[i].index = i; | 688 | perf->states[i-1].core_frequency) |
507 | if (i<perf->state_count) | 689 | continue; |
508 | data->freq_table[i].frequency = perf->states[i].core_frequency * 1000; | 690 | |
509 | else | 691 | data->freq_table[valid_states].index = i; |
510 | data->freq_table[i].frequency = CPUFREQ_TABLE_END; | 692 | data->freq_table[valid_states].frequency = |
693 | perf->states[i].core_frequency * 1000; | ||
694 | valid_states++; | ||
511 | } | 695 | } |
696 | data->freq_table[valid_states].frequency = CPUFREQ_TABLE_END; | ||
512 | 697 | ||
513 | result = cpufreq_frequency_table_cpuinfo(policy, data->freq_table); | 698 | result = cpufreq_frequency_table_cpuinfo(policy, data->freq_table); |
514 | if (result) { | 699 | if (result) |
515 | goto err_freqfree; | 700 | goto err_freqfree; |
701 | |||
702 | switch (data->cpu_feature) { | ||
703 | case ACPI_ADR_SPACE_SYSTEM_IO: | ||
704 | /* Current speed is unknown and not detectable by IO port */ | ||
705 | policy->cur = acpi_cpufreq_guess_freq(data, policy->cpu); | ||
706 | break; | ||
707 | case ACPI_ADR_SPACE_FIXED_HARDWARE: | ||
708 | acpi_cpufreq_driver.get = get_cur_freq_on_cpu; | ||
709 | get_cur_freq_on_cpu(cpu); | ||
710 | break; | ||
711 | default: | ||
712 | break; | ||
516 | } | 713 | } |
517 | 714 | ||
518 | /* notify BIOS that we exist */ | 715 | /* notify BIOS that we exist */ |
519 | acpi_processor_notify_smm(THIS_MODULE); | 716 | acpi_processor_notify_smm(THIS_MODULE); |
520 | 717 | ||
521 | printk(KERN_INFO "acpi-cpufreq: CPU%u - ACPI performance management activated.\n", | 718 | /* Check for APERF/MPERF support in hardware */ |
522 | cpu); | 719 | if (c->x86_vendor == X86_VENDOR_INTEL && c->cpuid_level >= 6) { |
720 | unsigned int ecx; | ||
721 | ecx = cpuid_ecx(6); | ||
722 | if (ecx & CPUID_6_ECX_APERFMPERF_CAPABILITY) | ||
723 | acpi_cpufreq_driver.getavg = get_measured_perf; | ||
724 | } | ||
725 | |||
726 | dprintk("CPU%u - ACPI performance management activated.\n", cpu); | ||
523 | for (i = 0; i < perf->state_count; i++) | 727 | for (i = 0; i < perf->state_count; i++) |
524 | dprintk(" %cP%d: %d MHz, %d mW, %d uS\n", | 728 | dprintk(" %cP%d: %d MHz, %d mW, %d uS\n", |
525 | (i == perf->state?'*':' '), i, | 729 | (i == perf->state ? '*' : ' '), i, |
526 | (u32) perf->states[i].core_frequency, | 730 | (u32) perf->states[i].core_frequency, |
527 | (u32) perf->states[i].power, | 731 | (u32) perf->states[i].power, |
528 | (u32) perf->states[i].transition_latency); | 732 | (u32) perf->states[i].transition_latency); |
529 | 733 | ||
530 | cpufreq_frequency_table_get_attr(data->freq_table, policy->cpu); | 734 | cpufreq_frequency_table_get_attr(data->freq_table, policy->cpu); |
531 | 735 | ||
532 | /* | 736 | /* |
533 | * the first call to ->target() should result in us actually | 737 | * the first call to ->target() should result in us actually |
534 | * writing something to the appropriate registers. | 738 | * writing something to the appropriate registers. |
535 | */ | 739 | */ |
536 | data->resume = 1; | 740 | data->resume = 1; |
537 | |||
538 | return (result); | ||
539 | 741 | ||
540 | err_freqfree: | 742 | return result; |
743 | |||
744 | err_freqfree: | ||
541 | kfree(data->freq_table); | 745 | kfree(data->freq_table); |
542 | err_unreg: | 746 | err_unreg: |
543 | acpi_processor_unregister_performance(perf, cpu); | 747 | acpi_processor_unregister_performance(perf, cpu); |
544 | err_free: | 748 | err_free: |
545 | kfree(data); | 749 | kfree(data); |
546 | acpi_io_data[cpu] = NULL; | 750 | drv_data[cpu] = NULL; |
547 | 751 | ||
548 | return (result); | 752 | return result; |
549 | } | 753 | } |
550 | 754 | ||
551 | 755 | static int acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy) | |
552 | static int | ||
553 | acpi_cpufreq_cpu_exit ( | ||
554 | struct cpufreq_policy *policy) | ||
555 | { | 756 | { |
556 | struct cpufreq_acpi_io *data = acpi_io_data[policy->cpu]; | 757 | struct acpi_cpufreq_data *data = drv_data[policy->cpu]; |
557 | |||
558 | 758 | ||
559 | dprintk("acpi_cpufreq_cpu_exit\n"); | 759 | dprintk("acpi_cpufreq_cpu_exit\n"); |
560 | 760 | ||
561 | if (data) { | 761 | if (data) { |
562 | cpufreq_frequency_table_put_attr(policy->cpu); | 762 | cpufreq_frequency_table_put_attr(policy->cpu); |
563 | acpi_io_data[policy->cpu] = NULL; | 763 | drv_data[policy->cpu] = NULL; |
564 | acpi_processor_unregister_performance(data->acpi_data, policy->cpu); | 764 | acpi_processor_unregister_performance(data->acpi_data, |
765 | policy->cpu); | ||
565 | kfree(data); | 766 | kfree(data); |
566 | } | 767 | } |
567 | 768 | ||
568 | return (0); | 769 | return 0; |
569 | } | 770 | } |
570 | 771 | ||
571 | static int | 772 | static int acpi_cpufreq_resume(struct cpufreq_policy *policy) |
572 | acpi_cpufreq_resume ( | ||
573 | struct cpufreq_policy *policy) | ||
574 | { | 773 | { |
575 | struct cpufreq_acpi_io *data = acpi_io_data[policy->cpu]; | 774 | struct acpi_cpufreq_data *data = drv_data[policy->cpu]; |
576 | |||
577 | 775 | ||
578 | dprintk("acpi_cpufreq_resume\n"); | 776 | dprintk("acpi_cpufreq_resume\n"); |
579 | 777 | ||
580 | data->resume = 1; | 778 | data->resume = 1; |
581 | 779 | ||
582 | return (0); | 780 | return 0; |
583 | } | 781 | } |
584 | 782 | ||
585 | 783 | static struct freq_attr *acpi_cpufreq_attr[] = { | |
586 | static struct freq_attr* acpi_cpufreq_attr[] = { | ||
587 | &cpufreq_freq_attr_scaling_available_freqs, | 784 | &cpufreq_freq_attr_scaling_available_freqs, |
588 | NULL, | 785 | NULL, |
589 | }; | 786 | }; |
590 | 787 | ||
591 | static struct cpufreq_driver acpi_cpufreq_driver = { | 788 | static struct cpufreq_driver acpi_cpufreq_driver = { |
592 | .verify = acpi_cpufreq_verify, | 789 | .verify = acpi_cpufreq_verify, |
593 | .target = acpi_cpufreq_target, | 790 | .target = acpi_cpufreq_target, |
594 | .init = acpi_cpufreq_cpu_init, | 791 | .init = acpi_cpufreq_cpu_init, |
595 | .exit = acpi_cpufreq_cpu_exit, | 792 | .exit = acpi_cpufreq_cpu_exit, |
596 | .resume = acpi_cpufreq_resume, | 793 | .resume = acpi_cpufreq_resume, |
597 | .name = "acpi-cpufreq", | 794 | .name = "acpi-cpufreq", |
598 | .owner = THIS_MODULE, | 795 | .owner = THIS_MODULE, |
599 | .attr = acpi_cpufreq_attr, | 796 | .attr = acpi_cpufreq_attr, |
600 | }; | 797 | }; |
601 | 798 | ||
602 | 799 | static int __init acpi_cpufreq_init(void) | |
603 | static int __init | ||
604 | acpi_cpufreq_init (void) | ||
605 | { | 800 | { |
606 | dprintk("acpi_cpufreq_init\n"); | 801 | dprintk("acpi_cpufreq_init\n"); |
607 | 802 | ||
608 | acpi_cpufreq_early_init_acpi(); | 803 | acpi_cpufreq_early_init(); |
609 | 804 | ||
610 | return cpufreq_register_driver(&acpi_cpufreq_driver); | 805 | return cpufreq_register_driver(&acpi_cpufreq_driver); |
611 | } | 806 | } |
612 | 807 | ||
613 | 808 | static void __exit acpi_cpufreq_exit(void) | |
614 | static void __exit | ||
615 | acpi_cpufreq_exit (void) | ||
616 | { | 809 | { |
617 | unsigned int i; | 810 | unsigned int i; |
618 | dprintk("acpi_cpufreq_exit\n"); | 811 | dprintk("acpi_cpufreq_exit\n"); |
619 | 812 | ||
620 | cpufreq_unregister_driver(&acpi_cpufreq_driver); | 813 | cpufreq_unregister_driver(&acpi_cpufreq_driver); |
@@ -627,7 +820,9 @@ acpi_cpufreq_exit (void) | |||
627 | } | 820 | } |
628 | 821 | ||
629 | module_param(acpi_pstate_strict, uint, 0644); | 822 | module_param(acpi_pstate_strict, uint, 0644); |
630 | MODULE_PARM_DESC(acpi_pstate_strict, "value 0 or non-zero. non-zero -> strict ACPI checks are performed during frequency changes."); | 823 | MODULE_PARM_DESC(acpi_pstate_strict, |
824 | "value 0 or non-zero. non-zero -> strict ACPI checks are " | ||
825 | "performed during frequency changes."); | ||
631 | 826 | ||
632 | late_initcall(acpi_cpufreq_init); | 827 | late_initcall(acpi_cpufreq_init); |
633 | module_exit(acpi_cpufreq_exit); | 828 | module_exit(acpi_cpufreq_exit); |
diff --git a/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c b/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c index 92afa3bc84f1..6667e9cceb9f 100644 --- a/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c +++ b/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c | |||
@@ -447,7 +447,6 @@ static int __init cpufreq_gx_init(void) | |||
447 | int ret; | 447 | int ret; |
448 | struct gxfreq_params *params; | 448 | struct gxfreq_params *params; |
449 | struct pci_dev *gx_pci; | 449 | struct pci_dev *gx_pci; |
450 | u32 class_rev; | ||
451 | 450 | ||
452 | /* Test if we have the right hardware */ | 451 | /* Test if we have the right hardware */ |
453 | if ((gx_pci = gx_detect_chipset()) == NULL) | 452 | if ((gx_pci = gx_detect_chipset()) == NULL) |
@@ -472,8 +471,7 @@ static int __init cpufreq_gx_init(void) | |||
472 | pci_read_config_byte(params->cs55x0, PCI_PMER2, &(params->pci_pmer2)); | 471 | pci_read_config_byte(params->cs55x0, PCI_PMER2, &(params->pci_pmer2)); |
473 | pci_read_config_byte(params->cs55x0, PCI_MODON, &(params->on_duration)); | 472 | pci_read_config_byte(params->cs55x0, PCI_MODON, &(params->on_duration)); |
474 | pci_read_config_byte(params->cs55x0, PCI_MODOFF, &(params->off_duration)); | 473 | pci_read_config_byte(params->cs55x0, PCI_MODOFF, &(params->off_duration)); |
475 | pci_read_config_dword(params->cs55x0, PCI_CLASS_REVISION, &class_rev); | 474 | pci_read_config_byte(params->cs55x0, PCI_REVISION_ID, ¶ms->pci_rev); |
476 | params->pci_rev = class_rev && 0xff; | ||
477 | 475 | ||
478 | if ((ret = cpufreq_register_driver(&gx_suspmod_driver))) { | 476 | if ((ret = cpufreq_register_driver(&gx_suspmod_driver))) { |
479 | kfree(params); | 477 | kfree(params); |
diff --git a/arch/i386/kernel/cpu/cpufreq/longhaul.c b/arch/i386/kernel/cpu/cpufreq/longhaul.c index 7233abe5d695..c548daad3476 100644 --- a/arch/i386/kernel/cpu/cpufreq/longhaul.c +++ b/arch/i386/kernel/cpu/cpufreq/longhaul.c | |||
@@ -410,7 +410,7 @@ static int __init longhaul_get_ranges(void) | |||
410 | maxmult=longhaul_get_cpu_mult(); | 410 | maxmult=longhaul_get_cpu_mult(); |
411 | 411 | ||
412 | /* Starting with the 1.2GHz parts, theres a 200MHz bus. */ | 412 | /* Starting with the 1.2GHz parts, theres a 200MHz bus. */ |
413 | if ((cpu_khz/1000) > 1200) | 413 | if ((cpu_khz/maxmult) > 13400) |
414 | fsb = 200; | 414 | fsb = 200; |
415 | else | 415 | else |
416 | fsb = eblcr_fsb_table_v2[longhaul.bits.MaxMHzFSB]; | 416 | fsb = eblcr_fsb_table_v2[longhaul.bits.MaxMHzFSB]; |
@@ -583,6 +583,10 @@ static int enable_arbiter_disable(void) | |||
583 | if (dev == NULL) { | 583 | if (dev == NULL) { |
584 | reg = 0x76; | 584 | reg = 0x76; |
585 | dev = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_862X_0, NULL); | 585 | dev = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_862X_0, NULL); |
586 | /* Find CN400 V-Link host bridge */ | ||
587 | if (dev == NULL) | ||
588 | dev = pci_find_device(PCI_VENDOR_ID_VIA, 0x7259, NULL); | ||
589 | |||
586 | } | 590 | } |
587 | if (dev != NULL) { | 591 | if (dev != NULL) { |
588 | /* Enable access to port 0x22 */ | 592 | /* Enable access to port 0x22 */ |
@@ -734,7 +738,7 @@ print_support_type: | |||
734 | return 0; | 738 | return 0; |
735 | 739 | ||
736 | err_acpi: | 740 | err_acpi: |
737 | printk(KERN_ERR PFX "No ACPI support. No VT8601 or VT8623 northbridge. Aborting.\n"); | 741 | printk(KERN_ERR PFX "No ACPI support. Unsupported northbridge. Aborting.\n"); |
738 | return -ENODEV; | 742 | return -ENODEV; |
739 | } | 743 | } |
740 | 744 | ||
diff --git a/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c b/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c index 304d2eaa4a1b..bec50170b75a 100644 --- a/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c +++ b/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c | |||
@@ -163,29 +163,27 @@ static int cpufreq_p4_verify(struct cpufreq_policy *policy) | |||
163 | 163 | ||
164 | static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c) | 164 | static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c) |
165 | { | 165 | { |
166 | if ((c->x86 == 0x06) && (c->x86_model == 0x09)) { | 166 | if (c->x86 == 0x06) { |
167 | /* Pentium M (Banias) */ | 167 | if (cpu_has(c, X86_FEATURE_EST)) |
168 | printk(KERN_WARNING PFX "Warning: Pentium M detected. " | 168 | printk(KERN_WARNING PFX "Warning: EST-capable CPU detected. " |
169 | "The speedstep_centrino module offers voltage scaling" | 169 | "The acpi-cpufreq module offers voltage scaling" |
170 | " in addition of frequency scaling. You should use " | 170 | " in addition of frequency scaling. You should use " |
171 | "that instead of p4-clockmod, if possible.\n"); | 171 | "that instead of p4-clockmod, if possible.\n"); |
172 | return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_PM); | 172 | switch (c->x86_model) { |
173 | } | 173 | case 0x0E: /* Core */ |
174 | 174 | case 0x0F: /* Core Duo */ | |
175 | if ((c->x86 == 0x06) && (c->x86_model == 0x0D)) { | 175 | p4clockmod_driver.flags |= CPUFREQ_CONST_LOOPS; |
176 | /* Pentium M (Dothan) */ | 176 | return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_PCORE); |
177 | printk(KERN_WARNING PFX "Warning: Pentium M detected. " | 177 | case 0x0D: /* Pentium M (Dothan) */ |
178 | "The speedstep_centrino module offers voltage scaling" | 178 | p4clockmod_driver.flags |= CPUFREQ_CONST_LOOPS; |
179 | " in addition of frequency scaling. You should use " | 179 | /* fall through */ |
180 | "that instead of p4-clockmod, if possible.\n"); | 180 | case 0x09: /* Pentium M (Banias) */ |
181 | /* on P-4s, the TSC runs with constant frequency independent whether | 181 | return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_PM); |
182 | * throttling is active or not. */ | 182 | } |
183 | p4clockmod_driver.flags |= CPUFREQ_CONST_LOOPS; | ||
184 | return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_PM); | ||
185 | } | 183 | } |
186 | 184 | ||
187 | if (c->x86 != 0xF) { | 185 | if (c->x86 != 0xF) { |
188 | printk(KERN_WARNING PFX "Unknown p4-clockmod-capable CPU. Please send an e-mail to <linux@brodo.de>\n"); | 186 | printk(KERN_WARNING PFX "Unknown p4-clockmod-capable CPU. Please send an e-mail to <cpufreq@lists.linux.org.uk>\n"); |
189 | return 0; | 187 | return 0; |
190 | } | 188 | } |
191 | 189 | ||
diff --git a/arch/i386/kernel/cpu/cpufreq/sc520_freq.c b/arch/i386/kernel/cpu/cpufreq/sc520_freq.c index ef457d50f4ac..b8fb4b521c62 100644 --- a/arch/i386/kernel/cpu/cpufreq/sc520_freq.c +++ b/arch/i386/kernel/cpu/cpufreq/sc520_freq.c | |||
@@ -153,6 +153,7 @@ static struct cpufreq_driver sc520_freq_driver = { | |||
153 | static int __init sc520_freq_init(void) | 153 | static int __init sc520_freq_init(void) |
154 | { | 154 | { |
155 | struct cpuinfo_x86 *c = cpu_data; | 155 | struct cpuinfo_x86 *c = cpu_data; |
156 | int err; | ||
156 | 157 | ||
157 | /* Test if we have the right hardware */ | 158 | /* Test if we have the right hardware */ |
158 | if(c->x86_vendor != X86_VENDOR_AMD || | 159 | if(c->x86_vendor != X86_VENDOR_AMD || |
@@ -166,7 +167,11 @@ static int __init sc520_freq_init(void) | |||
166 | return -ENOMEM; | 167 | return -ENOMEM; |
167 | } | 168 | } |
168 | 169 | ||
169 | return cpufreq_register_driver(&sc520_freq_driver); | 170 | err = cpufreq_register_driver(&sc520_freq_driver); |
171 | if (err) | ||
172 | iounmap(cpuctl); | ||
173 | |||
174 | return err; | ||
170 | } | 175 | } |
171 | 176 | ||
172 | 177 | ||
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c index e8993baf3d14..5113e9231634 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c | |||
@@ -36,6 +36,7 @@ | |||
36 | 36 | ||
37 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "speedstep-centrino", msg) | 37 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "speedstep-centrino", msg) |
38 | 38 | ||
39 | #define INTEL_MSR_RANGE (0xffff) | ||
39 | 40 | ||
40 | struct cpu_id | 41 | struct cpu_id |
41 | { | 42 | { |
@@ -379,6 +380,7 @@ static int centrino_cpu_early_init_acpi(void) | |||
379 | } | 380 | } |
380 | 381 | ||
381 | 382 | ||
383 | #ifdef CONFIG_SMP | ||
382 | /* | 384 | /* |
383 | * Some BIOSes do SW_ANY coordination internally, either set it up in hw | 385 | * Some BIOSes do SW_ANY coordination internally, either set it up in hw |
384 | * or do it in BIOS firmware and won't inform about it to OS. If not | 386 | * or do it in BIOS firmware and won't inform about it to OS. If not |
@@ -392,7 +394,6 @@ static int sw_any_bug_found(struct dmi_system_id *d) | |||
392 | return 0; | 394 | return 0; |
393 | } | 395 | } |
394 | 396 | ||
395 | |||
396 | static struct dmi_system_id sw_any_bug_dmi_table[] = { | 397 | static struct dmi_system_id sw_any_bug_dmi_table[] = { |
397 | { | 398 | { |
398 | .callback = sw_any_bug_found, | 399 | .callback = sw_any_bug_found, |
@@ -405,7 +406,7 @@ static struct dmi_system_id sw_any_bug_dmi_table[] = { | |||
405 | }, | 406 | }, |
406 | { } | 407 | { } |
407 | }; | 408 | }; |
408 | 409 | #endif | |
409 | 410 | ||
410 | /* | 411 | /* |
411 | * centrino_cpu_init_acpi - register with ACPI P-States library | 412 | * centrino_cpu_init_acpi - register with ACPI P-States library |
@@ -463,8 +464,9 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy) | |||
463 | } | 464 | } |
464 | 465 | ||
465 | for (i=0; i<p->state_count; i++) { | 466 | for (i=0; i<p->state_count; i++) { |
466 | if (p->states[i].control != p->states[i].status) { | 467 | if ((p->states[i].control & INTEL_MSR_RANGE) != |
467 | dprintk("Different control (%llu) and status values (%llu)\n", | 468 | (p->states[i].status & INTEL_MSR_RANGE)) { |
469 | dprintk("Different MSR bits in control (%llu) and status (%llu)\n", | ||
468 | p->states[i].control, p->states[i].status); | 470 | p->states[i].control, p->states[i].status); |
469 | result = -EINVAL; | 471 | result = -EINVAL; |
470 | goto err_unreg; | 472 | goto err_unreg; |
@@ -500,7 +502,7 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy) | |||
500 | } | 502 | } |
501 | 503 | ||
502 | for (i=0; i<p->state_count; i++) { | 504 | for (i=0; i<p->state_count; i++) { |
503 | centrino_model[cpu]->op_points[i].index = p->states[i].control; | 505 | centrino_model[cpu]->op_points[i].index = p->states[i].control & INTEL_MSR_RANGE; |
504 | centrino_model[cpu]->op_points[i].frequency = p->states[i].core_frequency * 1000; | 506 | centrino_model[cpu]->op_points[i].frequency = p->states[i].core_frequency * 1000; |
505 | dprintk("adding state %i with frequency %u and control value %04x\n", | 507 | dprintk("adding state %i with frequency %u and control value %04x\n", |
506 | i, centrino_model[cpu]->op_points[i].frequency, centrino_model[cpu]->op_points[i].index); | 508 | i, centrino_model[cpu]->op_points[i].frequency, centrino_model[cpu]->op_points[i].index); |
@@ -531,6 +533,9 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy) | |||
531 | 533 | ||
532 | /* notify BIOS that we exist */ | 534 | /* notify BIOS that we exist */ |
533 | acpi_processor_notify_smm(THIS_MODULE); | 535 | acpi_processor_notify_smm(THIS_MODULE); |
536 | printk("speedstep-centrino with X86_SPEEDSTEP_CENTRINO_ACPI" | ||
537 | "config is deprecated.\n " | ||
538 | "Use X86_ACPI_CPUFREQ (acpi-cpufreq instead.\n" ); | ||
534 | 539 | ||
535 | return 0; | 540 | return 0; |
536 | 541 | ||
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c index 4f46cac155c4..d59277c00911 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c | |||
@@ -123,6 +123,36 @@ static unsigned int pentiumM_get_frequency(void) | |||
123 | return (msr_tmp * 100 * 1000); | 123 | return (msr_tmp * 100 * 1000); |
124 | } | 124 | } |
125 | 125 | ||
126 | static unsigned int pentium_core_get_frequency(void) | ||
127 | { | ||
128 | u32 fsb = 0; | ||
129 | u32 msr_lo, msr_tmp; | ||
130 | |||
131 | rdmsr(MSR_FSB_FREQ, msr_lo, msr_tmp); | ||
132 | /* see table B-2 of 25366920.pdf */ | ||
133 | switch (msr_lo & 0x07) { | ||
134 | case 5: | ||
135 | fsb = 100000; | ||
136 | break; | ||
137 | case 1: | ||
138 | fsb = 133333; | ||
139 | break; | ||
140 | case 3: | ||
141 | fsb = 166667; | ||
142 | break; | ||
143 | default: | ||
144 | printk(KERN_ERR "PCORE - MSR_FSB_FREQ undefined value"); | ||
145 | } | ||
146 | |||
147 | rdmsr(MSR_IA32_EBL_CR_POWERON, msr_lo, msr_tmp); | ||
148 | dprintk("PCORE - MSR_IA32_EBL_CR_POWERON: 0x%x 0x%x\n", msr_lo, msr_tmp); | ||
149 | |||
150 | msr_tmp = (msr_lo >> 22) & 0x1f; | ||
151 | dprintk("bits 22-26 are 0x%x, speed is %u\n", msr_tmp, (msr_tmp * fsb)); | ||
152 | |||
153 | return (msr_tmp * fsb); | ||
154 | } | ||
155 | |||
126 | 156 | ||
127 | static unsigned int pentium4_get_frequency(void) | 157 | static unsigned int pentium4_get_frequency(void) |
128 | { | 158 | { |
@@ -174,6 +204,8 @@ static unsigned int pentium4_get_frequency(void) | |||
174 | unsigned int speedstep_get_processor_frequency(unsigned int processor) | 204 | unsigned int speedstep_get_processor_frequency(unsigned int processor) |
175 | { | 205 | { |
176 | switch (processor) { | 206 | switch (processor) { |
207 | case SPEEDSTEP_PROCESSOR_PCORE: | ||
208 | return pentium_core_get_frequency(); | ||
177 | case SPEEDSTEP_PROCESSOR_PM: | 209 | case SPEEDSTEP_PROCESSOR_PM: |
178 | return pentiumM_get_frequency(); | 210 | return pentiumM_get_frequency(); |
179 | case SPEEDSTEP_PROCESSOR_P4D: | 211 | case SPEEDSTEP_PROCESSOR_P4D: |
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h index b735429c50b4..b11bcc608cac 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h | |||
@@ -22,6 +22,7 @@ | |||
22 | * the speedstep_get_processor_frequency() call. */ | 22 | * the speedstep_get_processor_frequency() call. */ |
23 | #define SPEEDSTEP_PROCESSOR_PM 0xFFFFFF03 /* Pentium M */ | 23 | #define SPEEDSTEP_PROCESSOR_PM 0xFFFFFF03 /* Pentium M */ |
24 | #define SPEEDSTEP_PROCESSOR_P4D 0xFFFFFF04 /* desktop P4 */ | 24 | #define SPEEDSTEP_PROCESSOR_P4D 0xFFFFFF04 /* desktop P4 */ |
25 | #define SPEEDSTEP_PROCESSOR_PCORE 0xFFFFFF05 /* Core */ | ||
25 | 26 | ||
26 | /* speedstep states -- only two of them */ | 27 | /* speedstep states -- only two of them */ |
27 | 28 | ||
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c index c28333d53646..ff0d89806114 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c | |||
@@ -360,9 +360,6 @@ static int __init speedstep_init(void) | |||
360 | case SPEEDSTEP_PROCESSOR_PIII_C: | 360 | case SPEEDSTEP_PROCESSOR_PIII_C: |
361 | case SPEEDSTEP_PROCESSOR_PIII_C_EARLY: | 361 | case SPEEDSTEP_PROCESSOR_PIII_C_EARLY: |
362 | break; | 362 | break; |
363 | case SPEEDSTEP_PROCESSOR_P4M: | ||
364 | printk(KERN_INFO "speedstep-smi: you're trying to use this cpufreq driver on a Pentium 4-based CPU. Most likely it will not work.\n"); | ||
365 | break; | ||
366 | default: | 363 | default: |
367 | speedstep_processor = 0; | 364 | speedstep_processor = 0; |
368 | } | 365 | } |
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 8e24c40662e3..3aa3b885ab36 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig | |||
@@ -479,7 +479,7 @@ config SH_CLK_MD | |||
479 | int "CPU Mode Pin Setting" | 479 | int "CPU Mode Pin Setting" |
480 | depends on CPU_SUBTYPE_SH7619 || CPU_SUBTYPE_SH7206 | 480 | depends on CPU_SUBTYPE_SH7619 || CPU_SUBTYPE_SH7206 |
481 | help | 481 | help |
482 | MD2 - MD0 Setting. | 482 | MD2 - MD0 pin setting. |
483 | 483 | ||
484 | menu "CPU Frequency scaling" | 484 | menu "CPU Frequency scaling" |
485 | 485 | ||
@@ -580,18 +580,6 @@ config NR_CPUS | |||
580 | 580 | ||
581 | source "kernel/Kconfig.preempt" | 581 | source "kernel/Kconfig.preempt" |
582 | 582 | ||
583 | config CPU_HAS_SR_RB | ||
584 | bool "CPU has SR.RB" | ||
585 | depends on CPU_SH3 || CPU_SH4 | ||
586 | default y | ||
587 | help | ||
588 | This will enable the use of SR.RB register bank usage. Processors | ||
589 | that are lacking this bit must have another method in place for | ||
590 | accomplishing what is taken care of by the banked registers. | ||
591 | |||
592 | See <file:Documentation/sh/register-banks.txt> for further | ||
593 | information on SR.RB and register banking in the kernel in general. | ||
594 | |||
595 | config NODES_SHIFT | 583 | config NODES_SHIFT |
596 | int | 584 | int |
597 | default "1" | 585 | default "1" |
diff --git a/arch/sh/Kconfig.debug b/arch/sh/Kconfig.debug index 66a25ef4ef1b..87902e0298e2 100644 --- a/arch/sh/Kconfig.debug +++ b/arch/sh/Kconfig.debug | |||
@@ -31,7 +31,8 @@ config EARLY_SCIF_CONSOLE_PORT | |||
31 | hex "SCIF port for early console" | 31 | hex "SCIF port for early console" |
32 | depends on EARLY_SCIF_CONSOLE | 32 | depends on EARLY_SCIF_CONSOLE |
33 | default "0xffe00000" if CPU_SUBTYPE_SH7780 | 33 | default "0xffe00000" if CPU_SUBTYPE_SH7780 |
34 | default "0xfffe9800" if CPU_SUBTYPE_SH72060 | 34 | default "0xfffe9800" if CPU_SUBTYPE_SH7206 |
35 | default "0xf8420000" if CPU_SUBTYPE_SH7619 | ||
35 | default "0xffe80000" if CPU_SH4 | 36 | default "0xffe80000" if CPU_SH4 |
36 | 37 | ||
37 | config EARLY_PRINTK | 38 | config EARLY_PRINTK |
diff --git a/arch/sh/Makefile b/arch/sh/Makefile index d10bba5e1074..c1dbef212634 100644 --- a/arch/sh/Makefile +++ b/arch/sh/Makefile | |||
@@ -179,7 +179,7 @@ maketools: include/linux/version.h FORCE | |||
179 | 179 | ||
180 | all: zImage | 180 | all: zImage |
181 | 181 | ||
182 | zImage: vmlinux | 182 | zImage uImage uImage.srec vmlinux.srec: vmlinux |
183 | $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ | 183 | $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ |
184 | 184 | ||
185 | compressed: zImage | 185 | compressed: zImage |
@@ -190,5 +190,8 @@ archclean: | |||
190 | CLEAN_FILES += include/asm-sh/machtypes.h | 190 | CLEAN_FILES += include/asm-sh/machtypes.h |
191 | 191 | ||
192 | define archhelp | 192 | define archhelp |
193 | @echo ' zImage - Compressed kernel image (arch/sh/boot/zImage)' | 193 | @echo '* zImage - Compressed kernel image' |
194 | @echo ' vmlinux.srec - Create an ELF S-record' | ||
195 | @echo ' uImage - Create a bootable image for U-Boot' | ||
196 | @echo ' uImage.srec - Create an S-record for U-Boot' | ||
194 | endef | 197 | endef |
diff --git a/arch/sh/boards/landisk/irq.c b/arch/sh/boards/landisk/irq.c index 8f2e1c68b90f..3eba6d086d7f 100644 --- a/arch/sh/boards/landisk/irq.c +++ b/arch/sh/boards/landisk/irq.c | |||
@@ -16,8 +16,8 @@ | |||
16 | */ | 16 | */ |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/irq.h> | 18 | #include <linux/irq.h> |
19 | #include <asm/io.h> | 19 | #include <linux/interrupt.h> |
20 | #include <asm/irq.h> | 20 | #include <linux/io.h> |
21 | #include <asm/landisk/iodata_landisk.h> | 21 | #include <asm/landisk/iodata_landisk.h> |
22 | 22 | ||
23 | static void enable_landisk_irq(unsigned int irq); | 23 | static void enable_landisk_irq(unsigned int irq); |
diff --git a/arch/sh/boards/se/7206/irq.c b/arch/sh/boards/se/7206/irq.c index 3fb0c5f5b23a..27da88486f73 100644 --- a/arch/sh/boards/se/7206/irq.c +++ b/arch/sh/boards/se/7206/irq.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/irq.h> | 10 | #include <linux/irq.h> |
11 | #include <linux/io.h> | 11 | #include <linux/io.h> |
12 | #include <linux/irq.h> | 12 | #include <linux/irq.h> |
13 | #include <linux/interrupt.h> | ||
13 | #include <asm/se7206.h> | 14 | #include <asm/se7206.h> |
14 | 15 | ||
15 | #define INTSTS0 0x31800000 | 16 | #define INTSTS0 0x31800000 |
@@ -18,6 +19,13 @@ | |||
18 | #define INTMSK1 0x31800006 | 19 | #define INTMSK1 0x31800006 |
19 | #define INTSEL 0x31800008 | 20 | #define INTSEL 0x31800008 |
20 | 21 | ||
22 | #define IRQ0_IRQ 64 | ||
23 | #define IRQ1_IRQ 65 | ||
24 | #define IRQ3_IRQ 67 | ||
25 | |||
26 | #define INTC_IPR01 0xfffe0818 | ||
27 | #define INTC_ICR1 0xfffe0802 | ||
28 | |||
21 | static void disable_se7206_irq(unsigned int irq) | 29 | static void disable_se7206_irq(unsigned int irq) |
22 | { | 30 | { |
23 | unsigned short val; | 31 | unsigned short val; |
@@ -39,7 +47,7 @@ static void disable_se7206_irq(unsigned int irq) | |||
39 | case IRQ1_IRQ: | 47 | case IRQ1_IRQ: |
40 | msk0 |= 0x000f; | 48 | msk0 |= 0x000f; |
41 | break; | 49 | break; |
42 | case IRQ2_IRQ: | 50 | case IRQ3_IRQ: |
43 | msk0 |= 0x0f00; | 51 | msk0 |= 0x0f00; |
44 | msk1 |= 0x00ff; | 52 | msk1 |= 0x00ff; |
45 | break; | 53 | break; |
@@ -70,7 +78,7 @@ static void enable_se7206_irq(unsigned int irq) | |||
70 | case IRQ1_IRQ: | 78 | case IRQ1_IRQ: |
71 | msk0 &= ~0x000f; | 79 | msk0 &= ~0x000f; |
72 | break; | 80 | break; |
73 | case IRQ2_IRQ: | 81 | case IRQ3_IRQ: |
74 | msk0 &= ~0x0f00; | 82 | msk0 &= ~0x0f00; |
75 | msk1 &= ~0x00ff; | 83 | msk1 &= ~0x00ff; |
76 | break; | 84 | break; |
@@ -96,7 +104,7 @@ static void eoi_se7206_irq(unsigned int irq) | |||
96 | case IRQ1_IRQ: | 104 | case IRQ1_IRQ: |
97 | sts0 &= ~0x000f; | 105 | sts0 &= ~0x000f; |
98 | break; | 106 | break; |
99 | case IRQ2_IRQ: | 107 | case IRQ3_IRQ: |
100 | sts0 &= ~0x0f00; | 108 | sts0 &= ~0x0f00; |
101 | sts1 &= ~0x00ff; | 109 | sts1 &= ~0x00ff; |
102 | break; | 110 | break; |
@@ -106,7 +114,7 @@ static void eoi_se7206_irq(unsigned int irq) | |||
106 | } | 114 | } |
107 | 115 | ||
108 | static struct irq_chip se7206_irq_chip __read_mostly = { | 116 | static struct irq_chip se7206_irq_chip __read_mostly = { |
109 | .name = "SE7206-FPGA-IRQ", | 117 | .name = "SE7206-FPGA", |
110 | .mask = disable_se7206_irq, | 118 | .mask = disable_se7206_irq, |
111 | .unmask = enable_se7206_irq, | 119 | .unmask = enable_se7206_irq, |
112 | .mask_ack = disable_se7206_irq, | 120 | .mask_ack = disable_se7206_irq, |
diff --git a/arch/sh/boards/se/7619/Makefile b/arch/sh/boards/se/7619/Makefile index 3666eca8a658..d21775c28cda 100644 --- a/arch/sh/boards/se/7619/Makefile +++ b/arch/sh/boards/se/7619/Makefile | |||
@@ -2,4 +2,4 @@ | |||
2 | # Makefile for the 7619 SolutionEngine specific parts of the kernel | 2 | # Makefile for the 7619 SolutionEngine specific parts of the kernel |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := setup.o io.o | 5 | obj-y := setup.o |
diff --git a/arch/sh/boards/se/7619/io.c b/arch/sh/boards/se/7619/io.c deleted file mode 100644 index 176f1f39cd9d..000000000000 --- a/arch/sh/boards/se/7619/io.c +++ /dev/null | |||
@@ -1,102 +0,0 @@ | |||
1 | /* | ||
2 | * | ||
3 | * linux/arch/sh/boards/se/7619/io.c | ||
4 | * | ||
5 | * Copyright (C) 2006 Yoshinori Sato | ||
6 | * | ||
7 | * I/O routine for Hitachi 7619 SolutionEngine. | ||
8 | * | ||
9 | */ | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/types.h> | ||
13 | #include <asm/io.h> | ||
14 | #include <asm/se7619.h> | ||
15 | #include <asm/irq.h> | ||
16 | |||
17 | /* FIXME: M3A-ZAB7 Compact Flash Slot support */ | ||
18 | |||
19 | static inline void delay(void) | ||
20 | { | ||
21 | ctrl_inw(0xa0000000); /* Uncached ROM area (P2) */ | ||
22 | } | ||
23 | |||
24 | #define badio(name,port) \ | ||
25 | printk("bad I/O operation (%s) for port 0x%lx at 0x%08x\n", \ | ||
26 | #name, (port), (__u32) __builtin_return_address(0)) | ||
27 | |||
28 | unsigned char se7619___inb(unsigned long port) | ||
29 | { | ||
30 | badio(inb, port); | ||
31 | return 0; | ||
32 | } | ||
33 | |||
34 | unsigned char se7619___inb_p(unsigned long port) | ||
35 | { | ||
36 | badio(inb_p, port); | ||
37 | delay(); | ||
38 | return 0; | ||
39 | } | ||
40 | |||
41 | unsigned short se7619___inw(unsigned long port) | ||
42 | { | ||
43 | badio(inw, port); | ||
44 | return 0; | ||
45 | } | ||
46 | |||
47 | unsigned int se7619___inl(unsigned long port) | ||
48 | { | ||
49 | badio(inl, port); | ||
50 | return 0; | ||
51 | } | ||
52 | |||
53 | void se7619___outb(unsigned char value, unsigned long port) | ||
54 | { | ||
55 | badio(outb, port); | ||
56 | } | ||
57 | |||
58 | void se7619___outb_p(unsigned char value, unsigned long port) | ||
59 | { | ||
60 | badio(outb_p, port); | ||
61 | delay(); | ||
62 | } | ||
63 | |||
64 | void se7619___outw(unsigned short value, unsigned long port) | ||
65 | { | ||
66 | badio(outw, port); | ||
67 | } | ||
68 | |||
69 | void se7619___outl(unsigned int value, unsigned long port) | ||
70 | { | ||
71 | badio(outl, port); | ||
72 | } | ||
73 | |||
74 | void se7619___insb(unsigned long port, void *addr, unsigned long count) | ||
75 | { | ||
76 | badio(inw, port); | ||
77 | } | ||
78 | |||
79 | void se7619___insw(unsigned long port, void *addr, unsigned long count) | ||
80 | { | ||
81 | badio(inw, port); | ||
82 | } | ||
83 | |||
84 | void se7619___insl(unsigned long port, void *addr, unsigned long count) | ||
85 | { | ||
86 | badio(insl, port); | ||
87 | } | ||
88 | |||
89 | void se7619___outsb(unsigned long port, const void *addr, unsigned long count) | ||
90 | { | ||
91 | badio(insl, port); | ||
92 | } | ||
93 | |||
94 | void se7619___outsw(unsigned long port, const void *addr, unsigned long count) | ||
95 | { | ||
96 | badio(insl, port); | ||
97 | } | ||
98 | |||
99 | void se7619___outsl(unsigned long port, const void *addr, unsigned long count) | ||
100 | { | ||
101 | badio(outsw, port); | ||
102 | } | ||
diff --git a/arch/sh/boards/se/7619/setup.c b/arch/sh/boards/se/7619/setup.c index e627b26de0d0..52d2c4d5d2fa 100644 --- a/arch/sh/boards/se/7619/setup.c +++ b/arch/sh/boards/se/7619/setup.c | |||
@@ -9,7 +9,6 @@ | |||
9 | #include <linux/init.h> | 9 | #include <linux/init.h> |
10 | #include <linux/platform_device.h> | 10 | #include <linux/platform_device.h> |
11 | #include <asm/io.h> | 11 | #include <asm/io.h> |
12 | #include <asm/se7619.h> | ||
13 | #include <asm/machvec.h> | 12 | #include <asm/machvec.h> |
14 | 13 | ||
15 | /* | 14 | /* |
@@ -19,25 +18,5 @@ | |||
19 | struct sh_machine_vector mv_se __initmv = { | 18 | struct sh_machine_vector mv_se __initmv = { |
20 | .mv_name = "SolutionEngine", | 19 | .mv_name = "SolutionEngine", |
21 | .mv_nr_irqs = 108, | 20 | .mv_nr_irqs = 108, |
22 | .mv_inb = se7619___inb, | ||
23 | .mv_inw = se7619___inw, | ||
24 | .mv_inl = se7619___inl, | ||
25 | .mv_outb = se7619___outb, | ||
26 | .mv_outw = se7619___outw, | ||
27 | .mv_outl = se7619___outl, | ||
28 | |||
29 | .mv_inb_p = se7619___inb_p, | ||
30 | .mv_inw_p = se7619___inw, | ||
31 | .mv_inl_p = se7619___inl, | ||
32 | .mv_outb_p = se7619___outb_p, | ||
33 | .mv_outw_p = se7619___outw, | ||
34 | .mv_outl_p = se7619___outl, | ||
35 | |||
36 | .mv_insb = se7619___insb, | ||
37 | .mv_insw = se7619___insw, | ||
38 | .mv_insl = se7619___insl, | ||
39 | .mv_outsb = se7619___outsb, | ||
40 | .mv_outsw = se7619___outsw, | ||
41 | .mv_outsl = se7619___outsl, | ||
42 | }; | 21 | }; |
43 | ALIAS_MV(se) | 22 | ALIAS_MV(se) |
diff --git a/arch/sh/boot/Makefile b/arch/sh/boot/Makefile index 60797b31089c..11dc272c618e 100644 --- a/arch/sh/boot/Makefile +++ b/arch/sh/boot/Makefile | |||
@@ -8,13 +8,49 @@ | |||
8 | # Copyright (C) 1999 Stuart Menefy | 8 | # Copyright (C) 1999 Stuart Menefy |
9 | # | 9 | # |
10 | 10 | ||
11 | targets := zImage | 11 | MKIMAGE := $(srctree)/scripts/mkuboot.sh |
12 | |||
13 | # | ||
14 | # Assign safe dummy values if these variables are not defined, | ||
15 | # in order to suppress error message. | ||
16 | # | ||
17 | CONFIG_PAGE_OFFSET ?= 0x80000000 | ||
18 | CONFIG_MEMORY_START ?= 0x0c000000 | ||
19 | CONFIG_BOOT_LINK_OFFSET ?= 0x00800000 | ||
20 | CONFIG_ZERO_PAGE_OFFSET ?= 0x00001000 | ||
21 | |||
22 | export CONFIG_PAGE_OFFSET CONFIG_MEMORY_START CONFIG_BOOT_LINK_OFFSET \ | ||
23 | CONFIG_ZERO_PAGE_OFFSET | ||
24 | |||
25 | targets := zImage vmlinux.srec uImage uImage.srec | ||
12 | subdir- := compressed | 26 | subdir- := compressed |
13 | 27 | ||
14 | $(obj)/zImage: $(obj)/compressed/vmlinux FORCE | 28 | $(obj)/zImage: $(obj)/compressed/vmlinux FORCE |
15 | $(call if_changed,objcopy) | 29 | $(call if_changed,objcopy) |
16 | @echo 'Kernel: $@ is ready' | 30 | @echo ' Kernel: $@ is ready' |
17 | 31 | ||
18 | $(obj)/compressed/vmlinux: FORCE | 32 | $(obj)/compressed/vmlinux: FORCE |
19 | $(Q)$(MAKE) $(build)=$(obj)/compressed $@ | 33 | $(Q)$(MAKE) $(build)=$(obj)/compressed $@ |
20 | 34 | ||
35 | KERNEL_LOAD := $(shell printf "0x%8x" $$[$(CONFIG_PAGE_OFFSET) + \ | ||
36 | $(CONFIG_MEMORY_START) + \ | ||
37 | $(CONFIG_ZERO_PAGE_OFFSET)+0x1000]) | ||
38 | |||
39 | quiet_cmd_uimage = UIMAGE $@ | ||
40 | cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A sh -O linux -T kernel \ | ||
41 | -C gzip -a $(KERNEL_LOAD) -e $(KERNEL_LOAD) \ | ||
42 | -n 'Linux-$(KERNELRELEASE)' -d $< $@ | ||
43 | |||
44 | $(obj)/uImage: $(obj)/zImage FORCE | ||
45 | $(call if_changed,uimage) | ||
46 | @echo ' Image $@ is ready' | ||
47 | |||
48 | OBJCOPYFLAGS_vmlinux.srec := -I binary -O srec | ||
49 | $(obj)/vmlinux.srec: $(obj)/compressed/vmlinux | ||
50 | $(call if_changed,objcopy) | ||
51 | |||
52 | OBJCOPYFLAGS_uImage.srec := -I binary -O srec | ||
53 | $(obj)/uImage.srec: $(obj)/uImage | ||
54 | $(call if_changed,objcopy) | ||
55 | |||
56 | clean-files += uImage uImage.srec vmlinux.srec | ||
diff --git a/arch/sh/boot/compressed/Makefile b/arch/sh/boot/compressed/Makefile index e5f443790079..d9512416f885 100644 --- a/arch/sh/boot/compressed/Makefile +++ b/arch/sh/boot/compressed/Makefile | |||
@@ -15,13 +15,7 @@ endif | |||
15 | 15 | ||
16 | # | 16 | # |
17 | # IMAGE_OFFSET is the load offset of the compression loader | 17 | # IMAGE_OFFSET is the load offset of the compression loader |
18 | # Assign dummy values if these 2 variables are not defined, | ||
19 | # in order to suppress error message. | ||
20 | # | 18 | # |
21 | CONFIG_PAGE_OFFSET ?= 0x80000000 | ||
22 | CONFIG_MEMORY_START ?= 0x0c000000 | ||
23 | CONFIG_BOOT_LINK_OFFSET ?= 0x00800000 | ||
24 | |||
25 | IMAGE_OFFSET := $(shell printf "0x%08x" $$[$(CONFIG_PAGE_OFFSET) + \ | 19 | IMAGE_OFFSET := $(shell printf "0x%08x" $$[$(CONFIG_PAGE_OFFSET) + \ |
26 | $(CONFIG_MEMORY_START) + \ | 20 | $(CONFIG_MEMORY_START) + \ |
27 | $(CONFIG_BOOT_LINK_OFFSET)]) | 21 | $(CONFIG_BOOT_LINK_OFFSET)]) |
diff --git a/arch/sh/boot/compressed/head.S b/arch/sh/boot/compressed/head.S index 4c26a192277d..a8399b013729 100644 --- a/arch/sh/boot/compressed/head.S +++ b/arch/sh/boot/compressed/head.S | |||
@@ -8,6 +8,7 @@ | |||
8 | .text | 8 | .text |
9 | 9 | ||
10 | #include <linux/linkage.h> | 10 | #include <linux/linkage.h> |
11 | #include <asm/page.h> | ||
11 | 12 | ||
12 | .global startup | 13 | .global startup |
13 | startup: | 14 | startup: |
@@ -97,7 +98,7 @@ init_stack_addr: | |||
97 | decompress_kernel_addr: | 98 | decompress_kernel_addr: |
98 | .long decompress_kernel | 99 | .long decompress_kernel |
99 | kernel_start_addr: | 100 | kernel_start_addr: |
100 | .long _text+0x1000 | 101 | .long _text+PAGE_SIZE |
101 | 102 | ||
102 | .align 9 | 103 | .align 9 |
103 | fake_headers_as_bzImage: | 104 | fake_headers_as_bzImage: |
diff --git a/arch/sh/boot/compressed/misc.c b/arch/sh/boot/compressed/misc.c index 35452d85b7f7..df65e305acf7 100644 --- a/arch/sh/boot/compressed/misc.c +++ b/arch/sh/boot/compressed/misc.c | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #include <asm/uaccess.h> | 14 | #include <asm/uaccess.h> |
15 | #include <asm/addrspace.h> | 15 | #include <asm/addrspace.h> |
16 | #include <asm/page.h> | ||
16 | #ifdef CONFIG_SH_STANDARD_BIOS | 17 | #ifdef CONFIG_SH_STANDARD_BIOS |
17 | #include <asm/sh_bios.h> | 18 | #include <asm/sh_bios.h> |
18 | #endif | 19 | #endif |
@@ -229,7 +230,7 @@ long* stack_start = &user_stack[STACK_SIZE]; | |||
229 | void decompress_kernel(void) | 230 | void decompress_kernel(void) |
230 | { | 231 | { |
231 | output_data = 0; | 232 | output_data = 0; |
232 | output_ptr = P2SEGADDR((unsigned long)&_text+0x1000); | 233 | output_ptr = P2SEGADDR((unsigned long)&_text+PAGE_SIZE); |
233 | free_mem_ptr = (unsigned long)&_end; | 234 | free_mem_ptr = (unsigned long)&_end; |
234 | free_mem_end_ptr = free_mem_ptr + HEAP_SIZE; | 235 | free_mem_end_ptr = free_mem_ptr + HEAP_SIZE; |
235 | 236 | ||
diff --git a/arch/sh/configs/landisk_defconfig b/arch/sh/configs/landisk_defconfig index 238c0f109907..e7f8ddb0ada4 100644 --- a/arch/sh/configs/landisk_defconfig +++ b/arch/sh/configs/landisk_defconfig | |||
@@ -1,7 +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.18 | 3 | # Linux kernel version: 2.6.19 |
4 | # Tue Oct 3 11:14:13 2006 | 4 | # Thu Dec 7 17:13:04 2006 |
5 | # | 5 | # |
6 | CONFIG_SUPERH=y | 6 | CONFIG_SUPERH=y |
7 | CONFIG_RWSEM_GENERIC_SPINLOCK=y | 7 | CONFIG_RWSEM_GENERIC_SPINLOCK=y |
@@ -10,6 +10,9 @@ CONFIG_GENERIC_HWEIGHT=y | |||
10 | CONFIG_GENERIC_HARDIRQS=y | 10 | CONFIG_GENERIC_HARDIRQS=y |
11 | CONFIG_GENERIC_IRQ_PROBE=y | 11 | CONFIG_GENERIC_IRQ_PROBE=y |
12 | CONFIG_GENERIC_CALIBRATE_DELAY=y | 12 | CONFIG_GENERIC_CALIBRATE_DELAY=y |
13 | # CONFIG_GENERIC_TIME is not set | ||
14 | CONFIG_STACKTRACE_SUPPORT=y | ||
15 | CONFIG_LOCKDEP_SUPPORT=y | ||
13 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" | 16 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" |
14 | 17 | ||
15 | # | 18 | # |
@@ -33,6 +36,7 @@ CONFIG_SYSVIPC=y | |||
33 | # CONFIG_UTS_NS is not set | 36 | # CONFIG_UTS_NS is not set |
34 | # CONFIG_AUDIT is not set | 37 | # CONFIG_AUDIT is not set |
35 | # CONFIG_IKCONFIG is not set | 38 | # CONFIG_IKCONFIG is not set |
39 | CONFIG_SYSFS_DEPRECATED=y | ||
36 | # CONFIG_RELAY is not set | 40 | # CONFIG_RELAY is not set |
37 | CONFIG_INITRAMFS_SOURCE="" | 41 | CONFIG_INITRAMFS_SOURCE="" |
38 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y | 42 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y |
@@ -114,6 +118,8 @@ CONFIG_DEFAULT_IOSCHED="anticipatory" | |||
114 | CONFIG_SH_LANDISK=y | 118 | CONFIG_SH_LANDISK=y |
115 | # CONFIG_SH_TITAN is not set | 119 | # CONFIG_SH_TITAN is not set |
116 | # CONFIG_SH_SHMIN is not set | 120 | # CONFIG_SH_SHMIN is not set |
121 | # CONFIG_SH_7206_SOLUTION_ENGINE is not set | ||
122 | # CONFIG_SH_7619_SOLUTION_ENGINE is not set | ||
117 | # CONFIG_SH_UNKNOWN is not set | 123 | # CONFIG_SH_UNKNOWN is not set |
118 | 124 | ||
119 | # | 125 | # |
@@ -125,6 +131,12 @@ CONFIG_CPU_SH4=y | |||
125 | # SH-2 Processor Support | 131 | # SH-2 Processor Support |
126 | # | 132 | # |
127 | # CONFIG_CPU_SUBTYPE_SH7604 is not set | 133 | # CONFIG_CPU_SUBTYPE_SH7604 is not set |
134 | # CONFIG_CPU_SUBTYPE_SH7619 is not set | ||
135 | |||
136 | # | ||
137 | # SH-2A Processor Support | ||
138 | # | ||
139 | # CONFIG_CPU_SUBTYPE_SH7206 is not set | ||
128 | 140 | ||
129 | # | 141 | # |
130 | # SH-3 Processor Support | 142 | # SH-3 Processor Support |
@@ -160,6 +172,7 @@ CONFIG_CPU_SUBTYPE_SH7751R=y | |||
160 | # | 172 | # |
161 | # CONFIG_CPU_SUBTYPE_SH7770 is not set | 173 | # CONFIG_CPU_SUBTYPE_SH7770 is not set |
162 | # CONFIG_CPU_SUBTYPE_SH7780 is not set | 174 | # CONFIG_CPU_SUBTYPE_SH7780 is not set |
175 | # CONFIG_CPU_SUBTYPE_SH7785 is not set | ||
163 | 176 | ||
164 | # | 177 | # |
165 | # SH4AL-DSP Processor Support | 178 | # SH4AL-DSP Processor Support |
@@ -175,6 +188,9 @@ CONFIG_PAGE_OFFSET=0x80000000 | |||
175 | CONFIG_MEMORY_START=0x0c000000 | 188 | CONFIG_MEMORY_START=0x0c000000 |
176 | CONFIG_MEMORY_SIZE=0x04000000 | 189 | CONFIG_MEMORY_SIZE=0x04000000 |
177 | CONFIG_VSYSCALL=y | 190 | CONFIG_VSYSCALL=y |
191 | CONFIG_PAGE_SIZE_4KB=y | ||
192 | # CONFIG_PAGE_SIZE_8KB is not set | ||
193 | # CONFIG_PAGE_SIZE_64KB is not set | ||
178 | CONFIG_SELECT_MEMORY_MODEL=y | 194 | CONFIG_SELECT_MEMORY_MODEL=y |
179 | CONFIG_FLATMEM_MANUAL=y | 195 | CONFIG_FLATMEM_MANUAL=y |
180 | # CONFIG_DISCONTIGMEM_MANUAL is not set | 196 | # CONFIG_DISCONTIGMEM_MANUAL is not set |
@@ -196,16 +212,21 @@ CONFIG_SPLIT_PTLOCK_CPUS=4 | |||
196 | # Processor features | 212 | # Processor features |
197 | # | 213 | # |
198 | CONFIG_CPU_LITTLE_ENDIAN=y | 214 | CONFIG_CPU_LITTLE_ENDIAN=y |
215 | # CONFIG_CPU_BIG_ENDIAN is not set | ||
199 | CONFIG_SH_FPU=y | 216 | CONFIG_SH_FPU=y |
200 | # CONFIG_SH_DSP is not set | 217 | # CONFIG_SH_DSP is not set |
201 | # CONFIG_SH_STORE_QUEUES is not set | 218 | # CONFIG_SH_STORE_QUEUES is not set |
202 | CONFIG_CPU_HAS_INTEVT=y | 219 | CONFIG_CPU_HAS_INTEVT=y |
220 | CONFIG_CPU_HAS_IPR_IRQ=y | ||
203 | CONFIG_CPU_HAS_SR_RB=y | 221 | CONFIG_CPU_HAS_SR_RB=y |
222 | CONFIG_CPU_HAS_PTEA=y | ||
204 | 223 | ||
205 | # | 224 | # |
206 | # Timer support | 225 | # Timer support |
207 | # | 226 | # |
208 | CONFIG_SH_TMU=y | 227 | CONFIG_SH_TMU=y |
228 | CONFIG_SH_TIMER_IRQ=16 | ||
229 | # CONFIG_NO_IDLE_HZ is not set | ||
209 | CONFIG_SH_PCLK_FREQ=33333333 | 230 | CONFIG_SH_PCLK_FREQ=33333333 |
210 | 231 | ||
211 | # | 232 | # |
@@ -216,9 +237,7 @@ CONFIG_SH_PCLK_FREQ=33333333 | |||
216 | # | 237 | # |
217 | # DMA support | 238 | # DMA support |
218 | # | 239 | # |
219 | CONFIG_SH_DMA=y | 240 | # CONFIG_SH_DMA is not set |
220 | CONFIG_NR_ONCHIP_DMA_CHANNELS=4 | ||
221 | # CONFIG_NR_DMA_CHANNELS_BOOL is not set | ||
222 | 241 | ||
223 | # | 242 | # |
224 | # Companion Chips | 243 | # Companion Chips |
@@ -227,6 +246,11 @@ CONFIG_NR_ONCHIP_DMA_CHANNELS=4 | |||
227 | CONFIG_HEARTBEAT=y | 246 | CONFIG_HEARTBEAT=y |
228 | 247 | ||
229 | # | 248 | # |
249 | # Additional SuperH Device Drivers | ||
250 | # | ||
251 | # CONFIG_PUSH_SWITCH is not set | ||
252 | |||
253 | # | ||
230 | # Kernel features | 254 | # Kernel features |
231 | # | 255 | # |
232 | # CONFIG_HZ_100 is not set | 256 | # CONFIG_HZ_100 is not set |
@@ -340,11 +364,13 @@ CONFIG_IP_PNP=y | |||
340 | # CONFIG_INET_TUNNEL is not set | 364 | # CONFIG_INET_TUNNEL is not set |
341 | CONFIG_INET_XFRM_MODE_TRANSPORT=y | 365 | CONFIG_INET_XFRM_MODE_TRANSPORT=y |
342 | CONFIG_INET_XFRM_MODE_TUNNEL=y | 366 | CONFIG_INET_XFRM_MODE_TUNNEL=y |
367 | CONFIG_INET_XFRM_MODE_BEET=y | ||
343 | CONFIG_INET_DIAG=y | 368 | CONFIG_INET_DIAG=y |
344 | CONFIG_INET_TCP_DIAG=y | 369 | CONFIG_INET_TCP_DIAG=y |
345 | # CONFIG_TCP_CONG_ADVANCED is not set | 370 | # CONFIG_TCP_CONG_ADVANCED is not set |
346 | CONFIG_TCP_CONG_CUBIC=y | 371 | CONFIG_TCP_CONG_CUBIC=y |
347 | CONFIG_DEFAULT_TCP_CONG="cubic" | 372 | CONFIG_DEFAULT_TCP_CONG="cubic" |
373 | # CONFIG_TCP_MD5SIG is not set | ||
348 | 374 | ||
349 | # | 375 | # |
350 | # IP: Virtual Server Configuration | 376 | # IP: Virtual Server Configuration |
@@ -361,24 +387,12 @@ CONFIG_NETFILTER=y | |||
361 | # Core Netfilter Configuration | 387 | # Core Netfilter Configuration |
362 | # | 388 | # |
363 | # CONFIG_NETFILTER_NETLINK is not set | 389 | # CONFIG_NETFILTER_NETLINK is not set |
390 | # CONFIG_NF_CONNTRACK_ENABLED is not set | ||
364 | # CONFIG_NETFILTER_XTABLES is not set | 391 | # CONFIG_NETFILTER_XTABLES is not set |
365 | 392 | ||
366 | # | 393 | # |
367 | # IP: Netfilter Configuration | 394 | # IP: Netfilter Configuration |
368 | # | 395 | # |
369 | CONFIG_IP_NF_CONNTRACK=m | ||
370 | CONFIG_IP_NF_CT_ACCT=y | ||
371 | CONFIG_IP_NF_CONNTRACK_MARK=y | ||
372 | # CONFIG_IP_NF_CONNTRACK_EVENTS is not set | ||
373 | # CONFIG_IP_NF_CT_PROTO_SCTP is not set | ||
374 | CONFIG_IP_NF_FTP=m | ||
375 | CONFIG_IP_NF_IRC=m | ||
376 | # CONFIG_IP_NF_NETBIOS_NS is not set | ||
377 | CONFIG_IP_NF_TFTP=m | ||
378 | CONFIG_IP_NF_AMANDA=m | ||
379 | # CONFIG_IP_NF_PPTP is not set | ||
380 | # CONFIG_IP_NF_H323 is not set | ||
381 | # CONFIG_IP_NF_SIP is not set | ||
382 | CONFIG_IP_NF_QUEUE=m | 396 | CONFIG_IP_NF_QUEUE=m |
383 | 397 | ||
384 | # | 398 | # |
@@ -477,6 +491,12 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 | |||
477 | # CONFIG_ATA_OVER_ETH is not set | 491 | # CONFIG_ATA_OVER_ETH is not set |
478 | 492 | ||
479 | # | 493 | # |
494 | # Misc devices | ||
495 | # | ||
496 | # CONFIG_SGI_IOC4 is not set | ||
497 | # CONFIG_TIFM_CORE is not set | ||
498 | |||
499 | # | ||
480 | # ATA/ATAPI/MFM/RLL support | 500 | # ATA/ATAPI/MFM/RLL support |
481 | # | 501 | # |
482 | CONFIG_IDE=y | 502 | CONFIG_IDE=y |
@@ -519,6 +539,7 @@ CONFIG_BLK_DEV_AEC62XX=y | |||
519 | # CONFIG_BLK_DEV_CS5530 is not set | 539 | # CONFIG_BLK_DEV_CS5530 is not set |
520 | # CONFIG_BLK_DEV_HPT34X is not set | 540 | # CONFIG_BLK_DEV_HPT34X is not set |
521 | # CONFIG_BLK_DEV_HPT366 is not set | 541 | # CONFIG_BLK_DEV_HPT366 is not set |
542 | # CONFIG_BLK_DEV_JMICRON is not set | ||
522 | # CONFIG_BLK_DEV_SC1200 is not set | 543 | # CONFIG_BLK_DEV_SC1200 is not set |
523 | # CONFIG_BLK_DEV_PIIX is not set | 544 | # CONFIG_BLK_DEV_PIIX is not set |
524 | # CONFIG_BLK_DEV_IT821X is not set | 545 | # CONFIG_BLK_DEV_IT821X is not set |
@@ -542,6 +563,7 @@ CONFIG_IDEDMA_AUTO=y | |||
542 | # | 563 | # |
543 | # CONFIG_RAID_ATTRS is not set | 564 | # CONFIG_RAID_ATTRS is not set |
544 | CONFIG_SCSI=y | 565 | CONFIG_SCSI=y |
566 | # CONFIG_SCSI_TGT is not set | ||
545 | # CONFIG_SCSI_NETLINK is not set | 567 | # CONFIG_SCSI_NETLINK is not set |
546 | CONFIG_SCSI_PROC_FS=y | 568 | CONFIG_SCSI_PROC_FS=y |
547 | 569 | ||
@@ -561,6 +583,7 @@ CONFIG_BLK_DEV_SD=y | |||
561 | CONFIG_SCSI_MULTI_LUN=y | 583 | CONFIG_SCSI_MULTI_LUN=y |
562 | # CONFIG_SCSI_CONSTANTS is not set | 584 | # CONFIG_SCSI_CONSTANTS is not set |
563 | # CONFIG_SCSI_LOGGING is not set | 585 | # CONFIG_SCSI_LOGGING is not set |
586 | # CONFIG_SCSI_SCAN_ASYNC is not set | ||
564 | 587 | ||
565 | # | 588 | # |
566 | # SCSI Transports | 589 | # SCSI Transports |
@@ -602,12 +625,12 @@ CONFIG_SCSI_MULTI_LUN=y | |||
602 | # CONFIG_SCSI_NCR53C406A is not set | 625 | # CONFIG_SCSI_NCR53C406A is not set |
603 | # CONFIG_SCSI_STEX is not set | 626 | # CONFIG_SCSI_STEX is not set |
604 | # CONFIG_SCSI_SYM53C8XX_2 is not set | 627 | # CONFIG_SCSI_SYM53C8XX_2 is not set |
605 | # CONFIG_SCSI_IPR is not set | ||
606 | # CONFIG_SCSI_PAS16 is not set | 628 | # CONFIG_SCSI_PAS16 is not set |
607 | # CONFIG_SCSI_PSI240I is not set | 629 | # CONFIG_SCSI_PSI240I is not set |
608 | # CONFIG_SCSI_QLOGIC_FAS is not set | 630 | # CONFIG_SCSI_QLOGIC_FAS is not set |
609 | # CONFIG_SCSI_QLOGIC_1280 is not set | 631 | # CONFIG_SCSI_QLOGIC_1280 is not set |
610 | # CONFIG_SCSI_QLA_FC is not set | 632 | # CONFIG_SCSI_QLA_FC is not set |
633 | # CONFIG_SCSI_QLA_ISCSI is not set | ||
611 | # CONFIG_SCSI_LPFC is not set | 634 | # CONFIG_SCSI_LPFC is not set |
612 | # CONFIG_SCSI_SYM53C416 is not set | 635 | # CONFIG_SCSI_SYM53C416 is not set |
613 | # CONFIG_SCSI_DC395x is not set | 636 | # CONFIG_SCSI_DC395x is not set |
@@ -615,6 +638,7 @@ CONFIG_SCSI_MULTI_LUN=y | |||
615 | # CONFIG_SCSI_T128 is not set | 638 | # CONFIG_SCSI_T128 is not set |
616 | # CONFIG_SCSI_NSP32 is not set | 639 | # CONFIG_SCSI_NSP32 is not set |
617 | # CONFIG_SCSI_DEBUG is not set | 640 | # CONFIG_SCSI_DEBUG is not set |
641 | # CONFIG_SCSI_SRP is not set | ||
618 | 642 | ||
619 | # | 643 | # |
620 | # PCMCIA SCSI adapter support | 644 | # PCMCIA SCSI adapter support |
@@ -757,6 +781,7 @@ CONFIG_8139CP=y | |||
757 | # CONFIG_IXGB is not set | 781 | # CONFIG_IXGB is not set |
758 | # CONFIG_S2IO is not set | 782 | # CONFIG_S2IO is not set |
759 | # CONFIG_MYRI10GE is not set | 783 | # CONFIG_MYRI10GE is not set |
784 | # CONFIG_NETXEN_NIC is not set | ||
760 | 785 | ||
761 | # | 786 | # |
762 | # Token Ring devices | 787 | # Token Ring devices |
@@ -871,10 +896,6 @@ CONFIG_HW_RANDOM=y | |||
871 | # CONFIG_DTLK is not set | 896 | # CONFIG_DTLK is not set |
872 | # CONFIG_R3964 is not set | 897 | # CONFIG_R3964 is not set |
873 | # CONFIG_APPLICOM is not set | 898 | # CONFIG_APPLICOM is not set |
874 | |||
875 | # | ||
876 | # Ftape, the floppy tape device driver | ||
877 | # | ||
878 | # CONFIG_DRM is not set | 899 | # CONFIG_DRM is not set |
879 | 900 | ||
880 | # | 901 | # |
@@ -889,7 +910,6 @@ CONFIG_HW_RANDOM=y | |||
889 | # TPM devices | 910 | # TPM devices |
890 | # | 911 | # |
891 | # CONFIG_TCG_TPM is not set | 912 | # CONFIG_TCG_TPM is not set |
892 | # CONFIG_TELCLOCK is not set | ||
893 | 913 | ||
894 | # | 914 | # |
895 | # I2C support | 915 | # I2C support |
@@ -905,6 +925,7 @@ CONFIG_HW_RANDOM=y | |||
905 | # | 925 | # |
906 | # Dallas's 1-wire bus | 926 | # Dallas's 1-wire bus |
907 | # | 927 | # |
928 | # CONFIG_W1 is not set | ||
908 | 929 | ||
909 | # | 930 | # |
910 | # Hardware Monitoring support | 931 | # Hardware Monitoring support |
@@ -917,10 +938,6 @@ CONFIG_HWMON=y | |||
917 | # CONFIG_HWMON_DEBUG_CHIP is not set | 938 | # CONFIG_HWMON_DEBUG_CHIP is not set |
918 | 939 | ||
919 | # | 940 | # |
920 | # Misc devices | ||
921 | # | ||
922 | |||
923 | # | ||
924 | # Multimedia devices | 941 | # Multimedia devices |
925 | # | 942 | # |
926 | CONFIG_VIDEO_DEV=m | 943 | CONFIG_VIDEO_DEV=m |
@@ -1037,6 +1054,7 @@ CONFIG_USB=y | |||
1037 | CONFIG_USB_DEVICEFS=y | 1054 | CONFIG_USB_DEVICEFS=y |
1038 | # CONFIG_USB_BANDWIDTH is not set | 1055 | # CONFIG_USB_BANDWIDTH is not set |
1039 | # CONFIG_USB_DYNAMIC_MINORS is not set | 1056 | # CONFIG_USB_DYNAMIC_MINORS is not set |
1057 | # CONFIG_USB_MULTITHREAD_PROBE is not set | ||
1040 | # CONFIG_USB_OTG is not set | 1058 | # CONFIG_USB_OTG is not set |
1041 | 1059 | ||
1042 | # | 1060 | # |
@@ -1106,7 +1124,6 @@ CONFIG_USB_HIDINPUT=y | |||
1106 | # CONFIG_USB_ATI_REMOTE2 is not set | 1124 | # CONFIG_USB_ATI_REMOTE2 is not set |
1107 | # CONFIG_USB_KEYSPAN_REMOTE is not set | 1125 | # CONFIG_USB_KEYSPAN_REMOTE is not set |
1108 | # CONFIG_USB_APPLETOUCH is not set | 1126 | # CONFIG_USB_APPLETOUCH is not set |
1109 | # CONFIG_USB_TRANCEVIBRATOR is not set | ||
1110 | 1127 | ||
1111 | # | 1128 | # |
1112 | # USB Imaging devices | 1129 | # USB Imaging devices |
@@ -1121,6 +1138,7 @@ CONFIG_USB_HIDINPUT=y | |||
1121 | # CONFIG_USB_KAWETH is not set | 1138 | # CONFIG_USB_KAWETH is not set |
1122 | CONFIG_USB_PEGASUS=m | 1139 | CONFIG_USB_PEGASUS=m |
1123 | CONFIG_USB_RTL8150=m | 1140 | CONFIG_USB_RTL8150=m |
1141 | # CONFIG_USB_USBNET_MII is not set | ||
1124 | # CONFIG_USB_USBNET is not set | 1142 | # CONFIG_USB_USBNET is not set |
1125 | CONFIG_USB_MON=y | 1143 | CONFIG_USB_MON=y |
1126 | 1144 | ||
@@ -1156,6 +1174,7 @@ CONFIG_USB_SERIAL_FTDI_SIO=m | |||
1156 | # CONFIG_USB_SERIAL_KLSI is not set | 1174 | # CONFIG_USB_SERIAL_KLSI is not set |
1157 | # CONFIG_USB_SERIAL_KOBIL_SCT is not set | 1175 | # CONFIG_USB_SERIAL_KOBIL_SCT is not set |
1158 | # CONFIG_USB_SERIAL_MCT_U232 is not set | 1176 | # CONFIG_USB_SERIAL_MCT_U232 is not set |
1177 | # CONFIG_USB_SERIAL_MOS7720 is not set | ||
1159 | # CONFIG_USB_SERIAL_MOS7840 is not set | 1178 | # CONFIG_USB_SERIAL_MOS7840 is not set |
1160 | # CONFIG_USB_SERIAL_NAVMAN is not set | 1179 | # CONFIG_USB_SERIAL_NAVMAN is not set |
1161 | CONFIG_USB_SERIAL_PL2303=m | 1180 | CONFIG_USB_SERIAL_PL2303=m |
@@ -1167,6 +1186,7 @@ CONFIG_USB_SERIAL_PL2303=m | |||
1167 | # CONFIG_USB_SERIAL_XIRCOM is not set | 1186 | # CONFIG_USB_SERIAL_XIRCOM is not set |
1168 | # CONFIG_USB_SERIAL_OPTION is not set | 1187 | # CONFIG_USB_SERIAL_OPTION is not set |
1169 | # CONFIG_USB_SERIAL_OMNINET is not set | 1188 | # CONFIG_USB_SERIAL_OMNINET is not set |
1189 | # CONFIG_USB_SERIAL_DEBUG is not set | ||
1170 | 1190 | ||
1171 | # | 1191 | # |
1172 | # USB Miscellaneous drivers | 1192 | # USB Miscellaneous drivers |
@@ -1188,6 +1208,7 @@ CONFIG_USB_EMI26=m | |||
1188 | CONFIG_USB_SISUSBVGA=m | 1208 | CONFIG_USB_SISUSBVGA=m |
1189 | CONFIG_USB_SISUSBVGA_CON=y | 1209 | CONFIG_USB_SISUSBVGA_CON=y |
1190 | # CONFIG_USB_LD is not set | 1210 | # CONFIG_USB_LD is not set |
1211 | # CONFIG_USB_TRANCEVIBRATOR is not set | ||
1191 | # CONFIG_USB_TEST is not set | 1212 | # CONFIG_USB_TEST is not set |
1192 | 1213 | ||
1193 | # | 1214 | # |
@@ -1254,6 +1275,7 @@ CONFIG_EXT3_FS=y | |||
1254 | CONFIG_EXT3_FS_XATTR=y | 1275 | CONFIG_EXT3_FS_XATTR=y |
1255 | # CONFIG_EXT3_FS_POSIX_ACL is not set | 1276 | # CONFIG_EXT3_FS_POSIX_ACL is not set |
1256 | # CONFIG_EXT3_FS_SECURITY is not set | 1277 | # CONFIG_EXT3_FS_SECURITY is not set |
1278 | # CONFIG_EXT4DEV_FS is not set | ||
1257 | CONFIG_JBD=y | 1279 | CONFIG_JBD=y |
1258 | # CONFIG_JBD_DEBUG is not set | 1280 | # CONFIG_JBD_DEBUG is not set |
1259 | CONFIG_FS_MBCACHE=y | 1281 | CONFIG_FS_MBCACHE=y |
@@ -1264,6 +1286,7 @@ CONFIG_REISERFS_FS=y | |||
1264 | # CONFIG_JFS_FS is not set | 1286 | # CONFIG_JFS_FS is not set |
1265 | # CONFIG_FS_POSIX_ACL is not set | 1287 | # CONFIG_FS_POSIX_ACL is not set |
1266 | # CONFIG_XFS_FS is not set | 1288 | # CONFIG_XFS_FS is not set |
1289 | # CONFIG_GFS2_FS is not set | ||
1267 | # CONFIG_OCFS2_FS is not set | 1290 | # CONFIG_OCFS2_FS is not set |
1268 | # CONFIG_MINIX_FS is not set | 1291 | # CONFIG_MINIX_FS is not set |
1269 | CONFIG_ROMFS_FS=y | 1292 | CONFIG_ROMFS_FS=y |
@@ -1414,6 +1437,7 @@ CONFIG_NLS_CODEPAGE_932=y | |||
1414 | # | 1437 | # |
1415 | # Kernel hacking | 1438 | # Kernel hacking |
1416 | # | 1439 | # |
1440 | CONFIG_TRACE_IRQFLAGS_SUPPORT=y | ||
1417 | # CONFIG_PRINTK_TIME is not set | 1441 | # CONFIG_PRINTK_TIME is not set |
1418 | CONFIG_ENABLE_MUST_CHECK=y | 1442 | CONFIG_ENABLE_MUST_CHECK=y |
1419 | # CONFIG_MAGIC_SYSRQ is not set | 1443 | # CONFIG_MAGIC_SYSRQ is not set |
@@ -1422,6 +1446,7 @@ CONFIG_ENABLE_MUST_CHECK=y | |||
1422 | CONFIG_LOG_BUF_SHIFT=14 | 1446 | CONFIG_LOG_BUF_SHIFT=14 |
1423 | # CONFIG_DEBUG_BUGVERBOSE is not set | 1447 | # CONFIG_DEBUG_BUGVERBOSE is not set |
1424 | # CONFIG_DEBUG_FS is not set | 1448 | # CONFIG_DEBUG_FS is not set |
1449 | # CONFIG_HEADERS_CHECK is not set | ||
1425 | CONFIG_SH_STANDARD_BIOS=y | 1450 | CONFIG_SH_STANDARD_BIOS=y |
1426 | # CONFIG_EARLY_SCIF_CONSOLE is not set | 1451 | # CONFIG_EARLY_SCIF_CONSOLE is not set |
1427 | # CONFIG_EARLY_PRINTK is not set | 1452 | # CONFIG_EARLY_PRINTK is not set |
@@ -1445,6 +1470,4 @@ CONFIG_SH_STANDARD_BIOS=y | |||
1445 | # CONFIG_CRC16 is not set | 1470 | # CONFIG_CRC16 is not set |
1446 | CONFIG_CRC32=y | 1471 | CONFIG_CRC32=y |
1447 | # CONFIG_LIBCRC32C is not set | 1472 | # CONFIG_LIBCRC32C is not set |
1448 | CONFIG_TEXTSEARCH=y | ||
1449 | CONFIG_TEXTSEARCH_KMP=m | ||
1450 | CONFIG_PLIST=y | 1473 | CONFIG_PLIST=y |
diff --git a/arch/sh/configs/se7206_defconfig b/arch/sh/configs/se7206_defconfig index 36cec0b6e7c1..87ab9080fd1d 100644 --- a/arch/sh/configs/se7206_defconfig +++ b/arch/sh/configs/se7206_defconfig | |||
@@ -1,7 +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.19-rc4 | 3 | # Linux kernel version: 2.6.19 |
4 | # Sun Nov 5 16:20:10 2006 | 4 | # Wed Dec 6 14:40:15 2006 |
5 | # | 5 | # |
6 | CONFIG_SUPERH=y | 6 | CONFIG_SUPERH=y |
7 | CONFIG_RWSEM_GENERIC_SPINLOCK=y | 7 | CONFIG_RWSEM_GENERIC_SPINLOCK=y |
@@ -11,6 +11,8 @@ CONFIG_GENERIC_HARDIRQS=y | |||
11 | CONFIG_GENERIC_IRQ_PROBE=y | 11 | CONFIG_GENERIC_IRQ_PROBE=y |
12 | CONFIG_GENERIC_CALIBRATE_DELAY=y | 12 | CONFIG_GENERIC_CALIBRATE_DELAY=y |
13 | # CONFIG_GENERIC_TIME is not set | 13 | # CONFIG_GENERIC_TIME is not set |
14 | CONFIG_STACKTRACE_SUPPORT=y | ||
15 | CONFIG_LOCKDEP_SUPPORT=y | ||
14 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" | 16 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" |
15 | 17 | ||
16 | # | 18 | # |
@@ -34,24 +36,23 @@ CONFIG_LOCALVERSION="" | |||
34 | # CONFIG_IKCONFIG is not set | 36 | # CONFIG_IKCONFIG is not set |
35 | # CONFIG_RELAY is not set | 37 | # CONFIG_RELAY is not set |
36 | CONFIG_INITRAMFS_SOURCE="" | 38 | CONFIG_INITRAMFS_SOURCE="" |
37 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set | 39 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y |
38 | CONFIG_SYSCTL=y | 40 | CONFIG_SYSCTL=y |
39 | CONFIG_EMBEDDED=y | 41 | CONFIG_EMBEDDED=y |
40 | CONFIG_UID16=y | 42 | # CONFIG_UID16 is not set |
41 | # CONFIG_SYSCTL_SYSCALL is not set | 43 | # CONFIG_SYSCTL_SYSCALL is not set |
42 | CONFIG_KALLSYMS=y | 44 | # CONFIG_KALLSYMS is not set |
43 | # CONFIG_KALLSYMS_EXTRA_PASS is not set | ||
44 | # CONFIG_HOTPLUG is not set | 45 | # CONFIG_HOTPLUG is not set |
45 | CONFIG_PRINTK=y | 46 | CONFIG_PRINTK=y |
46 | CONFIG_BUG=y | 47 | CONFIG_BUG=y |
47 | CONFIG_ELF_CORE=y | 48 | # CONFIG_ELF_CORE is not set |
48 | CONFIG_BASE_FULL=y | 49 | # CONFIG_BASE_FULL is not set |
49 | # CONFIG_FUTEX is not set | 50 | # CONFIG_FUTEX is not set |
50 | # CONFIG_EPOLL is not set | 51 | # CONFIG_EPOLL is not set |
51 | CONFIG_SLAB=y | 52 | CONFIG_SLAB=y |
52 | CONFIG_VM_EVENT_COUNTERS=y | 53 | # CONFIG_VM_EVENT_COUNTERS is not set |
53 | CONFIG_TINY_SHMEM=y | 54 | CONFIG_TINY_SHMEM=y |
54 | CONFIG_BASE_SMALL=0 | 55 | CONFIG_BASE_SMALL=1 |
55 | # CONFIG_SLOB is not set | 56 | # CONFIG_SLOB is not set |
56 | 57 | ||
57 | # | 58 | # |
@@ -160,6 +161,7 @@ CONFIG_CPU_SUBTYPE_SH7206=y | |||
160 | # | 161 | # |
161 | # CONFIG_CPU_SUBTYPE_SH7770 is not set | 162 | # CONFIG_CPU_SUBTYPE_SH7770 is not set |
162 | # CONFIG_CPU_SUBTYPE_SH7780 is not set | 163 | # CONFIG_CPU_SUBTYPE_SH7780 is not set |
164 | # CONFIG_CPU_SUBTYPE_SH7785 is not set | ||
163 | 165 | ||
164 | # | 166 | # |
165 | # SH4AL-DSP Processor Support | 167 | # SH4AL-DSP Processor Support |
@@ -172,7 +174,10 @@ CONFIG_CPU_SUBTYPE_SH7206=y | |||
172 | # | 174 | # |
173 | CONFIG_PAGE_OFFSET=0x00000000 | 175 | CONFIG_PAGE_OFFSET=0x00000000 |
174 | CONFIG_MEMORY_START=0x0c000000 | 176 | CONFIG_MEMORY_START=0x0c000000 |
175 | CONFIG_MEMORY_SIZE=0x02000000 | 177 | CONFIG_MEMORY_SIZE=0x04000000 |
178 | CONFIG_PAGE_SIZE_4KB=y | ||
179 | # CONFIG_PAGE_SIZE_8KB is not set | ||
180 | # CONFIG_PAGE_SIZE_64KB is not set | ||
176 | CONFIG_SELECT_MEMORY_MODEL=y | 181 | CONFIG_SELECT_MEMORY_MODEL=y |
177 | CONFIG_FLATMEM_MANUAL=y | 182 | CONFIG_FLATMEM_MANUAL=y |
178 | # CONFIG_DISCONTIGMEM_MANUAL is not set | 183 | # CONFIG_DISCONTIGMEM_MANUAL is not set |
@@ -194,6 +199,7 @@ CONFIG_SPLIT_PTLOCK_CPUS=4 | |||
194 | # Processor features | 199 | # Processor features |
195 | # | 200 | # |
196 | # CONFIG_CPU_LITTLE_ENDIAN is not set | 201 | # CONFIG_CPU_LITTLE_ENDIAN is not set |
202 | CONFIG_CPU_BIG_ENDIAN=y | ||
197 | # CONFIG_SH_FPU is not set | 203 | # CONFIG_SH_FPU is not set |
198 | # CONFIG_SH_FPU_EMU is not set | 204 | # CONFIG_SH_FPU_EMU is not set |
199 | # CONFIG_SH_DSP is not set | 205 | # CONFIG_SH_DSP is not set |
@@ -203,6 +209,8 @@ CONFIG_SPLIT_PTLOCK_CPUS=4 | |||
203 | # | 209 | # |
204 | CONFIG_SH_CMT=y | 210 | CONFIG_SH_CMT=y |
205 | # CONFIG_SH_MTU2 is not set | 211 | # CONFIG_SH_MTU2 is not set |
212 | CONFIG_SH_TIMER_IRQ=140 | ||
213 | # CONFIG_NO_IDLE_HZ is not set | ||
206 | CONFIG_SH_PCLK_FREQ=33333333 | 214 | CONFIG_SH_PCLK_FREQ=33333333 |
207 | CONFIG_SH_CLK_MD=6 | 215 | CONFIG_SH_CLK_MD=6 |
208 | 216 | ||
@@ -222,6 +230,11 @@ CONFIG_SH_CLK_MD=6 | |||
222 | # CONFIG_HD6446X_SERIES is not set | 230 | # CONFIG_HD6446X_SERIES is not set |
223 | 231 | ||
224 | # | 232 | # |
233 | # Additional SuperH Device Drivers | ||
234 | # | ||
235 | # CONFIG_PUSH_SWITCH is not set | ||
236 | |||
237 | # | ||
225 | # Kernel features | 238 | # Kernel features |
226 | # | 239 | # |
227 | CONFIG_HZ_100=y | 240 | CONFIG_HZ_100=y |
@@ -279,9 +292,6 @@ CONFIG_NET=y | |||
279 | # CONFIG_NETDEBUG is not set | 292 | # CONFIG_NETDEBUG is not set |
280 | # CONFIG_PACKET is not set | 293 | # CONFIG_PACKET is not set |
281 | # CONFIG_UNIX is not set | 294 | # CONFIG_UNIX is not set |
282 | CONFIG_XFRM=y | ||
283 | # CONFIG_XFRM_USER is not set | ||
284 | # CONFIG_XFRM_SUB_POLICY is not set | ||
285 | # CONFIG_NET_KEY is not set | 295 | # CONFIG_NET_KEY is not set |
286 | CONFIG_INET=y | 296 | CONFIG_INET=y |
287 | # CONFIG_IP_MULTICAST is not set | 297 | # CONFIG_IP_MULTICAST is not set |
@@ -297,9 +307,9 @@ CONFIG_IP_FIB_HASH=y | |||
297 | # CONFIG_INET_IPCOMP is not set | 307 | # CONFIG_INET_IPCOMP is not set |
298 | # CONFIG_INET_XFRM_TUNNEL is not set | 308 | # CONFIG_INET_XFRM_TUNNEL is not set |
299 | # CONFIG_INET_TUNNEL is not set | 309 | # CONFIG_INET_TUNNEL is not set |
300 | CONFIG_INET_XFRM_MODE_TRANSPORT=y | 310 | # CONFIG_INET_XFRM_MODE_TRANSPORT is not set |
301 | CONFIG_INET_XFRM_MODE_TUNNEL=y | 311 | # CONFIG_INET_XFRM_MODE_TUNNEL is not set |
302 | CONFIG_INET_XFRM_MODE_BEET=y | 312 | # CONFIG_INET_XFRM_MODE_BEET is not set |
303 | # CONFIG_INET_DIAG is not set | 313 | # CONFIG_INET_DIAG is not set |
304 | # CONFIG_TCP_CONG_ADVANCED is not set | 314 | # CONFIG_TCP_CONG_ADVANCED is not set |
305 | CONFIG_TCP_CONG_CUBIC=y | 315 | CONFIG_TCP_CONG_CUBIC=y |
@@ -371,7 +381,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic" | |||
371 | # | 381 | # |
372 | CONFIG_MTD=y | 382 | CONFIG_MTD=y |
373 | # CONFIG_MTD_DEBUG is not set | 383 | # CONFIG_MTD_DEBUG is not set |
374 | # CONFIG_MTD_CONCAT is not set | 384 | CONFIG_MTD_CONCAT=y |
375 | CONFIG_MTD_PARTITIONS=y | 385 | CONFIG_MTD_PARTITIONS=y |
376 | CONFIG_MTD_REDBOOT_PARTS=y | 386 | CONFIG_MTD_REDBOOT_PARTS=y |
377 | CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1 | 387 | CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1 |
@@ -422,7 +432,7 @@ CONFIG_MTD_CFI_UTIL=y | |||
422 | # CONFIG_MTD_COMPLEX_MAPPINGS is not set | 432 | # CONFIG_MTD_COMPLEX_MAPPINGS is not set |
423 | CONFIG_MTD_PHYSMAP=y | 433 | CONFIG_MTD_PHYSMAP=y |
424 | CONFIG_MTD_PHYSMAP_START=0x20000000 | 434 | CONFIG_MTD_PHYSMAP_START=0x20000000 |
425 | CONFIG_MTD_PHYSMAP_LEN=0x1000000 | 435 | CONFIG_MTD_PHYSMAP_LEN=0x01000000 |
426 | CONFIG_MTD_PHYSMAP_BANKWIDTH=4 | 436 | CONFIG_MTD_PHYSMAP_BANKWIDTH=4 |
427 | # CONFIG_MTD_SOLUTIONENGINE is not set | 437 | # CONFIG_MTD_SOLUTIONENGINE is not set |
428 | # CONFIG_MTD_UCLINUX is not set | 438 | # CONFIG_MTD_UCLINUX is not set |
@@ -468,10 +478,7 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=4 | |||
468 | # CONFIG_BLK_DEV_COW_COMMON is not set | 478 | # CONFIG_BLK_DEV_COW_COMMON is not set |
469 | # CONFIG_BLK_DEV_LOOP is not set | 479 | # CONFIG_BLK_DEV_LOOP is not set |
470 | # CONFIG_BLK_DEV_NBD is not set | 480 | # CONFIG_BLK_DEV_NBD is not set |
471 | CONFIG_BLK_DEV_RAM=y | 481 | # CONFIG_BLK_DEV_RAM is not set |
472 | CONFIG_BLK_DEV_RAM_COUNT=16 | ||
473 | CONFIG_BLK_DEV_RAM_SIZE=4096 | ||
474 | CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 | ||
475 | # CONFIG_BLK_DEV_INITRD is not set | 482 | # CONFIG_BLK_DEV_INITRD is not set |
476 | # CONFIG_CDROM_PKTCDVD is not set | 483 | # CONFIG_CDROM_PKTCDVD is not set |
477 | # CONFIG_ATA_OVER_ETH is not set | 484 | # CONFIG_ATA_OVER_ETH is not set |
@@ -519,7 +526,50 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 | |||
519 | # | 526 | # |
520 | # Network device support | 527 | # Network device support |
521 | # | 528 | # |
522 | # CONFIG_NETDEVICES is not set | 529 | CONFIG_NETDEVICES=y |
530 | # CONFIG_DUMMY is not set | ||
531 | # CONFIG_BONDING is not set | ||
532 | # CONFIG_EQUALIZER is not set | ||
533 | # CONFIG_TUN is not set | ||
534 | |||
535 | # | ||
536 | # PHY device support | ||
537 | # | ||
538 | # CONFIG_PHYLIB is not set | ||
539 | |||
540 | # | ||
541 | # Ethernet (10 or 100Mbit) | ||
542 | # | ||
543 | CONFIG_NET_ETHERNET=y | ||
544 | CONFIG_MII=y | ||
545 | # CONFIG_STNIC is not set | ||
546 | CONFIG_SMC91X=y | ||
547 | |||
548 | # | ||
549 | # Ethernet (1000 Mbit) | ||
550 | # | ||
551 | |||
552 | # | ||
553 | # Ethernet (10000 Mbit) | ||
554 | # | ||
555 | |||
556 | # | ||
557 | # Token Ring devices | ||
558 | # | ||
559 | |||
560 | # | ||
561 | # Wireless LAN (non-hamradio) | ||
562 | # | ||
563 | # CONFIG_NET_RADIO is not set | ||
564 | |||
565 | # | ||
566 | # Wan interfaces | ||
567 | # | ||
568 | # CONFIG_WAN is not set | ||
569 | # CONFIG_PPP is not set | ||
570 | # CONFIG_SLIP is not set | ||
571 | # CONFIG_SHAPER is not set | ||
572 | # CONFIG_NETCONSOLE is not set | ||
523 | # CONFIG_NETPOLL is not set | 573 | # CONFIG_NETPOLL is not set |
524 | # CONFIG_NET_POLL_CONTROLLER is not set | 574 | # CONFIG_NET_POLL_CONTROLLER is not set |
525 | 575 | ||
@@ -536,7 +586,26 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 | |||
536 | # | 586 | # |
537 | # Input device support | 587 | # Input device support |
538 | # | 588 | # |
539 | # CONFIG_INPUT is not set | 589 | CONFIG_INPUT=y |
590 | # CONFIG_INPUT_FF_MEMLESS is not set | ||
591 | |||
592 | # | ||
593 | # Userland interfaces | ||
594 | # | ||
595 | # CONFIG_INPUT_MOUSEDEV is not set | ||
596 | # CONFIG_INPUT_JOYDEV is not set | ||
597 | # CONFIG_INPUT_TSDEV is not set | ||
598 | # CONFIG_INPUT_EVDEV is not set | ||
599 | # CONFIG_INPUT_EVBUG is not set | ||
600 | |||
601 | # | ||
602 | # Input Device Drivers | ||
603 | # | ||
604 | # CONFIG_INPUT_KEYBOARD is not set | ||
605 | # CONFIG_INPUT_MOUSE is not set | ||
606 | # CONFIG_INPUT_JOYSTICK is not set | ||
607 | # CONFIG_INPUT_TOUCHSCREEN is not set | ||
608 | # CONFIG_INPUT_MISC is not set | ||
540 | 609 | ||
541 | # | 610 | # |
542 | # Hardware I/O ports | 611 | # Hardware I/O ports |
@@ -564,8 +633,7 @@ CONFIG_SERIAL_SH_SCI_CONSOLE=y | |||
564 | CONFIG_SERIAL_CORE=y | 633 | CONFIG_SERIAL_CORE=y |
565 | CONFIG_SERIAL_CORE_CONSOLE=y | 634 | CONFIG_SERIAL_CORE_CONSOLE=y |
566 | # CONFIG_UNIX98_PTYS is not set | 635 | # CONFIG_UNIX98_PTYS is not set |
567 | CONFIG_LEGACY_PTYS=y | 636 | # CONFIG_LEGACY_PTYS is not set |
568 | CONFIG_LEGACY_PTY_COUNT=256 | ||
569 | 637 | ||
570 | # | 638 | # |
571 | # IPMI | 639 | # IPMI |
@@ -576,7 +644,7 @@ CONFIG_LEGACY_PTY_COUNT=256 | |||
576 | # Watchdog Cards | 644 | # Watchdog Cards |
577 | # | 645 | # |
578 | # CONFIG_WATCHDOG is not set | 646 | # CONFIG_WATCHDOG is not set |
579 | CONFIG_HW_RANDOM=y | 647 | # CONFIG_HW_RANDOM is not set |
580 | # CONFIG_GEN_RTC is not set | 648 | # CONFIG_GEN_RTC is not set |
581 | # CONFIG_DTLK is not set | 649 | # CONFIG_DTLK is not set |
582 | # CONFIG_R3964 is not set | 650 | # CONFIG_R3964 is not set |
@@ -610,12 +678,8 @@ CONFIG_HW_RANDOM=y | |||
610 | # | 678 | # |
611 | # Hardware Monitoring support | 679 | # Hardware Monitoring support |
612 | # | 680 | # |
613 | CONFIG_HWMON=y | 681 | # CONFIG_HWMON is not set |
614 | # CONFIG_HWMON_VID is not set | 682 | # CONFIG_HWMON_VID is not set |
615 | # CONFIG_SENSORS_ABITUGURU is not set | ||
616 | # CONFIG_SENSORS_F71805F is not set | ||
617 | # CONFIG_SENSORS_VT1211 is not set | ||
618 | # CONFIG_HWMON_DEBUG_CHIP is not set | ||
619 | 683 | ||
620 | # | 684 | # |
621 | # Multimedia devices | 685 | # Multimedia devices |
@@ -630,7 +694,7 @@ CONFIG_HWMON=y | |||
630 | # | 694 | # |
631 | # Graphics support | 695 | # Graphics support |
632 | # | 696 | # |
633 | CONFIG_FIRMWARE_EDID=y | 697 | # CONFIG_FIRMWARE_EDID is not set |
634 | # CONFIG_FB is not set | 698 | # CONFIG_FB is not set |
635 | 699 | ||
636 | # | 700 | # |
@@ -701,8 +765,7 @@ CONFIG_FIRMWARE_EDID=y | |||
701 | # | 765 | # |
702 | # File systems | 766 | # File systems |
703 | # | 767 | # |
704 | CONFIG_EXT2_FS=y | 768 | # CONFIG_EXT2_FS is not set |
705 | # CONFIG_EXT2_FS_XATTR is not set | ||
706 | # CONFIG_EXT3_FS is not set | 769 | # CONFIG_EXT3_FS is not set |
707 | # CONFIG_EXT4DEV_FS is not set | 770 | # CONFIG_EXT4DEV_FS is not set |
708 | # CONFIG_REISERFS_FS is not set | 771 | # CONFIG_REISERFS_FS is not set |
@@ -755,7 +818,7 @@ CONFIG_RAMFS=y | |||
755 | # CONFIG_EFS_FS is not set | 818 | # CONFIG_EFS_FS is not set |
756 | # CONFIG_JFFS_FS is not set | 819 | # CONFIG_JFFS_FS is not set |
757 | # CONFIG_JFFS2_FS is not set | 820 | # CONFIG_JFFS2_FS is not set |
758 | CONFIG_CRAMFS=y | 821 | # CONFIG_CRAMFS is not set |
759 | # CONFIG_VXFS_FS is not set | 822 | # CONFIG_VXFS_FS is not set |
760 | # CONFIG_HPFS_FS is not set | 823 | # CONFIG_HPFS_FS is not set |
761 | # CONFIG_QNX4FS_FS is not set | 824 | # CONFIG_QNX4FS_FS is not set |
@@ -793,8 +856,9 @@ CONFIG_MSDOS_PARTITION=y | |||
793 | # | 856 | # |
794 | # Kernel hacking | 857 | # Kernel hacking |
795 | # | 858 | # |
859 | CONFIG_TRACE_IRQFLAGS_SUPPORT=y | ||
796 | # CONFIG_PRINTK_TIME is not set | 860 | # CONFIG_PRINTK_TIME is not set |
797 | CONFIG_ENABLE_MUST_CHECK=y | 861 | # CONFIG_ENABLE_MUST_CHECK is not set |
798 | # CONFIG_MAGIC_SYSRQ is not set | 862 | # CONFIG_MAGIC_SYSRQ is not set |
799 | # CONFIG_UNUSED_SYMBOLS is not set | 863 | # CONFIG_UNUSED_SYMBOLS is not set |
800 | # CONFIG_DEBUG_KERNEL is not set | 864 | # CONFIG_DEBUG_KERNEL is not set |
@@ -819,7 +883,7 @@ CONFIG_LOG_BUF_SHIFT=14 | |||
819 | # | 883 | # |
820 | # Library routines | 884 | # Library routines |
821 | # | 885 | # |
822 | CONFIG_CRC_CCITT=y | 886 | # CONFIG_CRC_CCITT is not set |
823 | # CONFIG_CRC16 is not set | 887 | # CONFIG_CRC16 is not set |
824 | CONFIG_CRC32=y | 888 | CONFIG_CRC32=y |
825 | # CONFIG_LIBCRC32C is not set | 889 | # CONFIG_LIBCRC32C is not set |
diff --git a/arch/sh/configs/se7619_defconfig b/arch/sh/configs/se7619_defconfig new file mode 100644 index 000000000000..20ac7f4c53fb --- /dev/null +++ b/arch/sh/configs/se7619_defconfig | |||
@@ -0,0 +1,744 @@ | |||
1 | # | ||
2 | # Automatically generated make config: don't edit | ||
3 | # Linux kernel version: 2.6.19 | ||
4 | # Wed Dec 6 16:35:36 2006 | ||
5 | # | ||
6 | CONFIG_SUPERH=y | ||
7 | CONFIG_RWSEM_GENERIC_SPINLOCK=y | ||
8 | CONFIG_GENERIC_FIND_NEXT_BIT=y | ||
9 | CONFIG_GENERIC_HWEIGHT=y | ||
10 | CONFIG_GENERIC_HARDIRQS=y | ||
11 | CONFIG_GENERIC_IRQ_PROBE=y | ||
12 | CONFIG_GENERIC_CALIBRATE_DELAY=y | ||
13 | # CONFIG_GENERIC_TIME is not set | ||
14 | CONFIG_STACKTRACE_SUPPORT=y | ||
15 | CONFIG_LOCKDEP_SUPPORT=y | ||
16 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" | ||
17 | |||
18 | # | ||
19 | # Code maturity level options | ||
20 | # | ||
21 | CONFIG_EXPERIMENTAL=y | ||
22 | CONFIG_BROKEN_ON_SMP=y | ||
23 | CONFIG_INIT_ENV_ARG_LIMIT=32 | ||
24 | |||
25 | # | ||
26 | # General setup | ||
27 | # | ||
28 | CONFIG_LOCALVERSION="" | ||
29 | # CONFIG_LOCALVERSION_AUTO is not set | ||
30 | # CONFIG_SYSVIPC is not set | ||
31 | # CONFIG_BSD_PROCESS_ACCT is not set | ||
32 | # CONFIG_UTS_NS is not set | ||
33 | # CONFIG_IKCONFIG is not set | ||
34 | # CONFIG_RELAY is not set | ||
35 | CONFIG_INITRAMFS_SOURCE="" | ||
36 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y | ||
37 | CONFIG_SYSCTL=y | ||
38 | CONFIG_EMBEDDED=y | ||
39 | # CONFIG_UID16 is not set | ||
40 | # CONFIG_SYSCTL_SYSCALL is not set | ||
41 | # CONFIG_KALLSYMS is not set | ||
42 | # CONFIG_HOTPLUG is not set | ||
43 | CONFIG_PRINTK=y | ||
44 | CONFIG_BUG=y | ||
45 | # CONFIG_ELF_CORE is not set | ||
46 | # CONFIG_BASE_FULL is not set | ||
47 | # CONFIG_FUTEX is not set | ||
48 | # CONFIG_EPOLL is not set | ||
49 | CONFIG_SLAB=y | ||
50 | # CONFIG_VM_EVENT_COUNTERS is not set | ||
51 | CONFIG_TINY_SHMEM=y | ||
52 | CONFIG_BASE_SMALL=1 | ||
53 | # CONFIG_SLOB is not set | ||
54 | |||
55 | # | ||
56 | # Loadable module support | ||
57 | # | ||
58 | # CONFIG_MODULES is not set | ||
59 | |||
60 | # | ||
61 | # Block layer | ||
62 | # | ||
63 | CONFIG_BLOCK=y | ||
64 | # CONFIG_LBD is not set | ||
65 | # CONFIG_LSF is not set | ||
66 | |||
67 | # | ||
68 | # IO Schedulers | ||
69 | # | ||
70 | CONFIG_IOSCHED_NOOP=y | ||
71 | # CONFIG_IOSCHED_AS is not set | ||
72 | # CONFIG_IOSCHED_DEADLINE is not set | ||
73 | # CONFIG_IOSCHED_CFQ is not set | ||
74 | # CONFIG_DEFAULT_AS is not set | ||
75 | # CONFIG_DEFAULT_DEADLINE is not set | ||
76 | # CONFIG_DEFAULT_CFQ is not set | ||
77 | CONFIG_DEFAULT_NOOP=y | ||
78 | CONFIG_DEFAULT_IOSCHED="noop" | ||
79 | |||
80 | # | ||
81 | # System type | ||
82 | # | ||
83 | # CONFIG_SH_SOLUTION_ENGINE is not set | ||
84 | # CONFIG_SH_7751_SOLUTION_ENGINE is not set | ||
85 | # CONFIG_SH_7300_SOLUTION_ENGINE is not set | ||
86 | # CONFIG_SH_7343_SOLUTION_ENGINE is not set | ||
87 | # CONFIG_SH_73180_SOLUTION_ENGINE is not set | ||
88 | # CONFIG_SH_7751_SYSTEMH is not set | ||
89 | # CONFIG_SH_HP6XX is not set | ||
90 | # CONFIG_SH_EC3104 is not set | ||
91 | # CONFIG_SH_SATURN is not set | ||
92 | # CONFIG_SH_DREAMCAST is not set | ||
93 | # CONFIG_SH_BIGSUR is not set | ||
94 | # CONFIG_SH_MPC1211 is not set | ||
95 | # CONFIG_SH_SH03 is not set | ||
96 | # CONFIG_SH_SECUREEDGE5410 is not set | ||
97 | # CONFIG_SH_HS7751RVOIP is not set | ||
98 | # CONFIG_SH_7710VOIPGW is not set | ||
99 | # CONFIG_SH_RTS7751R2D is not set | ||
100 | # CONFIG_SH_R7780RP is not set | ||
101 | # CONFIG_SH_EDOSK7705 is not set | ||
102 | # CONFIG_SH_SH4202_MICRODEV is not set | ||
103 | # CONFIG_SH_LANDISK is not set | ||
104 | # CONFIG_SH_TITAN is not set | ||
105 | # CONFIG_SH_SHMIN is not set | ||
106 | # CONFIG_SH_7206_SOLUTION_ENGINE is not set | ||
107 | CONFIG_SH_7619_SOLUTION_ENGINE=y | ||
108 | # CONFIG_SH_UNKNOWN is not set | ||
109 | |||
110 | # | ||
111 | # Processor selection | ||
112 | # | ||
113 | CONFIG_CPU_SH2=y | ||
114 | |||
115 | # | ||
116 | # SH-2 Processor Support | ||
117 | # | ||
118 | # CONFIG_CPU_SUBTYPE_SH7604 is not set | ||
119 | CONFIG_CPU_SUBTYPE_SH7619=y | ||
120 | |||
121 | # | ||
122 | # SH-2A Processor Support | ||
123 | # | ||
124 | # CONFIG_CPU_SUBTYPE_SH7206 is not set | ||
125 | |||
126 | # | ||
127 | # SH-3 Processor Support | ||
128 | # | ||
129 | # CONFIG_CPU_SUBTYPE_SH7300 is not set | ||
130 | # CONFIG_CPU_SUBTYPE_SH7705 is not set | ||
131 | # CONFIG_CPU_SUBTYPE_SH7706 is not set | ||
132 | # CONFIG_CPU_SUBTYPE_SH7707 is not set | ||
133 | # CONFIG_CPU_SUBTYPE_SH7708 is not set | ||
134 | # CONFIG_CPU_SUBTYPE_SH7709 is not set | ||
135 | # CONFIG_CPU_SUBTYPE_SH7710 is not set | ||
136 | |||
137 | # | ||
138 | # SH-4 Processor Support | ||
139 | # | ||
140 | # CONFIG_CPU_SUBTYPE_SH7750 is not set | ||
141 | # CONFIG_CPU_SUBTYPE_SH7091 is not set | ||
142 | # CONFIG_CPU_SUBTYPE_SH7750R is not set | ||
143 | # CONFIG_CPU_SUBTYPE_SH7750S is not set | ||
144 | # CONFIG_CPU_SUBTYPE_SH7751 is not set | ||
145 | # CONFIG_CPU_SUBTYPE_SH7751R is not set | ||
146 | # CONFIG_CPU_SUBTYPE_SH7760 is not set | ||
147 | # CONFIG_CPU_SUBTYPE_SH4_202 is not set | ||
148 | |||
149 | # | ||
150 | # ST40 Processor Support | ||
151 | # | ||
152 | # CONFIG_CPU_SUBTYPE_ST40STB1 is not set | ||
153 | # CONFIG_CPU_SUBTYPE_ST40GX1 is not set | ||
154 | |||
155 | # | ||
156 | # SH-4A Processor Support | ||
157 | # | ||
158 | # CONFIG_CPU_SUBTYPE_SH7770 is not set | ||
159 | # CONFIG_CPU_SUBTYPE_SH7780 is not set | ||
160 | # CONFIG_CPU_SUBTYPE_SH7785 is not set | ||
161 | |||
162 | # | ||
163 | # SH4AL-DSP Processor Support | ||
164 | # | ||
165 | # CONFIG_CPU_SUBTYPE_SH73180 is not set | ||
166 | # CONFIG_CPU_SUBTYPE_SH7343 is not set | ||
167 | |||
168 | # | ||
169 | # Memory management options | ||
170 | # | ||
171 | CONFIG_PAGE_OFFSET=0x00000000 | ||
172 | CONFIG_MEMORY_START=0x0c000000 | ||
173 | CONFIG_MEMORY_SIZE=0x04000000 | ||
174 | CONFIG_PAGE_SIZE_4KB=y | ||
175 | # CONFIG_PAGE_SIZE_8KB is not set | ||
176 | # CONFIG_PAGE_SIZE_64KB is not set | ||
177 | CONFIG_SELECT_MEMORY_MODEL=y | ||
178 | CONFIG_FLATMEM_MANUAL=y | ||
179 | # CONFIG_DISCONTIGMEM_MANUAL is not set | ||
180 | # CONFIG_SPARSEMEM_MANUAL is not set | ||
181 | CONFIG_FLATMEM=y | ||
182 | CONFIG_FLAT_NODE_MEM_MAP=y | ||
183 | # CONFIG_SPARSEMEM_STATIC is not set | ||
184 | CONFIG_SPLIT_PTLOCK_CPUS=4 | ||
185 | # CONFIG_RESOURCES_64BIT is not set | ||
186 | |||
187 | # | ||
188 | # Cache configuration | ||
189 | # | ||
190 | # CONFIG_SH_DIRECT_MAPPED is not set | ||
191 | CONFIG_SH_WRITETHROUGH=y | ||
192 | # CONFIG_SH_OCRAM is not set | ||
193 | |||
194 | # | ||
195 | # Processor features | ||
196 | # | ||
197 | # CONFIG_CPU_LITTLE_ENDIAN is not set | ||
198 | CONFIG_CPU_BIG_ENDIAN=y | ||
199 | # CONFIG_SH_FPU is not set | ||
200 | # CONFIG_SH_FPU_EMU is not set | ||
201 | # CONFIG_SH_DSP is not set | ||
202 | |||
203 | # | ||
204 | # Timer support | ||
205 | # | ||
206 | CONFIG_SH_CMT=y | ||
207 | CONFIG_SH_TIMER_IRQ=86 | ||
208 | # CONFIG_NO_IDLE_HZ is not set | ||
209 | CONFIG_SH_PCLK_FREQ=31250000 | ||
210 | CONFIG_SH_CLK_MD=5 | ||
211 | |||
212 | # | ||
213 | # CPU Frequency scaling | ||
214 | # | ||
215 | # CONFIG_CPU_FREQ is not set | ||
216 | |||
217 | # | ||
218 | # DMA support | ||
219 | # | ||
220 | # CONFIG_SH_DMA is not set | ||
221 | |||
222 | # | ||
223 | # Companion Chips | ||
224 | # | ||
225 | # CONFIG_HD6446X_SERIES is not set | ||
226 | |||
227 | # | ||
228 | # Additional SuperH Device Drivers | ||
229 | # | ||
230 | # CONFIG_PUSH_SWITCH is not set | ||
231 | |||
232 | # | ||
233 | # Kernel features | ||
234 | # | ||
235 | CONFIG_HZ_100=y | ||
236 | # CONFIG_HZ_250 is not set | ||
237 | # CONFIG_HZ_1000 is not set | ||
238 | CONFIG_HZ=100 | ||
239 | # CONFIG_KEXEC is not set | ||
240 | # CONFIG_SMP is not set | ||
241 | CONFIG_PREEMPT_NONE=y | ||
242 | # CONFIG_PREEMPT_VOLUNTARY is not set | ||
243 | # CONFIG_PREEMPT is not set | ||
244 | |||
245 | # | ||
246 | # Boot options | ||
247 | # | ||
248 | CONFIG_ZERO_PAGE_OFFSET=0x00001000 | ||
249 | CONFIG_BOOT_LINK_OFFSET=0x00800000 | ||
250 | # CONFIG_UBC_WAKEUP is not set | ||
251 | # CONFIG_CMDLINE_BOOL is not set | ||
252 | |||
253 | # | ||
254 | # Bus options | ||
255 | # | ||
256 | # CONFIG_PCI is not set | ||
257 | |||
258 | # | ||
259 | # PCCARD (PCMCIA/CardBus) support | ||
260 | # | ||
261 | |||
262 | # | ||
263 | # PCI Hotplug Support | ||
264 | # | ||
265 | |||
266 | # | ||
267 | # Executable file formats | ||
268 | # | ||
269 | CONFIG_BINFMT_FLAT=y | ||
270 | CONFIG_BINFMT_ZFLAT=y | ||
271 | # CONFIG_BINFMT_SHARED_FLAT is not set | ||
272 | # CONFIG_BINFMT_MISC is not set | ||
273 | |||
274 | # | ||
275 | # Power management options (EXPERIMENTAL) | ||
276 | # | ||
277 | # CONFIG_PM is not set | ||
278 | |||
279 | # | ||
280 | # Networking | ||
281 | # | ||
282 | # CONFIG_NET is not set | ||
283 | |||
284 | # | ||
285 | # Device Drivers | ||
286 | # | ||
287 | |||
288 | # | ||
289 | # Generic Driver Options | ||
290 | # | ||
291 | # CONFIG_STANDALONE is not set | ||
292 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set | ||
293 | # CONFIG_SYS_HYPERVISOR is not set | ||
294 | |||
295 | # | ||
296 | # Connector - unified userspace <-> kernelspace linker | ||
297 | # | ||
298 | |||
299 | # | ||
300 | # Memory Technology Devices (MTD) | ||
301 | # | ||
302 | CONFIG_MTD=y | ||
303 | # CONFIG_MTD_DEBUG is not set | ||
304 | CONFIG_MTD_CONCAT=y | ||
305 | CONFIG_MTD_PARTITIONS=y | ||
306 | CONFIG_MTD_REDBOOT_PARTS=y | ||
307 | CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1 | ||
308 | # CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set | ||
309 | # CONFIG_MTD_REDBOOT_PARTS_READONLY is not set | ||
310 | # CONFIG_MTD_CMDLINE_PARTS is not set | ||
311 | |||
312 | # | ||
313 | # User Modules And Translation Layers | ||
314 | # | ||
315 | CONFIG_MTD_CHAR=y | ||
316 | CONFIG_MTD_BLOCK=y | ||
317 | # CONFIG_FTL is not set | ||
318 | # CONFIG_NFTL is not set | ||
319 | # CONFIG_INFTL is not set | ||
320 | # CONFIG_RFD_FTL is not set | ||
321 | # CONFIG_SSFDC is not set | ||
322 | |||
323 | # | ||
324 | # RAM/ROM/Flash chip drivers | ||
325 | # | ||
326 | CONFIG_MTD_CFI=y | ||
327 | # CONFIG_MTD_JEDECPROBE is not set | ||
328 | CONFIG_MTD_GEN_PROBE=y | ||
329 | # CONFIG_MTD_CFI_ADV_OPTIONS is not set | ||
330 | CONFIG_MTD_MAP_BANK_WIDTH_1=y | ||
331 | CONFIG_MTD_MAP_BANK_WIDTH_2=y | ||
332 | CONFIG_MTD_MAP_BANK_WIDTH_4=y | ||
333 | # CONFIG_MTD_MAP_BANK_WIDTH_8 is not set | ||
334 | # CONFIG_MTD_MAP_BANK_WIDTH_16 is not set | ||
335 | # CONFIG_MTD_MAP_BANK_WIDTH_32 is not set | ||
336 | CONFIG_MTD_CFI_I1=y | ||
337 | CONFIG_MTD_CFI_I2=y | ||
338 | # CONFIG_MTD_CFI_I4 is not set | ||
339 | # CONFIG_MTD_CFI_I8 is not set | ||
340 | # CONFIG_MTD_CFI_INTELEXT is not set | ||
341 | CONFIG_MTD_CFI_AMDSTD=y | ||
342 | # CONFIG_MTD_CFI_STAA is not set | ||
343 | CONFIG_MTD_CFI_UTIL=y | ||
344 | # CONFIG_MTD_RAM is not set | ||
345 | # CONFIG_MTD_ROM is not set | ||
346 | # CONFIG_MTD_ABSENT is not set | ||
347 | # CONFIG_MTD_OBSOLETE_CHIPS is not set | ||
348 | |||
349 | # | ||
350 | # Mapping drivers for chip access | ||
351 | # | ||
352 | # CONFIG_MTD_COMPLEX_MAPPINGS is not set | ||
353 | CONFIG_MTD_PHYSMAP=y | ||
354 | CONFIG_MTD_PHYSMAP_START=0xa0000000 | ||
355 | CONFIG_MTD_PHYSMAP_LEN=0x01000000 | ||
356 | CONFIG_MTD_PHYSMAP_BANKWIDTH=2 | ||
357 | # CONFIG_MTD_SOLUTIONENGINE is not set | ||
358 | # CONFIG_MTD_UCLINUX is not set | ||
359 | # CONFIG_MTD_PLATRAM is not set | ||
360 | |||
361 | # | ||
362 | # Self-contained MTD device drivers | ||
363 | # | ||
364 | # CONFIG_MTD_SLRAM is not set | ||
365 | # CONFIG_MTD_PHRAM is not set | ||
366 | # CONFIG_MTD_MTDRAM is not set | ||
367 | # CONFIG_MTD_BLOCK2MTD is not set | ||
368 | |||
369 | # | ||
370 | # Disk-On-Chip Device Drivers | ||
371 | # | ||
372 | # CONFIG_MTD_DOC2000 is not set | ||
373 | # CONFIG_MTD_DOC2001 is not set | ||
374 | # CONFIG_MTD_DOC2001PLUS is not set | ||
375 | |||
376 | # | ||
377 | # NAND Flash Device Drivers | ||
378 | # | ||
379 | # CONFIG_MTD_NAND is not set | ||
380 | |||
381 | # | ||
382 | # OneNAND Flash Device Drivers | ||
383 | # | ||
384 | # CONFIG_MTD_ONENAND is not set | ||
385 | |||
386 | # | ||
387 | # Parallel port support | ||
388 | # | ||
389 | # CONFIG_PARPORT is not set | ||
390 | |||
391 | # | ||
392 | # Plug and Play support | ||
393 | # | ||
394 | |||
395 | # | ||
396 | # Block devices | ||
397 | # | ||
398 | # CONFIG_BLK_DEV_COW_COMMON is not set | ||
399 | # CONFIG_BLK_DEV_LOOP is not set | ||
400 | # CONFIG_BLK_DEV_RAM is not set | ||
401 | # CONFIG_BLK_DEV_INITRD is not set | ||
402 | # CONFIG_CDROM_PKTCDVD is not set | ||
403 | |||
404 | # | ||
405 | # Misc devices | ||
406 | # | ||
407 | # CONFIG_TIFM_CORE is not set | ||
408 | |||
409 | # | ||
410 | # ATA/ATAPI/MFM/RLL support | ||
411 | # | ||
412 | # CONFIG_IDE is not set | ||
413 | |||
414 | # | ||
415 | # SCSI device support | ||
416 | # | ||
417 | # CONFIG_RAID_ATTRS is not set | ||
418 | # CONFIG_SCSI is not set | ||
419 | # CONFIG_SCSI_NETLINK is not set | ||
420 | |||
421 | # | ||
422 | # Serial ATA (prod) and Parallel ATA (experimental) drivers | ||
423 | # | ||
424 | # CONFIG_ATA is not set | ||
425 | |||
426 | # | ||
427 | # Multi-device support (RAID and LVM) | ||
428 | # | ||
429 | # CONFIG_MD is not set | ||
430 | |||
431 | # | ||
432 | # Fusion MPT device support | ||
433 | # | ||
434 | # CONFIG_FUSION is not set | ||
435 | |||
436 | # | ||
437 | # IEEE 1394 (FireWire) support | ||
438 | # | ||
439 | |||
440 | # | ||
441 | # I2O device support | ||
442 | # | ||
443 | |||
444 | # | ||
445 | # ISDN subsystem | ||
446 | # | ||
447 | |||
448 | # | ||
449 | # Telephony Support | ||
450 | # | ||
451 | # CONFIG_PHONE is not set | ||
452 | |||
453 | # | ||
454 | # Input device support | ||
455 | # | ||
456 | CONFIG_INPUT=y | ||
457 | # CONFIG_INPUT_FF_MEMLESS is not set | ||
458 | |||
459 | # | ||
460 | # Userland interfaces | ||
461 | # | ||
462 | # CONFIG_INPUT_MOUSEDEV is not set | ||
463 | # CONFIG_INPUT_JOYDEV is not set | ||
464 | # CONFIG_INPUT_TSDEV is not set | ||
465 | # CONFIG_INPUT_EVDEV is not set | ||
466 | # CONFIG_INPUT_EVBUG is not set | ||
467 | |||
468 | # | ||
469 | # Input Device Drivers | ||
470 | # | ||
471 | # CONFIG_INPUT_KEYBOARD is not set | ||
472 | # CONFIG_INPUT_MOUSE is not set | ||
473 | # CONFIG_INPUT_JOYSTICK is not set | ||
474 | # CONFIG_INPUT_TOUCHSCREEN is not set | ||
475 | # CONFIG_INPUT_MISC is not set | ||
476 | |||
477 | # | ||
478 | # Hardware I/O ports | ||
479 | # | ||
480 | # CONFIG_SERIO is not set | ||
481 | # CONFIG_GAMEPORT is not set | ||
482 | |||
483 | # | ||
484 | # Character devices | ||
485 | # | ||
486 | # CONFIG_VT is not set | ||
487 | # CONFIG_SERIAL_NONSTANDARD is not set | ||
488 | |||
489 | # | ||
490 | # Serial drivers | ||
491 | # | ||
492 | # CONFIG_SERIAL_8250 is not set | ||
493 | |||
494 | # | ||
495 | # Non-8250 serial port support | ||
496 | # | ||
497 | CONFIG_SERIAL_SH_SCI=y | ||
498 | CONFIG_SERIAL_SH_SCI_NR_UARTS=3 | ||
499 | CONFIG_SERIAL_SH_SCI_CONSOLE=y | ||
500 | CONFIG_SERIAL_CORE=y | ||
501 | CONFIG_SERIAL_CORE_CONSOLE=y | ||
502 | # CONFIG_UNIX98_PTYS is not set | ||
503 | # CONFIG_LEGACY_PTYS is not set | ||
504 | |||
505 | # | ||
506 | # IPMI | ||
507 | # | ||
508 | # CONFIG_IPMI_HANDLER is not set | ||
509 | |||
510 | # | ||
511 | # Watchdog Cards | ||
512 | # | ||
513 | # CONFIG_WATCHDOG is not set | ||
514 | # CONFIG_HW_RANDOM is not set | ||
515 | # CONFIG_GEN_RTC is not set | ||
516 | # CONFIG_DTLK is not set | ||
517 | # CONFIG_R3964 is not set | ||
518 | |||
519 | # | ||
520 | # Ftape, the floppy tape device driver | ||
521 | # | ||
522 | # CONFIG_RAW_DRIVER is not set | ||
523 | |||
524 | # | ||
525 | # TPM devices | ||
526 | # | ||
527 | # CONFIG_TCG_TPM is not set | ||
528 | |||
529 | # | ||
530 | # I2C support | ||
531 | # | ||
532 | # CONFIG_I2C is not set | ||
533 | |||
534 | # | ||
535 | # SPI support | ||
536 | # | ||
537 | # CONFIG_SPI is not set | ||
538 | # CONFIG_SPI_MASTER is not set | ||
539 | |||
540 | # | ||
541 | # Dallas's 1-wire bus | ||
542 | # | ||
543 | # CONFIG_W1 is not set | ||
544 | |||
545 | # | ||
546 | # Hardware Monitoring support | ||
547 | # | ||
548 | # CONFIG_HWMON is not set | ||
549 | # CONFIG_HWMON_VID is not set | ||
550 | |||
551 | # | ||
552 | # Multimedia devices | ||
553 | # | ||
554 | # CONFIG_VIDEO_DEV is not set | ||
555 | |||
556 | # | ||
557 | # Digital Video Broadcasting Devices | ||
558 | # | ||
559 | |||
560 | # | ||
561 | # Graphics support | ||
562 | # | ||
563 | # CONFIG_FIRMWARE_EDID is not set | ||
564 | # CONFIG_FB is not set | ||
565 | |||
566 | # | ||
567 | # Sound | ||
568 | # | ||
569 | # CONFIG_SOUND is not set | ||
570 | |||
571 | # | ||
572 | # USB support | ||
573 | # | ||
574 | # CONFIG_USB_ARCH_HAS_HCD is not set | ||
575 | # CONFIG_USB_ARCH_HAS_OHCI is not set | ||
576 | # CONFIG_USB_ARCH_HAS_EHCI is not set | ||
577 | |||
578 | # | ||
579 | # NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' | ||
580 | # | ||
581 | |||
582 | # | ||
583 | # USB Gadget Support | ||
584 | # | ||
585 | # CONFIG_USB_GADGET is not set | ||
586 | |||
587 | # | ||
588 | # MMC/SD Card support | ||
589 | # | ||
590 | # CONFIG_MMC is not set | ||
591 | |||
592 | # | ||
593 | # LED devices | ||
594 | # | ||
595 | # CONFIG_NEW_LEDS is not set | ||
596 | |||
597 | # | ||
598 | # LED drivers | ||
599 | # | ||
600 | |||
601 | # | ||
602 | # LED Triggers | ||
603 | # | ||
604 | |||
605 | # | ||
606 | # InfiniBand support | ||
607 | # | ||
608 | |||
609 | # | ||
610 | # EDAC - error detection and reporting (RAS) (EXPERIMENTAL) | ||
611 | # | ||
612 | |||
613 | # | ||
614 | # Real Time Clock | ||
615 | # | ||
616 | # CONFIG_RTC_CLASS is not set | ||
617 | |||
618 | # | ||
619 | # DMA Engine support | ||
620 | # | ||
621 | # CONFIG_DMA_ENGINE is not set | ||
622 | |||
623 | # | ||
624 | # DMA Clients | ||
625 | # | ||
626 | |||
627 | # | ||
628 | # DMA Devices | ||
629 | # | ||
630 | |||
631 | # | ||
632 | # File systems | ||
633 | # | ||
634 | # CONFIG_EXT2_FS is not set | ||
635 | # CONFIG_EXT3_FS is not set | ||
636 | # CONFIG_EXT4DEV_FS is not set | ||
637 | # CONFIG_REISERFS_FS is not set | ||
638 | # CONFIG_JFS_FS is not set | ||
639 | # CONFIG_FS_POSIX_ACL is not set | ||
640 | # CONFIG_XFS_FS is not set | ||
641 | # CONFIG_GFS2_FS is not set | ||
642 | # CONFIG_MINIX_FS is not set | ||
643 | CONFIG_ROMFS_FS=y | ||
644 | # CONFIG_INOTIFY is not set | ||
645 | # CONFIG_QUOTA is not set | ||
646 | # CONFIG_DNOTIFY is not set | ||
647 | # CONFIG_AUTOFS_FS is not set | ||
648 | # CONFIG_AUTOFS4_FS is not set | ||
649 | # CONFIG_FUSE_FS is not set | ||
650 | |||
651 | # | ||
652 | # CD-ROM/DVD Filesystems | ||
653 | # | ||
654 | # CONFIG_ISO9660_FS is not set | ||
655 | # CONFIG_UDF_FS is not set | ||
656 | |||
657 | # | ||
658 | # DOS/FAT/NT Filesystems | ||
659 | # | ||
660 | # CONFIG_MSDOS_FS is not set | ||
661 | # CONFIG_VFAT_FS is not set | ||
662 | # CONFIG_NTFS_FS is not set | ||
663 | |||
664 | # | ||
665 | # Pseudo filesystems | ||
666 | # | ||
667 | CONFIG_PROC_FS=y | ||
668 | CONFIG_PROC_SYSCTL=y | ||
669 | # CONFIG_SYSFS is not set | ||
670 | # CONFIG_TMPFS is not set | ||
671 | # CONFIG_HUGETLBFS is not set | ||
672 | # CONFIG_HUGETLB_PAGE is not set | ||
673 | CONFIG_RAMFS=y | ||
674 | |||
675 | # | ||
676 | # Miscellaneous filesystems | ||
677 | # | ||
678 | # CONFIG_ADFS_FS is not set | ||
679 | # CONFIG_AFFS_FS is not set | ||
680 | # CONFIG_HFS_FS is not set | ||
681 | # CONFIG_HFSPLUS_FS is not set | ||
682 | # CONFIG_BEFS_FS is not set | ||
683 | # CONFIG_BFS_FS is not set | ||
684 | # CONFIG_EFS_FS is not set | ||
685 | # CONFIG_JFFS_FS is not set | ||
686 | # CONFIG_JFFS2_FS is not set | ||
687 | # CONFIG_CRAMFS is not set | ||
688 | # CONFIG_VXFS_FS is not set | ||
689 | # CONFIG_HPFS_FS is not set | ||
690 | # CONFIG_QNX4FS_FS is not set | ||
691 | # CONFIG_SYSV_FS is not set | ||
692 | # CONFIG_UFS_FS is not set | ||
693 | |||
694 | # | ||
695 | # Partition Types | ||
696 | # | ||
697 | # CONFIG_PARTITION_ADVANCED is not set | ||
698 | CONFIG_MSDOS_PARTITION=y | ||
699 | |||
700 | # | ||
701 | # Native Language Support | ||
702 | # | ||
703 | # CONFIG_NLS is not set | ||
704 | |||
705 | # | ||
706 | # Profiling support | ||
707 | # | ||
708 | # CONFIG_PROFILING is not set | ||
709 | |||
710 | # | ||
711 | # Kernel hacking | ||
712 | # | ||
713 | CONFIG_TRACE_IRQFLAGS_SUPPORT=y | ||
714 | # CONFIG_PRINTK_TIME is not set | ||
715 | # CONFIG_ENABLE_MUST_CHECK is not set | ||
716 | # CONFIG_MAGIC_SYSRQ is not set | ||
717 | # CONFIG_UNUSED_SYMBOLS is not set | ||
718 | # CONFIG_DEBUG_KERNEL is not set | ||
719 | CONFIG_LOG_BUF_SHIFT=14 | ||
720 | # CONFIG_DEBUG_BUGVERBOSE is not set | ||
721 | # CONFIG_UNWIND_INFO is not set | ||
722 | # CONFIG_HEADERS_CHECK is not set | ||
723 | # CONFIG_SH_STANDARD_BIOS is not set | ||
724 | # CONFIG_EARLY_SCIF_CONSOLE is not set | ||
725 | # CONFIG_KGDB is not set | ||
726 | |||
727 | # | ||
728 | # Security options | ||
729 | # | ||
730 | # CONFIG_KEYS is not set | ||
731 | |||
732 | # | ||
733 | # Cryptographic options | ||
734 | # | ||
735 | # CONFIG_CRYPTO is not set | ||
736 | |||
737 | # | ||
738 | # Library routines | ||
739 | # | ||
740 | # CONFIG_CRC_CCITT is not set | ||
741 | # CONFIG_CRC16 is not set | ||
742 | CONFIG_CRC32=y | ||
743 | # CONFIG_LIBCRC32C is not set | ||
744 | CONFIG_ZLIB_INFLATE=y | ||
diff --git a/arch/sh/drivers/push-switch.c b/arch/sh/drivers/push-switch.c index f2b9157c314f..b3d20c0e021f 100644 --- a/arch/sh/drivers/push-switch.c +++ b/arch/sh/drivers/push-switch.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #include <asm/push-switch.h> | 14 | #include <asm/push-switch.h> |
15 | 15 | ||
16 | #define DRV_NAME "push-switch" | 16 | #define DRV_NAME "push-switch" |
17 | #define DRV_VERSION "0.1.0" | 17 | #define DRV_VERSION "0.1.1" |
18 | 18 | ||
19 | static ssize_t switch_show(struct device *dev, | 19 | static ssize_t switch_show(struct device *dev, |
20 | struct device_attribute *attr, | 20 | struct device_attribute *attr, |
@@ -32,10 +32,10 @@ static void switch_timer(unsigned long data) | |||
32 | schedule_work(&psw->work); | 32 | schedule_work(&psw->work); |
33 | } | 33 | } |
34 | 34 | ||
35 | static void switch_work_handler(void *data) | 35 | static void switch_work_handler(struct work_struct *work) |
36 | { | 36 | { |
37 | struct platform_device *pdev = data; | 37 | struct push_switch *psw = container_of(work, struct push_switch, work); |
38 | struct push_switch *psw = platform_get_drvdata(pdev); | 38 | struct platform_device *pdev = psw->pdev; |
39 | 39 | ||
40 | psw->state = 0; | 40 | psw->state = 0; |
41 | 41 | ||
@@ -76,12 +76,15 @@ static int switch_drv_probe(struct platform_device *pdev) | |||
76 | } | 76 | } |
77 | } | 77 | } |
78 | 78 | ||
79 | INIT_WORK(&psw->work, switch_work_handler, pdev); | 79 | INIT_WORK(&psw->work, switch_work_handler); |
80 | init_timer(&psw->debounce); | 80 | init_timer(&psw->debounce); |
81 | 81 | ||
82 | psw->debounce.function = switch_timer; | 82 | psw->debounce.function = switch_timer; |
83 | psw->debounce.data = (unsigned long)psw; | 83 | psw->debounce.data = (unsigned long)psw; |
84 | 84 | ||
85 | /* Workqueue API brain-damage */ | ||
86 | psw->pdev = pdev; | ||
87 | |||
85 | platform_set_drvdata(pdev, psw); | 88 | platform_set_drvdata(pdev, psw); |
86 | 89 | ||
87 | return 0; | 90 | return 0; |
diff --git a/arch/sh/kernel/cpu/Makefile b/arch/sh/kernel/cpu/Makefile index 0582e6712b79..d055a3ea6b4b 100644 --- a/arch/sh/kernel/cpu/Makefile +++ b/arch/sh/kernel/cpu/Makefile | |||
@@ -6,6 +6,7 @@ obj-$(CONFIG_CPU_SH2) = sh2/ | |||
6 | obj-$(CONFIG_CPU_SH2A) = sh2a/ | 6 | obj-$(CONFIG_CPU_SH2A) = sh2a/ |
7 | obj-$(CONFIG_CPU_SH3) = sh3/ | 7 | obj-$(CONFIG_CPU_SH3) = sh3/ |
8 | obj-$(CONFIG_CPU_SH4) = sh4/ | 8 | obj-$(CONFIG_CPU_SH4) = sh4/ |
9 | obj-$(CONFIG_CPU_SH4A) += sh4a/ | ||
9 | 10 | ||
10 | obj-$(CONFIG_UBC_WAKEUP) += ubc.o | 11 | obj-$(CONFIG_UBC_WAKEUP) += ubc.o |
11 | obj-$(CONFIG_SH_ADC) += adc.o | 12 | obj-$(CONFIG_SH_ADC) += adc.o |
diff --git a/arch/sh/kernel/cpu/sh2/entry.S b/arch/sh/kernel/cpu/sh2/entry.S index 34d51b3745ea..d51fa5e9904a 100644 --- a/arch/sh/kernel/cpu/sh2/entry.S +++ b/arch/sh/kernel/cpu/sh2/entry.S | |||
@@ -177,15 +177,21 @@ interrupt_entry: | |||
177 | 7: .long do_IRQ | 177 | 7: .long do_IRQ |
178 | 8: .long do_exception_error | 178 | 8: .long do_exception_error |
179 | 179 | ||
180 | trap_entry: | 180 | trap_entry: |
181 | add #-0x10,r9 | 181 | /* verbose BUG trapa entry check */ |
182 | mov #0x3e,r8 | ||
183 | cmp/ge r8,r9 | ||
184 | bf/s 1f | ||
185 | add #-0x10,r9 | ||
186 | add #0x10,r9 | ||
187 | 1: | ||
182 | shll2 r9 ! TRA | 188 | shll2 r9 ! TRA |
183 | mov #OFF_TRA,r8 | 189 | mov #OFF_TRA,r8 |
184 | add r15,r8 | 190 | add r15,r8 |
185 | mov.l r9,@r8 | 191 | mov.l r9,@r8 |
186 | mov r9,r8 | 192 | mov r9,r8 |
187 | #ifdef CONFIG_TRACE_IRQFLAGS | 193 | #ifdef CONFIG_TRACE_IRQFLAGS |
188 | mov.l 5f, r9 | 194 | mov.l 2f, r9 |
189 | jsr @r9 | 195 | jsr @r9 |
190 | nop | 196 | nop |
191 | #endif | 197 | #endif |
@@ -194,12 +200,8 @@ trap_entry: | |||
194 | nop | 200 | nop |
195 | 201 | ||
196 | .align 2 | 202 | .align 2 |
197 | 1: .long syscall_exit | ||
198 | 2: .long break_point_trap_software | ||
199 | 3: .long NR_syscalls | ||
200 | 4: .long sys_call_table | ||
201 | #ifdef CONFIG_TRACE_IRQFLAGS | 203 | #ifdef CONFIG_TRACE_IRQFLAGS |
202 | 5: .long trace_hardirqs_on | 204 | 2: .long trace_hardirqs_on |
203 | #endif | 205 | #endif |
204 | 206 | ||
205 | #if defined(CONFIG_SH_STANDARD_BIOS) | 207 | #if defined(CONFIG_SH_STANDARD_BIOS) |
@@ -264,7 +266,7 @@ ENTRY(address_error_handler) | |||
264 | restore_all: | 266 | restore_all: |
265 | cli | 267 | cli |
266 | #ifdef CONFIG_TRACE_IRQFLAGS | 268 | #ifdef CONFIG_TRACE_IRQFLAGS |
267 | mov.l 3f, r0 | 269 | mov.l 1f, r0 |
268 | jsr @r0 | 270 | jsr @r0 |
269 | nop | 271 | nop |
270 | #endif | 272 | #endif |
@@ -309,20 +311,14 @@ restore_all: | |||
309 | mov.l @r15,r15 | 311 | mov.l @r15,r15 |
310 | rte | 312 | rte |
311 | nop | 313 | nop |
312 | 2: | ||
313 | mov.l 1f,r8 | ||
314 | mov.l 2f,r9 | ||
315 | jmp @r9 | ||
316 | lds r8,pr | ||
317 | 314 | ||
318 | .align 2 | 315 | #ifdef CONFIG_TRACE_IRQFLAGS |
316 | 1: .long trace_hardirqs_off | ||
317 | #endif | ||
319 | $current_thread_info: | 318 | $current_thread_info: |
320 | .long __current_thread_info | 319 | .long __current_thread_info |
321 | $cpu_mode: | 320 | $cpu_mode: |
322 | .long __cpu_mode | 321 | .long __cpu_mode |
323 | #ifdef CONFIG_TRACE_IRQFLAGS | ||
324 | 3: .long trace_hardirqs_off | ||
325 | #endif | ||
326 | 322 | ||
327 | ! common exception handler | 323 | ! common exception handler |
328 | #include "../../entry-common.S" | 324 | #include "../../entry-common.S" |
diff --git a/arch/sh/kernel/cpu/sh2/setup-sh7619.c b/arch/sh/kernel/cpu/sh2/setup-sh7619.c index 82c2d905152f..79283e6c1d8f 100644 --- a/arch/sh/kernel/cpu/sh2/setup-sh7619.c +++ b/arch/sh/kernel/cpu/sh2/setup-sh7619.c | |||
@@ -51,3 +51,44 @@ static int __init sh7619_devices_setup(void) | |||
51 | ARRAY_SIZE(sh7619_devices)); | 51 | ARRAY_SIZE(sh7619_devices)); |
52 | } | 52 | } |
53 | __initcall(sh7619_devices_setup); | 53 | __initcall(sh7619_devices_setup); |
54 | |||
55 | #define INTC_IPRC 0xf8080000UL | ||
56 | #define INTC_IPRD 0xf8080002UL | ||
57 | |||
58 | #define CMI0_IRQ 86 | ||
59 | |||
60 | #define SCIF0_ERI_IRQ 88 | ||
61 | #define SCIF0_RXI_IRQ 89 | ||
62 | #define SCIF0_BRI_IRQ 90 | ||
63 | #define SCIF0_TXI_IRQ 91 | ||
64 | |||
65 | #define SCIF1_ERI_IRQ 92 | ||
66 | #define SCIF1_RXI_IRQ 93 | ||
67 | #define SCIF1_BRI_IRQ 94 | ||
68 | #define SCIF1_TXI_IRQ 95 | ||
69 | |||
70 | #define SCIF2_BRI_IRQ 96 | ||
71 | #define SCIF2_ERI_IRQ 97 | ||
72 | #define SCIF2_RXI_IRQ 98 | ||
73 | #define SCIF2_TXI_IRQ 99 | ||
74 | |||
75 | static struct ipr_data sh7619_ipr_map[] = { | ||
76 | { CMI0_IRQ, INTC_IPRC, 1, 2 }, | ||
77 | { SCIF0_ERI_IRQ, INTC_IPRD, 3, 3 }, | ||
78 | { SCIF0_RXI_IRQ, INTC_IPRD, 3, 3 }, | ||
79 | { SCIF0_BRI_IRQ, INTC_IPRD, 3, 3 }, | ||
80 | { SCIF0_TXI_IRQ, INTC_IPRD, 3, 3 }, | ||
81 | { SCIF1_ERI_IRQ, INTC_IPRD, 2, 3 }, | ||
82 | { SCIF1_RXI_IRQ, INTC_IPRD, 2, 3 }, | ||
83 | { SCIF1_BRI_IRQ, INTC_IPRD, 2, 3 }, | ||
84 | { SCIF1_TXI_IRQ, INTC_IPRD, 2, 3 }, | ||
85 | { SCIF2_ERI_IRQ, INTC_IPRD, 1, 3 }, | ||
86 | { SCIF2_RXI_IRQ, INTC_IPRD, 1, 3 }, | ||
87 | { SCIF2_BRI_IRQ, INTC_IPRD, 1, 3 }, | ||
88 | { SCIF2_TXI_IRQ, INTC_IPRD, 1, 3 }, | ||
89 | }; | ||
90 | |||
91 | void __init init_IRQ_ipr(void) | ||
92 | { | ||
93 | make_ipr_irq(sh7619_ipr_map, ARRAY_SIZE(sh7619_ipr_map)); | ||
94 | } | ||
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7206.c b/arch/sh/kernel/cpu/sh2a/setup-sh7206.c index cdfeef49e62e..4b60fcc7d667 100644 --- a/arch/sh/kernel/cpu/sh2a/setup-sh7206.c +++ b/arch/sh/kernel/cpu/sh2a/setup-sh7206.c | |||
@@ -17,22 +17,22 @@ static struct plat_sci_port sci_platform_data[] = { | |||
17 | .mapbase = 0xfffe8000, | 17 | .mapbase = 0xfffe8000, |
18 | .flags = UPF_BOOT_AUTOCONF, | 18 | .flags = UPF_BOOT_AUTOCONF, |
19 | .type = PORT_SCIF, | 19 | .type = PORT_SCIF, |
20 | .irqs = { 240, 241, 242, 243}, | 20 | .irqs = { 241, 242, 243, 240}, |
21 | }, { | 21 | }, { |
22 | .mapbase = 0xfffe8800, | 22 | .mapbase = 0xfffe8800, |
23 | .flags = UPF_BOOT_AUTOCONF, | 23 | .flags = UPF_BOOT_AUTOCONF, |
24 | .type = PORT_SCIF, | 24 | .type = PORT_SCIF, |
25 | .irqs = { 244, 245, 246, 247}, | 25 | .irqs = { 247, 244, 245, 246}, |
26 | }, { | 26 | }, { |
27 | .mapbase = 0xfffe9000, | 27 | .mapbase = 0xfffe9000, |
28 | .flags = UPF_BOOT_AUTOCONF, | 28 | .flags = UPF_BOOT_AUTOCONF, |
29 | .type = PORT_SCIF, | 29 | .type = PORT_SCIF, |
30 | .irqs = { 248, 249, 250, 251}, | 30 | .irqs = { 249, 250, 251, 248}, |
31 | }, { | 31 | }, { |
32 | .mapbase = 0xfffe9800, | 32 | .mapbase = 0xfffe9800, |
33 | .flags = UPF_BOOT_AUTOCONF, | 33 | .flags = UPF_BOOT_AUTOCONF, |
34 | .type = PORT_SCIF, | 34 | .type = PORT_SCIF, |
35 | .irqs = { 252, 253, 254, 255}, | 35 | .irqs = { 253, 254, 255, 252}, |
36 | }, { | 36 | }, { |
37 | .flags = 0, | 37 | .flags = 0, |
38 | } | 38 | } |
@@ -56,3 +56,57 @@ static int __init sh7206_devices_setup(void) | |||
56 | ARRAY_SIZE(sh7206_devices)); | 56 | ARRAY_SIZE(sh7206_devices)); |
57 | } | 57 | } |
58 | __initcall(sh7206_devices_setup); | 58 | __initcall(sh7206_devices_setup); |
59 | |||
60 | #define INTC_IPR08 0xfffe0c04UL | ||
61 | #define INTC_IPR09 0xfffe0c06UL | ||
62 | #define INTC_IPR14 0xfffe0c10UL | ||
63 | |||
64 | #define CMI0_IRQ 140 | ||
65 | |||
66 | #define MTU1_TGI1A 164 | ||
67 | |||
68 | #define SCIF0_BRI_IRQ 240 | ||
69 | #define SCIF0_ERI_IRQ 241 | ||
70 | #define SCIF0_RXI_IRQ 242 | ||
71 | #define SCIF0_TXI_IRQ 243 | ||
72 | |||
73 | #define SCIF1_BRI_IRQ 244 | ||
74 | #define SCIF1_ERI_IRQ 245 | ||
75 | #define SCIF1_RXI_IRQ 246 | ||
76 | #define SCIF1_TXI_IRQ 247 | ||
77 | |||
78 | #define SCIF2_BRI_IRQ 248 | ||
79 | #define SCIF2_ERI_IRQ 249 | ||
80 | #define SCIF2_RXI_IRQ 250 | ||
81 | #define SCIF2_TXI_IRQ 251 | ||
82 | |||
83 | #define SCIF3_BRI_IRQ 252 | ||
84 | #define SCIF3_ERI_IRQ 253 | ||
85 | #define SCIF3_RXI_IRQ 254 | ||
86 | #define SCIF3_TXI_IRQ 255 | ||
87 | |||
88 | static struct ipr_data sh7206_ipr_map[] = { | ||
89 | { CMI0_IRQ, INTC_IPR08, 3, 2 }, | ||
90 | { MTU2_TGI1A, INTC_IPR09, 1, 2 }, | ||
91 | { SCIF0_ERI_IRQ, INTC_IPR14, 3, 3 }, | ||
92 | { SCIF0_RXI_IRQ, INTC_IPR14, 3, 3 }, | ||
93 | { SCIF0_BRI_IRQ, INTC_IPR14, 3, 3 }, | ||
94 | { SCIF0_TXI_IRQ, INTC_IPR14, 3, 3 }, | ||
95 | { SCIF1_ERI_IRQ, INTC_IPR14, 2, 3 }, | ||
96 | { SCIF1_RXI_IRQ, INTC_IPR14, 2, 3 }, | ||
97 | { SCIF1_BRI_IRQ, INTC_IPR14, 2, 3 }, | ||
98 | { SCIF1_TXI_IRQ, INTC_IPR14, 2, 3 }, | ||
99 | { SCIF2_ERI_IRQ, INTC_IPR14, 1, 3 }, | ||
100 | { SCIF2_RXI_IRQ, INTC_IPR14, 1, 3 }, | ||
101 | { SCIF2_BRI_IRQ, INTC_IPR14, 1, 3 }, | ||
102 | { SCIF2_TXI_IRQ, INTC_IPR14, 1, 3 }, | ||
103 | { SCIF3_ERI_IRQ, INTC_IPR14, 0, 3 }, | ||
104 | { SCIF3_RXI_IRQ, INTC_IPR14, 0, 3 }, | ||
105 | { SCIF3_BRI_IRQ, INTC_IPR14, 0, 3 }, | ||
106 | { SCIF3_TXI_IRQ, INTC_IPR14, 0, 3 }, | ||
107 | }; | ||
108 | |||
109 | void __init init_IRQ_ipr(void) | ||
110 | { | ||
111 | make_ipr_irq(sh7206_ipr_map, ARRAY_SIZE(sh7206_ipr_map)); | ||
112 | } | ||
diff --git a/arch/sh/kernel/cpu/sh4/Makefile b/arch/sh/kernel/cpu/sh4/Makefile index 6e415baf04b4..19ca68c71884 100644 --- a/arch/sh/kernel/cpu/sh4/Makefile +++ b/arch/sh/kernel/cpu/sh4/Makefile | |||
@@ -12,17 +12,12 @@ obj-$(CONFIG_SH_STORE_QUEUES) += sq.o | |||
12 | obj-$(CONFIG_CPU_SUBTYPE_SH7750) += setup-sh7750.o | 12 | obj-$(CONFIG_CPU_SUBTYPE_SH7750) += setup-sh7750.o |
13 | obj-$(CONFIG_CPU_SUBTYPE_SH7751) += setup-sh7750.o | 13 | obj-$(CONFIG_CPU_SUBTYPE_SH7751) += setup-sh7750.o |
14 | obj-$(CONFIG_CPU_SUBTYPE_SH7760) += setup-sh7760.o | 14 | obj-$(CONFIG_CPU_SUBTYPE_SH7760) += setup-sh7760.o |
15 | obj-$(CONFIG_CPU_SUBTYPE_SH7770) += setup-sh7770.o | ||
16 | obj-$(CONFIG_CPU_SUBTYPE_SH7780) += setup-sh7780.o | ||
17 | obj-$(CONFIG_CPU_SUBTYPE_SH73180) += setup-sh73180.o | ||
18 | obj-$(CONFIG_CPU_SUBTYPE_SH7343) += setup-sh7343.o | ||
19 | obj-$(CONFIG_CPU_SUBTYPE_SH4_202) += setup-sh4-202.o | 15 | obj-$(CONFIG_CPU_SUBTYPE_SH4_202) += setup-sh4-202.o |
20 | 16 | ||
21 | # Primary on-chip clocks (common) | 17 | # Primary on-chip clocks (common) |
18 | ifndef CONFIG_CPU_SH4A | ||
22 | clock-$(CONFIG_CPU_SH4) := clock-sh4.o | 19 | clock-$(CONFIG_CPU_SH4) := clock-sh4.o |
23 | clock-$(CONFIG_CPU_SUBTYPE_SH73180) := clock-sh73180.o | 20 | endif |
24 | clock-$(CONFIG_CPU_SUBTYPE_SH7770) := clock-sh7770.o | ||
25 | clock-$(CONFIG_CPU_SUBTYPE_SH7780) := clock-sh7780.o | ||
26 | 21 | ||
27 | # Additional clocks by subtype | 22 | # Additional clocks by subtype |
28 | clock-$(CONFIG_CPU_SUBTYPE_SH4_202) += clock-sh4-202.o | 23 | clock-$(CONFIG_CPU_SUBTYPE_SH4_202) += clock-sh4-202.o |
diff --git a/arch/sh/kernel/cpu/sh4/probe.c b/arch/sh/kernel/cpu/sh4/probe.c index afe0f1b1c030..9031a22a2ce7 100644 --- a/arch/sh/kernel/cpu/sh4/probe.c +++ b/arch/sh/kernel/cpu/sh4/probe.c | |||
@@ -119,11 +119,20 @@ int __init detect_cpu_and_cache_system(void) | |||
119 | break; | 119 | break; |
120 | case 0x3000: | 120 | case 0x3000: |
121 | case 0x3003: | 121 | case 0x3003: |
122 | case 0x3009: | ||
122 | cpu_data->type = CPU_SH7343; | 123 | cpu_data->type = CPU_SH7343; |
123 | cpu_data->icache.ways = 4; | 124 | cpu_data->icache.ways = 4; |
124 | cpu_data->dcache.ways = 4; | 125 | cpu_data->dcache.ways = 4; |
125 | cpu_data->flags |= CPU_HAS_LLSC; | 126 | cpu_data->flags |= CPU_HAS_LLSC; |
126 | break; | 127 | break; |
128 | case 0x3008: | ||
129 | if (prr == 0xa0) { | ||
130 | cpu_data->type = CPU_SH7722; | ||
131 | cpu_data->icache.ways = 4; | ||
132 | cpu_data->dcache.ways = 4; | ||
133 | cpu_data->flags |= CPU_HAS_LLSC; | ||
134 | } | ||
135 | break; | ||
127 | case 0x8000: | 136 | case 0x8000: |
128 | cpu_data->type = CPU_ST40RA; | 137 | cpu_data->type = CPU_ST40RA; |
129 | cpu_data->flags |= CPU_HAS_FPU; | 138 | cpu_data->flags |= CPU_HAS_FPU; |
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7750.c b/arch/sh/kernel/cpu/sh4/setup-sh7750.c index bbcb06f18b04..cbac27634c0b 100644 --- a/arch/sh/kernel/cpu/sh4/setup-sh7750.c +++ b/arch/sh/kernel/cpu/sh4/setup-sh7750.c | |||
@@ -14,6 +14,36 @@ | |||
14 | #include <linux/io.h> | 14 | #include <linux/io.h> |
15 | #include <asm/sci.h> | 15 | #include <asm/sci.h> |
16 | 16 | ||
17 | static struct resource rtc_resources[] = { | ||
18 | [0] = { | ||
19 | .start = 0xffc80000, | ||
20 | .end = 0xffc80000 + 0x58 - 1, | ||
21 | .flags = IORESOURCE_IO, | ||
22 | }, | ||
23 | [1] = { | ||
24 | /* Period IRQ */ | ||
25 | .start = 21, | ||
26 | .flags = IORESOURCE_IRQ, | ||
27 | }, | ||
28 | [2] = { | ||
29 | /* Carry IRQ */ | ||
30 | .start = 22, | ||
31 | .flags = IORESOURCE_IRQ, | ||
32 | }, | ||
33 | [3] = { | ||
34 | /* Alarm IRQ */ | ||
35 | .start = 20, | ||
36 | .flags = IORESOURCE_IRQ, | ||
37 | }, | ||
38 | }; | ||
39 | |||
40 | static struct platform_device rtc_device = { | ||
41 | .name = "sh-rtc", | ||
42 | .id = -1, | ||
43 | .num_resources = ARRAY_SIZE(rtc_resources), | ||
44 | .resource = rtc_resources, | ||
45 | }; | ||
46 | |||
17 | static struct plat_sci_port sci_platform_data[] = { | 47 | static struct plat_sci_port sci_platform_data[] = { |
18 | { | 48 | { |
19 | .mapbase = 0xffe00000, | 49 | .mapbase = 0xffe00000, |
@@ -39,6 +69,7 @@ static struct platform_device sci_device = { | |||
39 | }; | 69 | }; |
40 | 70 | ||
41 | static struct platform_device *sh7750_devices[] __initdata = { | 71 | static struct platform_device *sh7750_devices[] __initdata = { |
72 | &rtc_device, | ||
42 | &sci_device, | 73 | &sci_device, |
43 | }; | 74 | }; |
44 | 75 | ||
diff --git a/arch/sh/kernel/cpu/sh4/sq.c b/arch/sh/kernel/cpu/sh4/sq.c index 0c9ea38d2caa..d7fff752e569 100644 --- a/arch/sh/kernel/cpu/sh4/sq.c +++ b/arch/sh/kernel/cpu/sh4/sq.c | |||
@@ -111,8 +111,9 @@ static int __sq_remap(struct sq_mapping *map, unsigned long flags) | |||
111 | 111 | ||
112 | vma->phys_addr = map->addr; | 112 | vma->phys_addr = map->addr; |
113 | 113 | ||
114 | if (remap_area_pages((unsigned long)vma->addr, vma->phys_addr, | 114 | if (ioremap_page_range((unsigned long)vma->addr, |
115 | map->size, flags)) { | 115 | (unsigned long)vma->addr + map->size, |
116 | vma->phys_addr, __pgprot(flags))) { | ||
116 | vunmap(vma->addr); | 117 | vunmap(vma->addr); |
117 | return -EAGAIN; | 118 | return -EAGAIN; |
118 | } | 119 | } |
@@ -176,7 +177,7 @@ unsigned long sq_remap(unsigned long phys, unsigned int size, | |||
176 | 177 | ||
177 | map->sq_addr = P4SEG_STORE_QUE + (page << PAGE_SHIFT); | 178 | map->sq_addr = P4SEG_STORE_QUE + (page << PAGE_SHIFT); |
178 | 179 | ||
179 | ret = __sq_remap(map, flags); | 180 | ret = __sq_remap(map, pgprot_val(PAGE_KERNEL_NOCACHE) | flags); |
180 | if (unlikely(ret != 0)) | 181 | if (unlikely(ret != 0)) |
181 | goto out; | 182 | goto out; |
182 | 183 | ||
diff --git a/arch/sh/kernel/cpu/sh4a/Makefile b/arch/sh/kernel/cpu/sh4a/Makefile new file mode 100644 index 000000000000..a8f493f2f21f --- /dev/null +++ b/arch/sh/kernel/cpu/sh4a/Makefile | |||
@@ -0,0 +1,19 @@ | |||
1 | # | ||
2 | # Makefile for the Linux/SuperH SH-4 backends. | ||
3 | # | ||
4 | |||
5 | # CPU subtype setup | ||
6 | obj-$(CONFIG_CPU_SUBTYPE_SH7770) += setup-sh7770.o | ||
7 | obj-$(CONFIG_CPU_SUBTYPE_SH7780) += setup-sh7780.o | ||
8 | obj-$(CONFIG_CPU_SUBTYPE_SH73180) += setup-sh73180.o | ||
9 | obj-$(CONFIG_CPU_SUBTYPE_SH7343) += setup-sh7343.o | ||
10 | obj-$(CONFIG_CPU_SUBTYPE_SH7722) += setup-sh7722.o | ||
11 | |||
12 | # Primary on-chip clocks (common) | ||
13 | clock-$(CONFIG_CPU_SUBTYPE_SH73180) := clock-sh73180.o | ||
14 | clock-$(CONFIG_CPU_SUBTYPE_SH7770) := clock-sh7770.o | ||
15 | clock-$(CONFIG_CPU_SUBTYPE_SH7780) := clock-sh7780.o | ||
16 | clock-$(CONFIG_CPU_SUBTYPE_SH7343) := clock-sh7343.o | ||
17 | clock-$(CONFIG_CPU_SUBTYPE_SH7722) := clock-sh7343.o | ||
18 | |||
19 | obj-y += $(clock-y) | ||
diff --git a/arch/sh/kernel/cpu/sh4/clock-sh73180.c b/arch/sh/kernel/cpu/sh4a/clock-sh73180.c index 2fa5cb2ae68d..2fa5cb2ae68d 100644 --- a/arch/sh/kernel/cpu/sh4/clock-sh73180.c +++ b/arch/sh/kernel/cpu/sh4a/clock-sh73180.c | |||
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7343.c b/arch/sh/kernel/cpu/sh4a/clock-sh7343.c new file mode 100644 index 000000000000..1707a213f0cf --- /dev/null +++ b/arch/sh/kernel/cpu/sh4a/clock-sh7343.c | |||
@@ -0,0 +1,99 @@ | |||
1 | /* | ||
2 | * arch/sh/kernel/cpu/sh4/clock-sh7343.c | ||
3 | * | ||
4 | * SH7343/SH7722 support for the clock framework | ||
5 | * | ||
6 | * Copyright (C) 2006 Paul Mundt | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General Public | ||
9 | * License. See the file "COPYING" in the main directory of this archive | ||
10 | * for more details. | ||
11 | */ | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/io.h> | ||
15 | #include <asm/clock.h> | ||
16 | #include <asm/freq.h> | ||
17 | |||
18 | /* | ||
19 | * SH7343/SH7722 uses a common set of multipliers and divisors, so this | ||
20 | * is quite simple.. | ||
21 | */ | ||
22 | static int multipliers[] = { 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; | ||
23 | static int divisors[] = { 1, 3, 2, 5, 3, 4, 5, 6, 8, 10, 12, 16, 20 }; | ||
24 | |||
25 | #define pll_calc() (((ctrl_inl(FRQCR) >> 24) & 0x1f) + 1) | ||
26 | |||
27 | static void master_clk_init(struct clk *clk) | ||
28 | { | ||
29 | clk->parent = clk_get(NULL, "cpu_clk"); | ||
30 | } | ||
31 | |||
32 | static void master_clk_recalc(struct clk *clk) | ||
33 | { | ||
34 | int idx = (ctrl_inl(FRQCR) & 0x000f); | ||
35 | clk->rate *= clk->parent->rate * multipliers[idx] / divisors[idx]; | ||
36 | } | ||
37 | |||
38 | static struct clk_ops sh7343_master_clk_ops = { | ||
39 | .init = master_clk_init, | ||
40 | .recalc = master_clk_recalc, | ||
41 | }; | ||
42 | |||
43 | static void module_clk_init(struct clk *clk) | ||
44 | { | ||
45 | clk->parent = NULL; | ||
46 | clk->rate = CONFIG_SH_PCLK_FREQ; | ||
47 | } | ||
48 | |||
49 | static struct clk_ops sh7343_module_clk_ops = { | ||
50 | .init = module_clk_init, | ||
51 | }; | ||
52 | |||
53 | static void bus_clk_init(struct clk *clk) | ||
54 | { | ||
55 | clk->parent = clk_get(NULL, "cpu_clk"); | ||
56 | } | ||
57 | |||
58 | static void bus_clk_recalc(struct clk *clk) | ||
59 | { | ||
60 | int idx = (ctrl_inl(FRQCR) >> 8) & 0x000f; | ||
61 | clk->rate = clk->parent->rate * multipliers[idx] / divisors[idx]; | ||
62 | } | ||
63 | |||
64 | static struct clk_ops sh7343_bus_clk_ops = { | ||
65 | .init = bus_clk_init, | ||
66 | .recalc = bus_clk_recalc, | ||
67 | }; | ||
68 | |||
69 | static void cpu_clk_init(struct clk *clk) | ||
70 | { | ||
71 | clk->parent = clk_get(NULL, "module_clk"); | ||
72 | clk->flags |= CLK_RATE_PROPAGATES; | ||
73 | clk_set_rate(clk, clk_get_rate(clk)); | ||
74 | } | ||
75 | |||
76 | static void cpu_clk_recalc(struct clk *clk) | ||
77 | { | ||
78 | int idx = (ctrl_inl(FRQCR) >> 20) & 0x000f; | ||
79 | clk->rate = clk->parent->rate * pll_calc() * | ||
80 | multipliers[idx] / divisors[idx]; | ||
81 | } | ||
82 | |||
83 | static struct clk_ops sh7343_cpu_clk_ops = { | ||
84 | .init = cpu_clk_init, | ||
85 | .recalc = cpu_clk_recalc, | ||
86 | }; | ||
87 | |||
88 | static struct clk_ops *sh7343_clk_ops[] = { | ||
89 | &sh7343_master_clk_ops, | ||
90 | &sh7343_module_clk_ops, | ||
91 | &sh7343_bus_clk_ops, | ||
92 | &sh7343_cpu_clk_ops, | ||
93 | }; | ||
94 | |||
95 | void __init arch_init_clk_ops(struct clk_ops **ops, int idx) | ||
96 | { | ||
97 | if (idx < ARRAY_SIZE(sh7343_clk_ops)) | ||
98 | *ops = sh7343_clk_ops[idx]; | ||
99 | } | ||
diff --git a/arch/sh/kernel/cpu/sh4/clock-sh7770.c b/arch/sh/kernel/cpu/sh4a/clock-sh7770.c index c8694bac6477..c8694bac6477 100644 --- a/arch/sh/kernel/cpu/sh4/clock-sh7770.c +++ b/arch/sh/kernel/cpu/sh4a/clock-sh7770.c | |||
diff --git a/arch/sh/kernel/cpu/sh4/clock-sh7780.c b/arch/sh/kernel/cpu/sh4a/clock-sh7780.c index 9e6a216750c8..9e6a216750c8 100644 --- a/arch/sh/kernel/cpu/sh4/clock-sh7780.c +++ b/arch/sh/kernel/cpu/sh4a/clock-sh7780.c | |||
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh73180.c b/arch/sh/kernel/cpu/sh4a/setup-sh73180.c index cc9ea1e2e5df..cc9ea1e2e5df 100644 --- a/arch/sh/kernel/cpu/sh4/setup-sh73180.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh73180.c | |||
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7343.c b/arch/sh/kernel/cpu/sh4a/setup-sh7343.c index 91d61cf91ba1..91d61cf91ba1 100644 --- a/arch/sh/kernel/cpu/sh4/setup-sh7343.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7343.c | |||
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c new file mode 100644 index 000000000000..1143fbf65faf --- /dev/null +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | * SH7722 Setup | ||
3 | * | ||
4 | * Copyright (C) 2006 Paul Mundt | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | #include <linux/platform_device.h> | ||
11 | #include <linux/init.h> | ||
12 | #include <linux/serial.h> | ||
13 | #include <asm/sci.h> | ||
14 | |||
15 | static struct plat_sci_port sci_platform_data[] = { | ||
16 | { | ||
17 | .mapbase = 0xffe00000, | ||
18 | .flags = UPF_BOOT_AUTOCONF, | ||
19 | .type = PORT_SCIF, | ||
20 | .irqs = { 80, 81, 83, 82 }, | ||
21 | }, { | ||
22 | .flags = 0, | ||
23 | } | ||
24 | }; | ||
25 | |||
26 | static struct platform_device sci_device = { | ||
27 | .name = "sh-sci", | ||
28 | .id = -1, | ||
29 | .dev = { | ||
30 | .platform_data = sci_platform_data, | ||
31 | }, | ||
32 | }; | ||
33 | |||
34 | static struct platform_device *sh7722_devices[] __initdata = { | ||
35 | &sci_device, | ||
36 | }; | ||
37 | |||
38 | static int __init sh7722_devices_setup(void) | ||
39 | { | ||
40 | return platform_add_devices(sh7722_devices, | ||
41 | ARRAY_SIZE(sh7722_devices)); | ||
42 | } | ||
43 | __initcall(sh7722_devices_setup); | ||
44 | |||
45 | static struct ipr_data sh7722_ipr_map[] = { | ||
46 | /* IRQ, IPR-idx, shift, prio */ | ||
47 | { 16, 0, 12, 2 }, /* TMU0 */ | ||
48 | { 17, 0, 8, 2 }, /* TMU1 */ | ||
49 | { 80, 6, 12, 3 }, /* SCIF ERI */ | ||
50 | { 81, 6, 12, 3 }, /* SCIF RXI */ | ||
51 | { 82, 6, 12, 3 }, /* SCIF BRI */ | ||
52 | { 83, 6, 12, 3 }, /* SCIF TXI */ | ||
53 | }; | ||
54 | |||
55 | static unsigned long ipr_offsets[] = { | ||
56 | 0xa4080000, /* 0: IPRA */ | ||
57 | 0xa4080004, /* 1: IPRB */ | ||
58 | 0xa4080008, /* 2: IPRC */ | ||
59 | 0xa408000c, /* 3: IPRD */ | ||
60 | 0xa4080010, /* 4: IPRE */ | ||
61 | 0xa4080014, /* 5: IPRF */ | ||
62 | 0xa4080018, /* 6: IPRG */ | ||
63 | 0xa408001c, /* 7: IPRH */ | ||
64 | 0xa4080020, /* 8: IPRI */ | ||
65 | 0xa4080024, /* 9: IPRJ */ | ||
66 | 0xa4080028, /* 10: IPRK */ | ||
67 | 0xa408002c, /* 11: IPRL */ | ||
68 | }; | ||
69 | |||
70 | unsigned int map_ipridx_to_addr(int idx) | ||
71 | { | ||
72 | if (unlikely(idx >= ARRAY_SIZE(ipr_offsets))) | ||
73 | return 0; | ||
74 | return ipr_offsets[idx]; | ||
75 | } | ||
76 | |||
77 | void __init init_IRQ_ipr(void) | ||
78 | { | ||
79 | make_ipr_irq(sh7722_ipr_map, ARRAY_SIZE(sh7722_ipr_map)); | ||
80 | } | ||
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7770.c b/arch/sh/kernel/cpu/sh4a/setup-sh7770.c index 6a04cc5f5aca..6a04cc5f5aca 100644 --- a/arch/sh/kernel/cpu/sh4/setup-sh7770.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7770.c | |||
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7780.c b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c index 9aeaa2ddaa28..9aeaa2ddaa28 100644 --- a/arch/sh/kernel/cpu/sh4/setup-sh7780.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c | |||
diff --git a/arch/sh/kernel/early_printk.c b/arch/sh/kernel/early_printk.c index 60340823798a..560b91cdd15c 100644 --- a/arch/sh/kernel/early_printk.c +++ b/arch/sh/kernel/early_printk.c | |||
@@ -144,16 +144,16 @@ static struct console *early_console = | |||
144 | ; | 144 | ; |
145 | 145 | ||
146 | static int __initdata keep_early; | 146 | static int __initdata keep_early; |
147 | static int early_console_initialized; | ||
147 | 148 | ||
148 | int __init setup_early_printk(char *opt) | 149 | int __init setup_early_printk(char *buf) |
149 | { | 150 | { |
150 | char *space; | 151 | if (!buf) |
151 | char buf[256]; | 152 | return 0; |
152 | 153 | ||
153 | strlcpy(buf, opt, sizeof(buf)); | 154 | if (early_console_initialized) |
154 | space = strchr(buf, ' '); | 155 | return 0; |
155 | if (space) | 156 | early_console_initialized = 1; |
156 | *space = 0; | ||
157 | 157 | ||
158 | if (strstr(buf, "keep")) | 158 | if (strstr(buf, "keep")) |
159 | keep_early = 1; | 159 | keep_early = 1; |
@@ -175,12 +175,14 @@ int __init setup_early_printk(char *opt) | |||
175 | if (likely(early_console)) | 175 | if (likely(early_console)) |
176 | register_console(early_console); | 176 | register_console(early_console); |
177 | 177 | ||
178 | return 1; | 178 | return 0; |
179 | } | 179 | } |
180 | __setup("earlyprintk=", setup_early_printk); | 180 | early_param("earlyprintk", setup_early_printk); |
181 | 181 | ||
182 | void __init disable_early_printk(void) | 182 | void __init disable_early_printk(void) |
183 | { | 183 | { |
184 | if (!early_console_initialized || !early_console) | ||
185 | return; | ||
184 | if (!keep_early) { | 186 | if (!keep_early) { |
185 | printk("disabling early console\n"); | 187 | printk("disabling early console\n"); |
186 | unregister_console(early_console); | 188 | unregister_console(early_console); |
diff --git a/arch/sh/kernel/entry-common.S b/arch/sh/kernel/entry-common.S index 29136a35d7c7..fc279aeb73ab 100644 --- a/arch/sh/kernel/entry-common.S +++ b/arch/sh/kernel/entry-common.S | |||
@@ -79,18 +79,29 @@ debug_kernel_sw: | |||
79 | .align 2 | 79 | .align 2 |
80 | 3: .long kgdb_handle_exception | 80 | 3: .long kgdb_handle_exception |
81 | #endif /* CONFIG_SH_KGDB */ | 81 | #endif /* CONFIG_SH_KGDB */ |
82 | 82 | #ifdef CONFIG_SH_STANDARD_BIOS | |
83 | bra debug_kernel_fw | ||
84 | nop | ||
85 | #endif | ||
83 | #endif /* CONFIG_SH_STANDARD_BIOS || CONFIG_SH_KGDB */ | 86 | #endif /* CONFIG_SH_STANDARD_BIOS || CONFIG_SH_KGDB */ |
84 | 87 | ||
85 | |||
86 | .align 2 | 88 | .align 2 |
87 | debug_trap: | 89 | debug_trap: |
88 | #if defined(CONFIG_SH_STANDARD_BIOS) || defined(CONFIG_SH_KGDB) | 90 | #if defined(CONFIG_SH_STANDARD_BIOS) || defined(CONFIG_SH_KGDB) |
91 | mov r8, r0 | ||
92 | shlr2 r0 | ||
93 | cmp/eq #0x3f, r0 ! sh_bios() trap | ||
94 | bf 1f | ||
95 | #ifdef CONFIG_SH_KGDB | ||
96 | cmp/eq #0xff, r0 ! XXX: KGDB trap, fix for SH-2. | ||
97 | bf 1f | ||
98 | #endif | ||
89 | mov #OFF_SR, r0 | 99 | mov #OFF_SR, r0 |
90 | mov.l @(r0,r15), r0 ! get status register | 100 | mov.l @(r0,r15), r0 ! get status register |
91 | shll r0 | 101 | shll r0 |
92 | shll r0 ! kernel space? | 102 | shll r0 ! kernel space? |
93 | bt/s debug_kernel | 103 | bt/s debug_kernel |
104 | 1: | ||
94 | #endif | 105 | #endif |
95 | mov.l @r15, r0 ! Restore R0 value | 106 | mov.l @r15, r0 ! Restore R0 value |
96 | mov.l 1f, r8 | 107 | mov.l 1f, r8 |
diff --git a/arch/sh/kernel/head.S b/arch/sh/kernel/head.S index 6aca4bc6ec5d..71a3ad7d283e 100644 --- a/arch/sh/kernel/head.S +++ b/arch/sh/kernel/head.S | |||
@@ -33,7 +33,8 @@ ENTRY(empty_zero_page) | |||
33 | .long 0x00360000 /* INITRD_START */ | 33 | .long 0x00360000 /* INITRD_START */ |
34 | .long 0x000a0000 /* INITRD_SIZE */ | 34 | .long 0x000a0000 /* INITRD_SIZE */ |
35 | .long 0 | 35 | .long 0 |
36 | .balign PAGE_SIZE,0,PAGE_SIZE | 36 | 1: |
37 | .skip PAGE_SIZE - empty_zero_page - 1b | ||
37 | 38 | ||
38 | .text | 39 | .text |
39 | /* | 40 | /* |
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c index f3e2631be144..486c06e18033 100644 --- a/arch/sh/kernel/process.c +++ b/arch/sh/kernel/process.c | |||
@@ -470,9 +470,10 @@ unsigned long get_wchan(struct task_struct *p) | |||
470 | */ | 470 | */ |
471 | pc = thread_saved_pc(p); | 471 | pc = thread_saved_pc(p); |
472 | if (in_sched_functions(pc)) { | 472 | if (in_sched_functions(pc)) { |
473 | schedule_frame = ((unsigned long *)(long)p->thread.sp)[1]; | 473 | schedule_frame = (unsigned long)p->thread.sp; |
474 | return (unsigned long)((unsigned long *)schedule_frame)[1]; | 474 | return ((unsigned long *)schedule_frame)[21]; |
475 | } | 475 | } |
476 | |||
476 | return pc; | 477 | return pc; |
477 | } | 478 | } |
478 | 479 | ||
@@ -498,6 +499,16 @@ asmlinkage void break_point_trap_software(unsigned long r4, unsigned long r5, | |||
498 | { | 499 | { |
499 | struct pt_regs *regs = RELOC_HIDE(&__regs, 0); | 500 | struct pt_regs *regs = RELOC_HIDE(&__regs, 0); |
500 | 501 | ||
502 | /* Rewind */ | ||
501 | regs->pc -= 2; | 503 | regs->pc -= 2; |
504 | |||
505 | #ifdef CONFIG_BUG | ||
506 | if (__kernel_text_address(instruction_pointer(regs))) { | ||
507 | u16 insn = *(u16 *)instruction_pointer(regs); | ||
508 | if (insn == TRAPA_BUG_OPCODE) | ||
509 | handle_BUG(regs); | ||
510 | } | ||
511 | #endif | ||
512 | |||
502 | force_sig(SIGTRAP, current); | 513 | force_sig(SIGTRAP, current); |
503 | } | 514 | } |
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c index f8dd6b7bfab0..225f9ea5cdd7 100644 --- a/arch/sh/kernel/setup.c +++ b/arch/sh/kernel/setup.c | |||
@@ -84,8 +84,7 @@ unsigned long memory_start, memory_end; | |||
84 | 84 | ||
85 | static inline void parse_cmdline (char ** cmdline_p, char mv_name[MV_NAME_SIZE], | 85 | static inline void parse_cmdline (char ** cmdline_p, char mv_name[MV_NAME_SIZE], |
86 | struct sh_machine_vector** mvp, | 86 | struct sh_machine_vector** mvp, |
87 | unsigned long *mv_io_base, | 87 | unsigned long *mv_io_base) |
88 | int *mv_mmio_enable) | ||
89 | { | 88 | { |
90 | char c = ' ', *to = command_line, *from = COMMAND_LINE; | 89 | char c = ' ', *to = command_line, *from = COMMAND_LINE; |
91 | int len = 0; | 90 | int len = 0; |
@@ -112,23 +111,6 @@ static inline void parse_cmdline (char ** cmdline_p, char mv_name[MV_NAME_SIZE], | |||
112 | } | 111 | } |
113 | } | 112 | } |
114 | 113 | ||
115 | #ifdef CONFIG_EARLY_PRINTK | ||
116 | if (c == ' ' && !memcmp(from, "earlyprintk=", 12)) { | ||
117 | char *ep_end; | ||
118 | |||
119 | if (to != command_line) | ||
120 | to--; | ||
121 | |||
122 | from += 12; | ||
123 | ep_end = strchr(from, ' '); | ||
124 | |||
125 | setup_early_printk(from); | ||
126 | printk("early console enabled\n"); | ||
127 | |||
128 | from = ep_end; | ||
129 | } | ||
130 | #endif | ||
131 | |||
132 | if (c == ' ' && !memcmp(from, "sh_mv=", 6)) { | 114 | if (c == ' ' && !memcmp(from, "sh_mv=", 6)) { |
133 | char* mv_end; | 115 | char* mv_end; |
134 | char* mv_comma; | 116 | char* mv_comma; |
@@ -145,7 +127,6 @@ static inline void parse_cmdline (char ** cmdline_p, char mv_name[MV_NAME_SIZE], | |||
145 | int ints[3]; | 127 | int ints[3]; |
146 | get_options(mv_comma+1, ARRAY_SIZE(ints), ints); | 128 | get_options(mv_comma+1, ARRAY_SIZE(ints), ints); |
147 | *mv_io_base = ints[1]; | 129 | *mv_io_base = ints[1]; |
148 | *mv_mmio_enable = ints[2]; | ||
149 | mv_len = mv_comma - from; | 130 | mv_len = mv_comma - from; |
150 | } else { | 131 | } else { |
151 | mv_len = mv_end - from; | 132 | mv_len = mv_end - from; |
@@ -158,6 +139,7 @@ static inline void parse_cmdline (char ** cmdline_p, char mv_name[MV_NAME_SIZE], | |||
158 | 139 | ||
159 | *mvp = get_mv_byname(mv_name); | 140 | *mvp = get_mv_byname(mv_name); |
160 | } | 141 | } |
142 | |||
161 | c = *(from++); | 143 | c = *(from++); |
162 | if (!c) | 144 | if (!c) |
163 | break; | 145 | break; |
@@ -177,9 +159,8 @@ static int __init sh_mv_setup(char **cmdline_p) | |||
177 | struct sh_machine_vector *mv = NULL; | 159 | struct sh_machine_vector *mv = NULL; |
178 | char mv_name[MV_NAME_SIZE] = ""; | 160 | char mv_name[MV_NAME_SIZE] = ""; |
179 | unsigned long mv_io_base = 0; | 161 | unsigned long mv_io_base = 0; |
180 | int mv_mmio_enable = 0; | ||
181 | 162 | ||
182 | parse_cmdline(cmdline_p, mv_name, &mv, &mv_io_base, &mv_mmio_enable); | 163 | parse_cmdline(cmdline_p, mv_name, &mv, &mv_io_base); |
183 | 164 | ||
184 | #ifdef CONFIG_SH_UNKNOWN | 165 | #ifdef CONFIG_SH_UNKNOWN |
185 | if (mv == NULL) { | 166 | if (mv == NULL) { |
@@ -258,6 +239,7 @@ void __init setup_arch(char **cmdline_p) | |||
258 | 239 | ||
259 | sh_mv_setup(cmdline_p); | 240 | sh_mv_setup(cmdline_p); |
260 | 241 | ||
242 | |||
261 | /* | 243 | /* |
262 | * Find the highest page frame number we have available | 244 | * Find the highest page frame number we have available |
263 | */ | 245 | */ |
@@ -305,6 +287,7 @@ void __init setup_arch(char **cmdline_p) | |||
305 | PFN_PHYS(pages)); | 287 | PFN_PHYS(pages)); |
306 | } | 288 | } |
307 | 289 | ||
290 | |||
308 | /* | 291 | /* |
309 | * Reserve the kernel text and | 292 | * Reserve the kernel text and |
310 | * Reserve the bootmem bitmap. We do this in two steps (first step | 293 | * Reserve the bootmem bitmap. We do this in two steps (first step |
@@ -325,14 +308,18 @@ void __init setup_arch(char **cmdline_p) | |||
325 | ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0); | 308 | ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0); |
326 | if (&__rd_start != &__rd_end) { | 309 | if (&__rd_start != &__rd_end) { |
327 | LOADER_TYPE = 1; | 310 | LOADER_TYPE = 1; |
328 | INITRD_START = PHYSADDR((unsigned long)&__rd_start) - __MEMORY_START; | 311 | INITRD_START = PHYSADDR((unsigned long)&__rd_start) - |
329 | INITRD_SIZE = (unsigned long)&__rd_end - (unsigned long)&__rd_start; | 312 | __MEMORY_START; |
313 | INITRD_SIZE = (unsigned long)&__rd_end - | ||
314 | (unsigned long)&__rd_start; | ||
330 | } | 315 | } |
331 | 316 | ||
332 | if (LOADER_TYPE && INITRD_START) { | 317 | if (LOADER_TYPE && INITRD_START) { |
333 | if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) { | 318 | if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) { |
334 | reserve_bootmem_node(NODE_DATA(0), INITRD_START+__MEMORY_START, INITRD_SIZE); | 319 | reserve_bootmem_node(NODE_DATA(0), INITRD_START + |
335 | initrd_start = INITRD_START + PAGE_OFFSET + __MEMORY_START; | 320 | __MEMORY_START, INITRD_SIZE); |
321 | initrd_start = INITRD_START + PAGE_OFFSET + | ||
322 | __MEMORY_START; | ||
336 | initrd_end = initrd_start + INITRD_SIZE; | 323 | initrd_end = initrd_start + INITRD_SIZE; |
337 | } else { | 324 | } else { |
338 | printk("initrd extends beyond end of memory " | 325 | printk("initrd extends beyond end of memory " |
@@ -404,7 +391,7 @@ static const char *cpu_name[] = { | |||
404 | [CPU_SH4_202] = "SH4-202", [CPU_SH4_501] = "SH4-501", | 391 | [CPU_SH4_202] = "SH4-202", [CPU_SH4_501] = "SH4-501", |
405 | [CPU_SH7770] = "SH7770", [CPU_SH7780] = "SH7780", | 392 | [CPU_SH7770] = "SH7770", [CPU_SH7780] = "SH7780", |
406 | [CPU_SH7781] = "SH7781", [CPU_SH7343] = "SH7343", | 393 | [CPU_SH7781] = "SH7781", [CPU_SH7343] = "SH7343", |
407 | [CPU_SH7785] = "SH7785", | 394 | [CPU_SH7785] = "SH7785", [CPU_SH7722] = "SH7722", |
408 | [CPU_SH_NONE] = "Unknown" | 395 | [CPU_SH_NONE] = "Unknown" |
409 | }; | 396 | }; |
410 | 397 | ||
diff --git a/arch/sh/kernel/sh_ksyms.c b/arch/sh/kernel/sh_ksyms.c index ceee79143401..e6106239a0fe 100644 --- a/arch/sh/kernel/sh_ksyms.c +++ b/arch/sh/kernel/sh_ksyms.c | |||
@@ -70,13 +70,26 @@ DECLARE_EXPORT(__sdivsi3); | |||
70 | DECLARE_EXPORT(__ashrdi3); | 70 | DECLARE_EXPORT(__ashrdi3); |
71 | DECLARE_EXPORT(__ashldi3); | 71 | DECLARE_EXPORT(__ashldi3); |
72 | DECLARE_EXPORT(__lshrdi3); | 72 | DECLARE_EXPORT(__lshrdi3); |
73 | DECLARE_EXPORT(__movstr); | ||
74 | DECLARE_EXPORT(__movstrSI16); | 73 | DECLARE_EXPORT(__movstrSI16); |
74 | #if __GNUC__ == 4 | ||
75 | DECLARE_EXPORT(__movmem); | ||
76 | #else | ||
77 | DECLARE_EXPORT(__movstr); | ||
78 | #endif | ||
75 | 79 | ||
76 | #ifdef CONFIG_CPU_SH4 | 80 | #ifdef CONFIG_CPU_SH4 |
81 | #if __GNUC__ == 4 | ||
82 | DECLARE_EXPORT(__movmem_i4_even); | ||
83 | DECLARE_EXPORT(__movmem_i4_odd); | ||
84 | DECLARE_EXPORT(__movmemSI12_i4); | ||
85 | DECLARE_EXPORT(__sdivsi3_i4i); | ||
86 | DECLARE_EXPORT(__udiv_qrnnd_16); | ||
87 | DECLARE_EXPORT(__udivsi3_i4i); | ||
88 | #else /* GCC 3.x */ | ||
77 | DECLARE_EXPORT(__movstr_i4_even); | 89 | DECLARE_EXPORT(__movstr_i4_even); |
78 | DECLARE_EXPORT(__movstr_i4_odd); | 90 | DECLARE_EXPORT(__movstr_i4_odd); |
79 | DECLARE_EXPORT(__movstrSI12_i4); | 91 | DECLARE_EXPORT(__movstrSI12_i4); |
92 | #endif /* __GNUC__ == 4 */ | ||
80 | #endif | 93 | #endif |
81 | 94 | ||
82 | #if defined(CONFIG_CPU_SH4) || defined(CONFIG_SH7705_CACHE_32KB) | 95 | #if defined(CONFIG_CPU_SH4) || defined(CONFIG_SH7705_CACHE_32KB) |
diff --git a/arch/sh/kernel/signal.c b/arch/sh/kernel/signal.c index bb1c480a59c7..379c88bf5d9a 100644 --- a/arch/sh/kernel/signal.c +++ b/arch/sh/kernel/signal.c | |||
@@ -101,7 +101,7 @@ sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, | |||
101 | */ | 101 | */ |
102 | 102 | ||
103 | #define MOVW(n) (0x9300|((n)-2)) /* Move mem word at PC+n to R3 */ | 103 | #define MOVW(n) (0x9300|((n)-2)) /* Move mem word at PC+n to R3 */ |
104 | #if defined(CONFIG_CPU_SH2) || defined(CONFIG_CPU_SH2A) | 104 | #if defined(CONFIG_CPU_SH2) |
105 | #define TRAP_NOARG 0xc320 /* Syscall w/no args (NR in R3) */ | 105 | #define TRAP_NOARG 0xc320 /* Syscall w/no args (NR in R3) */ |
106 | #else | 106 | #else |
107 | #define TRAP_NOARG 0xc310 /* Syscall w/no args (NR in R3) */ | 107 | #define TRAP_NOARG 0xc310 /* Syscall w/no args (NR in R3) */ |
diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c index 5083b6ed4b39..e18f183e1035 100644 --- a/arch/sh/kernel/sys_sh.c +++ b/arch/sh/kernel/sys_sh.c | |||
@@ -314,6 +314,12 @@ asmlinkage int sys_fadvise64_64_wrapper(int fd, u32 offset0, u32 offset1, | |||
314 | #endif | 314 | #endif |
315 | } | 315 | } |
316 | 316 | ||
317 | #if defined(CONFIG_CPU_SH2) || defined(CONFIG_CPU_SH2A) | ||
318 | #define SYSCALL_ARG3 "trapa #0x23" | ||
319 | #else | ||
320 | #define SYSCALL_ARG3 "trapa #0x13" | ||
321 | #endif | ||
322 | |||
317 | /* | 323 | /* |
318 | * Do a system call from kernel instead of calling sys_execve so we | 324 | * Do a system call from kernel instead of calling sys_execve so we |
319 | * end up with proper pt_regs. | 325 | * end up with proper pt_regs. |
@@ -324,7 +330,7 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[]) | |||
324 | register long __sc4 __asm__ ("r4") = (long) filename; | 330 | register long __sc4 __asm__ ("r4") = (long) filename; |
325 | register long __sc5 __asm__ ("r5") = (long) argv; | 331 | register long __sc5 __asm__ ("r5") = (long) argv; |
326 | register long __sc6 __asm__ ("r6") = (long) envp; | 332 | register long __sc6 __asm__ ("r6") = (long) envp; |
327 | __asm__ __volatile__ ("trapa #0x13" : "=z" (__sc0) | 333 | __asm__ __volatile__ (SYSCALL_ARG3 : "=z" (__sc0) |
328 | : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6) | 334 | : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6) |
329 | : "memory"); | 335 | : "memory"); |
330 | return __sc0; | 336 | return __sc0; |
diff --git a/arch/sh/kernel/traps.c b/arch/sh/kernel/traps.c index 3762d9dc2046..ec110157992d 100644 --- a/arch/sh/kernel/traps.c +++ b/arch/sh/kernel/traps.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/kallsyms.h> | 19 | #include <linux/kallsyms.h> |
20 | #include <linux/io.h> | 20 | #include <linux/io.h> |
21 | #include <linux/debug_locks.h> | 21 | #include <linux/debug_locks.h> |
22 | #include <linux/limits.h> | ||
22 | #include <asm/system.h> | 23 | #include <asm/system.h> |
23 | #include <asm/uaccess.h> | 24 | #include <asm/uaccess.h> |
24 | 25 | ||
@@ -129,6 +130,40 @@ static int die_if_no_fixup(const char * str, struct pt_regs * regs, long err) | |||
129 | return -EFAULT; | 130 | return -EFAULT; |
130 | } | 131 | } |
131 | 132 | ||
133 | #ifdef CONFIG_BUG | ||
134 | #ifdef CONFIG_DEBUG_BUGVERBOSE | ||
135 | static inline void do_bug_verbose(struct pt_regs *regs) | ||
136 | { | ||
137 | struct bug_frame f; | ||
138 | long len; | ||
139 | |||
140 | if (__copy_from_user(&f, (const void __user *)regs->pc, | ||
141 | sizeof(struct bug_frame))) | ||
142 | return; | ||
143 | |||
144 | len = __strnlen_user(f.file, PATH_MAX) - 1; | ||
145 | if (unlikely(len < 0 || len >= PATH_MAX)) | ||
146 | f.file = "<bad filename>"; | ||
147 | len = __strnlen_user(f.func, PATH_MAX) - 1; | ||
148 | if (unlikely(len < 0 || len >= PATH_MAX)) | ||
149 | f.func = "<bad function>"; | ||
150 | |||
151 | printk(KERN_ALERT "kernel BUG in %s() at %s:%d!\n", | ||
152 | f.func, f.file, f.line); | ||
153 | } | ||
154 | #else | ||
155 | static inline void do_bug_verbose(struct pt_regs *regs) | ||
156 | { | ||
157 | } | ||
158 | #endif /* CONFIG_DEBUG_BUGVERBOSE */ | ||
159 | #endif /* CONFIG_BUG */ | ||
160 | |||
161 | void handle_BUG(struct pt_regs *regs) | ||
162 | { | ||
163 | do_bug_verbose(regs); | ||
164 | die("Kernel BUG", regs, TRAPA_BUG_OPCODE & 0xff); | ||
165 | } | ||
166 | |||
132 | /* | 167 | /* |
133 | * handle an instruction that does an unaligned memory access by emulating the | 168 | * handle an instruction that does an unaligned memory access by emulating the |
134 | * desired behaviour | 169 | * desired behaviour |
diff --git a/arch/sh/kernel/vmlinux.lds.S b/arch/sh/kernel/vmlinux.lds.S index 77b4026d5688..f34bdcc33a7d 100644 --- a/arch/sh/kernel/vmlinux.lds.S +++ b/arch/sh/kernel/vmlinux.lds.S | |||
@@ -51,7 +51,7 @@ SECTIONS | |||
51 | } | 51 | } |
52 | 52 | ||
53 | . = ALIGN(PAGE_SIZE); | 53 | . = ALIGN(PAGE_SIZE); |
54 | .data.page_aligned : { *(.data.idt) } | 54 | .data.page_aligned : { *(.data.page_aligned) } |
55 | 55 | ||
56 | . = ALIGN(32); | 56 | . = ALIGN(32); |
57 | __per_cpu_start = .; | 57 | __per_cpu_start = .; |
diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig index 4e0362f50384..29f4ee35c6dc 100644 --- a/arch/sh/mm/Kconfig +++ b/arch/sh/mm/Kconfig | |||
@@ -35,6 +35,9 @@ config CPU_SUBTYPE_ST40 | |||
35 | select CPU_SH4 | 35 | select CPU_SH4 |
36 | select CPU_HAS_INTC2_IRQ | 36 | select CPU_HAS_INTC2_IRQ |
37 | 37 | ||
38 | config CPU_SHX2 | ||
39 | bool | ||
40 | |||
38 | # | 41 | # |
39 | # Processor subtypes | 42 | # Processor subtypes |
40 | # | 43 | # |
@@ -180,6 +183,7 @@ config CPU_SUBTYPE_SH7780 | |||
180 | config CPU_SUBTYPE_SH7785 | 183 | config CPU_SUBTYPE_SH7785 |
181 | bool "Support SH7785 processor" | 184 | bool "Support SH7785 processor" |
182 | select CPU_SH4A | 185 | select CPU_SH4A |
186 | select CPU_SHX2 | ||
183 | select CPU_HAS_INTC2_IRQ | 187 | select CPU_HAS_INTC2_IRQ |
184 | 188 | ||
185 | comment "SH4AL-DSP Processor Support" | 189 | comment "SH4AL-DSP Processor Support" |
@@ -192,6 +196,12 @@ config CPU_SUBTYPE_SH7343 | |||
192 | bool "Support SH7343 processor" | 196 | bool "Support SH7343 processor" |
193 | select CPU_SH4AL_DSP | 197 | select CPU_SH4AL_DSP |
194 | 198 | ||
199 | config CPU_SUBTYPE_SH7722 | ||
200 | bool "Support SH7722 processor" | ||
201 | select CPU_SH4AL_DSP | ||
202 | select CPU_SHX2 | ||
203 | select CPU_HAS_IPR_IRQ | ||
204 | |||
195 | endmenu | 205 | endmenu |
196 | 206 | ||
197 | menu "Memory management options" | 207 | menu "Memory management options" |
@@ -250,7 +260,7 @@ config 32BIT | |||
250 | 260 | ||
251 | config X2TLB | 261 | config X2TLB |
252 | bool "Enable extended TLB mode" | 262 | bool "Enable extended TLB mode" |
253 | depends on CPU_SUBTYPE_SH7785 && MMU && EXPERIMENTAL | 263 | depends on CPU_SHX2 && MMU && EXPERIMENTAL |
254 | help | 264 | help |
255 | Selecting this option will enable the extended mode of the SH-X2 | 265 | Selecting this option will enable the extended mode of the SH-X2 |
256 | TLB. For legacy SH-X behaviour and interoperability, say N. For | 266 | TLB. For legacy SH-X behaviour and interoperability, say N. For |
diff --git a/arch/sh/mm/cache-sh4.c b/arch/sh/mm/cache-sh4.c index ae531affccbd..c6955157c989 100644 --- a/arch/sh/mm/cache-sh4.c +++ b/arch/sh/mm/cache-sh4.c | |||
@@ -107,7 +107,7 @@ void __init p3_cache_init(void) | |||
107 | 107 | ||
108 | emit_cache_params(); | 108 | emit_cache_params(); |
109 | 109 | ||
110 | if (remap_area_pages(P3SEG, 0, PAGE_SIZE * 4, _PAGE_CACHABLE)) | 110 | if (ioremap_page_range(P3SEG, P3SEG + (PAGE_SIZE * 4), 0, PAGE_KERNEL)) |
111 | panic("%s failed.", __FUNCTION__); | 111 | panic("%s failed.", __FUNCTION__); |
112 | 112 | ||
113 | for (i = 0; i < cpu_data->dcache.n_aliases; i++) | 113 | for (i = 0; i < cpu_data->dcache.n_aliases; i++) |
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c index 59f4cc18235b..29bd37b1488e 100644 --- a/arch/sh/mm/init.c +++ b/arch/sh/mm/init.c | |||
@@ -77,6 +77,7 @@ void show_mem(void) | |||
77 | printk("%d pages swap cached\n",cached); | 77 | printk("%d pages swap cached\n",cached); |
78 | } | 78 | } |
79 | 79 | ||
80 | #ifdef CONFIG_MMU | ||
80 | static void set_pte_phys(unsigned long addr, unsigned long phys, pgprot_t prot) | 81 | static void set_pte_phys(unsigned long addr, unsigned long phys, pgprot_t prot) |
81 | { | 82 | { |
82 | pgd_t *pgd; | 83 | pgd_t *pgd; |
@@ -139,6 +140,7 @@ void __set_fixmap(enum fixed_addresses idx, unsigned long phys, pgprot_t prot) | |||
139 | 140 | ||
140 | set_pte_phys(address, phys, prot); | 141 | set_pte_phys(address, phys, prot); |
141 | } | 142 | } |
143 | #endif /* CONFIG_MMU */ | ||
142 | 144 | ||
143 | /* References to section boundaries */ | 145 | /* References to section boundaries */ |
144 | 146 | ||
diff --git a/arch/x86_64/kernel/cpufreq/Kconfig b/arch/x86_64/kernel/cpufreq/Kconfig index 81f1562e5393..3abcfa3e1ed7 100644 --- a/arch/x86_64/kernel/cpufreq/Kconfig +++ b/arch/x86_64/kernel/cpufreq/Kconfig | |||
@@ -27,10 +27,13 @@ config X86_POWERNOW_K8_ACPI | |||
27 | default y | 27 | default y |
28 | 28 | ||
29 | config X86_SPEEDSTEP_CENTRINO | 29 | config X86_SPEEDSTEP_CENTRINO |
30 | tristate "Intel Enhanced SpeedStep" | 30 | tristate "Intel Enhanced SpeedStep (deprecated)" |
31 | select CPU_FREQ_TABLE | 31 | select CPU_FREQ_TABLE |
32 | depends on ACPI_PROCESSOR | 32 | depends on ACPI_PROCESSOR |
33 | help | 33 | help |
34 | This is deprecated and this functionality is now merged into | ||
35 | acpi_cpufreq (X86_ACPI_CPUFREQ). Use that driver instead of | ||
36 | speedstep_centrino. | ||
34 | This adds the CPUFreq driver for Enhanced SpeedStep enabled | 37 | This adds the CPUFreq driver for Enhanced SpeedStep enabled |
35 | mobile CPUs. This means Intel Pentium M (Centrino) CPUs | 38 | mobile CPUs. This means Intel Pentium M (Centrino) CPUs |
36 | or 64bit enabled Intel Xeons. | 39 | or 64bit enabled Intel Xeons. |
@@ -50,6 +53,7 @@ config X86_ACPI_CPUFREQ | |||
50 | help | 53 | help |
51 | This driver adds a CPUFreq driver which utilizes the ACPI | 54 | This driver adds a CPUFreq driver which utilizes the ACPI |
52 | Processor Performance States. | 55 | Processor Performance States. |
56 | This driver also supports Intel Enhanced Speedstep. | ||
53 | 57 | ||
54 | For details, take a look at <file:Documentation/cpu-freq/>. | 58 | For details, take a look at <file:Documentation/cpu-freq/>. |
55 | 59 | ||
diff --git a/arch/x86_64/kernel/cpufreq/Makefile b/arch/x86_64/kernel/cpufreq/Makefile index d8b593879224..753ce1dd418e 100644 --- a/arch/x86_64/kernel/cpufreq/Makefile +++ b/arch/x86_64/kernel/cpufreq/Makefile | |||
@@ -5,8 +5,8 @@ | |||
5 | SRCDIR := ../../../i386/kernel/cpu/cpufreq | 5 | SRCDIR := ../../../i386/kernel/cpu/cpufreq |
6 | 6 | ||
7 | obj-$(CONFIG_X86_POWERNOW_K8) += powernow-k8.o | 7 | obj-$(CONFIG_X86_POWERNOW_K8) += powernow-k8.o |
8 | obj-$(CONFIG_X86_SPEEDSTEP_CENTRINO) += speedstep-centrino.o | ||
9 | obj-$(CONFIG_X86_ACPI_CPUFREQ) += acpi-cpufreq.o | 8 | obj-$(CONFIG_X86_ACPI_CPUFREQ) += acpi-cpufreq.o |
9 | obj-$(CONFIG_X86_SPEEDSTEP_CENTRINO) += speedstep-centrino.o | ||
10 | obj-$(CONFIG_X86_P4_CLOCKMOD) += p4-clockmod.o | 10 | obj-$(CONFIG_X86_P4_CLOCKMOD) += p4-clockmod.o |
11 | obj-$(CONFIG_X86_SPEEDSTEP_LIB) += speedstep-lib.o | 11 | obj-$(CONFIG_X86_SPEEDSTEP_LIB) += speedstep-lib.o |
12 | 12 | ||
diff --git a/drivers/acorn/char/i2c.c b/drivers/acorn/char/i2c.c index bdb9c8b78ed8..9e584a7af434 100644 --- a/drivers/acorn/char/i2c.c +++ b/drivers/acorn/char/i2c.c | |||
@@ -360,7 +360,7 @@ static int __init i2c_ioc_init(void) | |||
360 | if (ret >= 0){ | 360 | if (ret >= 0){ |
361 | ret = misc_register(&rtc_dev); | 361 | ret = misc_register(&rtc_dev); |
362 | if(ret < 0) | 362 | if(ret < 0) |
363 | i2c_bit_del_bus(&ioc_ops); | 363 | i2c_del_adapter(&ioc_ops); |
364 | } | 364 | } |
365 | 365 | ||
366 | return ret; | 366 | return ret; |
diff --git a/drivers/char/watchdog/at91rm9200_wdt.c b/drivers/char/watchdog/at91rm9200_wdt.c index cb86967e2c5f..38bd37372599 100644 --- a/drivers/char/watchdog/at91rm9200_wdt.c +++ b/drivers/char/watchdog/at91rm9200_wdt.c | |||
@@ -203,9 +203,9 @@ static int __init at91wdt_probe(struct platform_device *pdev) | |||
203 | { | 203 | { |
204 | int res; | 204 | int res; |
205 | 205 | ||
206 | if (at91wdt_miscdev.dev) | 206 | if (at91wdt_miscdev.parent) |
207 | return -EBUSY; | 207 | return -EBUSY; |
208 | at91wdt_miscdev.dev = &pdev->dev; | 208 | at91wdt_miscdev.parent = &pdev->dev; |
209 | 209 | ||
210 | res = misc_register(&at91wdt_miscdev); | 210 | res = misc_register(&at91wdt_miscdev); |
211 | if (res) | 211 | if (res) |
@@ -221,7 +221,7 @@ static int __exit at91wdt_remove(struct platform_device *pdev) | |||
221 | 221 | ||
222 | res = misc_deregister(&at91wdt_miscdev); | 222 | res = misc_deregister(&at91wdt_miscdev); |
223 | if (!res) | 223 | if (!res) |
224 | at91wdt_miscdev.dev = NULL; | 224 | at91wdt_miscdev.parent = NULL; |
225 | 225 | ||
226 | return res; | 226 | return res; |
227 | } | 227 | } |
diff --git a/drivers/char/watchdog/mpcore_wdt.c b/drivers/char/watchdog/mpcore_wdt.c index 3404a9c67f08..e88947f8fe53 100644 --- a/drivers/char/watchdog/mpcore_wdt.c +++ b/drivers/char/watchdog/mpcore_wdt.c | |||
@@ -347,7 +347,7 @@ static int __devinit mpcore_wdt_probe(struct platform_device *dev) | |||
347 | goto err_free; | 347 | goto err_free; |
348 | } | 348 | } |
349 | 349 | ||
350 | mpcore_wdt_miscdev.dev = &dev->dev; | 350 | mpcore_wdt_miscdev.parent = &dev->dev; |
351 | ret = misc_register(&mpcore_wdt_miscdev); | 351 | ret = misc_register(&mpcore_wdt_miscdev); |
352 | if (ret) { | 352 | if (ret) { |
353 | dev_printk(KERN_ERR, _dev, "cannot register miscdev on minor=%d (err=%d)\n", | 353 | dev_printk(KERN_ERR, _dev, "cannot register miscdev on minor=%d (err=%d)\n", |
diff --git a/drivers/char/watchdog/omap_wdt.c b/drivers/char/watchdog/omap_wdt.c index 5dbd7dc2936f..6c6f97332dbb 100644 --- a/drivers/char/watchdog/omap_wdt.c +++ b/drivers/char/watchdog/omap_wdt.c | |||
@@ -290,7 +290,7 @@ static int __init omap_wdt_probe(struct platform_device *pdev) | |||
290 | omap_wdt_disable(); | 290 | omap_wdt_disable(); |
291 | omap_wdt_adjust_timeout(timer_margin); | 291 | omap_wdt_adjust_timeout(timer_margin); |
292 | 292 | ||
293 | omap_wdt_miscdev.dev = &pdev->dev; | 293 | omap_wdt_miscdev.parent = &pdev->dev; |
294 | ret = misc_register(&omap_wdt_miscdev); | 294 | ret = misc_register(&omap_wdt_miscdev); |
295 | if (ret) | 295 | if (ret) |
296 | goto fail; | 296 | goto fail; |
diff --git a/drivers/char/watchdog/pcwd_usb.c b/drivers/char/watchdog/pcwd_usb.c index 61138726b501..2da5ac99687c 100644 --- a/drivers/char/watchdog/pcwd_usb.c +++ b/drivers/char/watchdog/pcwd_usb.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <asm/uaccess.h> | 42 | #include <asm/uaccess.h> |
43 | #include <linux/usb.h> | 43 | #include <linux/usb.h> |
44 | #include <linux/mutex.h> | 44 | #include <linux/mutex.h> |
45 | #include <linux/hid.h> /* For HID_REQ_SET_REPORT & HID_DT_REPORT */ | ||
45 | 46 | ||
46 | 47 | ||
47 | #ifdef CONFIG_USB_DEBUG | 48 | #ifdef CONFIG_USB_DEBUG |
@@ -109,10 +110,6 @@ MODULE_DEVICE_TABLE (usb, usb_pcwd_table); | |||
109 | #define CMD_ENABLE_WATCHDOG 0x30 /* Enable / Disable Watchdog */ | 110 | #define CMD_ENABLE_WATCHDOG 0x30 /* Enable / Disable Watchdog */ |
110 | #define CMD_DISABLE_WATCHDOG CMD_ENABLE_WATCHDOG | 111 | #define CMD_DISABLE_WATCHDOG CMD_ENABLE_WATCHDOG |
111 | 112 | ||
112 | /* Some defines that I like to be somewhere else like include/linux/usb_hid.h */ | ||
113 | #define HID_REQ_SET_REPORT 0x09 | ||
114 | #define HID_DT_REPORT (USB_TYPE_CLASS | 0x02) | ||
115 | |||
116 | /* We can only use 1 card due to the /dev/watchdog restriction */ | 113 | /* We can only use 1 card due to the /dev/watchdog restriction */ |
117 | static int cards_found; | 114 | static int cards_found; |
118 | 115 | ||
diff --git a/drivers/char/watchdog/rm9k_wdt.c b/drivers/char/watchdog/rm9k_wdt.c index ec3909371c21..7576a13e86bc 100644 --- a/drivers/char/watchdog/rm9k_wdt.c +++ b/drivers/char/watchdog/rm9k_wdt.c | |||
@@ -47,7 +47,7 @@ | |||
47 | 47 | ||
48 | 48 | ||
49 | /* Function prototypes */ | 49 | /* Function prototypes */ |
50 | static irqreturn_t wdt_gpi_irqhdl(int, void *, struct pt_regs *); | 50 | static irqreturn_t wdt_gpi_irqhdl(int, void *); |
51 | static void wdt_gpi_start(void); | 51 | static void wdt_gpi_start(void); |
52 | static void wdt_gpi_stop(void); | 52 | static void wdt_gpi_stop(void); |
53 | static void wdt_gpi_set_timeout(unsigned int); | 53 | static void wdt_gpi_set_timeout(unsigned int); |
@@ -94,8 +94,28 @@ module_param(nowayout, bool, 0444); | |||
94 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be disabled once started"); | 94 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be disabled once started"); |
95 | 95 | ||
96 | 96 | ||
97 | /* Kernel interfaces */ | ||
98 | static struct file_operations fops = { | ||
99 | .owner = THIS_MODULE, | ||
100 | .open = wdt_gpi_open, | ||
101 | .release = wdt_gpi_release, | ||
102 | .write = wdt_gpi_write, | ||
103 | .unlocked_ioctl = wdt_gpi_ioctl, | ||
104 | }; | ||
105 | |||
106 | static struct miscdevice miscdev = { | ||
107 | .minor = WATCHDOG_MINOR, | ||
108 | .name = wdt_gpi_name, | ||
109 | .fops = &fops, | ||
110 | }; | ||
111 | |||
112 | static struct notifier_block wdt_gpi_shutdown = { | ||
113 | .notifier_call = wdt_gpi_notify, | ||
114 | }; | ||
115 | |||
116 | |||
97 | /* Interrupt handler */ | 117 | /* Interrupt handler */ |
98 | static irqreturn_t wdt_gpi_irqhdl(int irq, void *ctxt, struct pt_regs *regs) | 118 | static irqreturn_t wdt_gpi_irqhdl(int irq, void *ctxt) |
99 | { | 119 | { |
100 | if (!unlikely(__raw_readl(wd_regs + 0x0008) & 0x1)) | 120 | if (!unlikely(__raw_readl(wd_regs + 0x0008) & 0x1)) |
101 | return IRQ_NONE; | 121 | return IRQ_NONE; |
@@ -312,26 +332,6 @@ wdt_gpi_notify(struct notifier_block *this, unsigned long code, void *unused) | |||
312 | } | 332 | } |
313 | 333 | ||
314 | 334 | ||
315 | /* Kernel interfaces */ | ||
316 | static struct file_operations fops = { | ||
317 | .owner = THIS_MODULE, | ||
318 | .open = wdt_gpi_open, | ||
319 | .release = wdt_gpi_release, | ||
320 | .write = wdt_gpi_write, | ||
321 | .unlocked_ioctl = wdt_gpi_ioctl, | ||
322 | }; | ||
323 | |||
324 | static struct miscdevice miscdev = { | ||
325 | .minor = WATCHDOG_MINOR, | ||
326 | .name = wdt_gpi_name, | ||
327 | .fops = &fops, | ||
328 | }; | ||
329 | |||
330 | static struct notifier_block wdt_gpi_shutdown = { | ||
331 | .notifier_call = wdt_gpi_notify, | ||
332 | }; | ||
333 | |||
334 | |||
335 | /* Init & exit procedures */ | 335 | /* Init & exit procedures */ |
336 | static const struct resource * | 336 | static const struct resource * |
337 | wdt_gpi_get_resource(struct platform_device *pdv, const char *name, | 337 | wdt_gpi_get_resource(struct platform_device *pdv, const char *name, |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 47ab42db122a..9fb2edf36611 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -29,7 +29,8 @@ | |||
29 | #include <linux/completion.h> | 29 | #include <linux/completion.h> |
30 | #include <linux/mutex.h> | 30 | #include <linux/mutex.h> |
31 | 31 | ||
32 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_CORE, "cpufreq-core", msg) | 32 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_CORE, \ |
33 | "cpufreq-core", msg) | ||
33 | 34 | ||
34 | /** | 35 | /** |
35 | * The "cpufreq driver" - the arch- or hardware-dependent low | 36 | * The "cpufreq driver" - the arch- or hardware-dependent low |
@@ -151,7 +152,8 @@ static void cpufreq_debug_disable_ratelimit(void) | |||
151 | spin_unlock_irqrestore(&disable_ratelimit_lock, flags); | 152 | spin_unlock_irqrestore(&disable_ratelimit_lock, flags); |
152 | } | 153 | } |
153 | 154 | ||
154 | void cpufreq_debug_printk(unsigned int type, const char *prefix, const char *fmt, ...) | 155 | void cpufreq_debug_printk(unsigned int type, const char *prefix, |
156 | const char *fmt, ...) | ||
155 | { | 157 | { |
156 | char s[256]; | 158 | char s[256]; |
157 | va_list args; | 159 | va_list args; |
@@ -161,7 +163,8 @@ void cpufreq_debug_printk(unsigned int type, const char *prefix, const char *fmt | |||
161 | WARN_ON(!prefix); | 163 | WARN_ON(!prefix); |
162 | if (type & debug) { | 164 | if (type & debug) { |
163 | spin_lock_irqsave(&disable_ratelimit_lock, flags); | 165 | spin_lock_irqsave(&disable_ratelimit_lock, flags); |
164 | if (!disable_ratelimit && debug_ratelimit && !printk_ratelimit()) { | 166 | if (!disable_ratelimit && debug_ratelimit |
167 | && !printk_ratelimit()) { | ||
165 | spin_unlock_irqrestore(&disable_ratelimit_lock, flags); | 168 | spin_unlock_irqrestore(&disable_ratelimit_lock, flags); |
166 | return; | 169 | return; |
167 | } | 170 | } |
@@ -182,10 +185,12 @@ EXPORT_SYMBOL(cpufreq_debug_printk); | |||
182 | 185 | ||
183 | 186 | ||
184 | module_param(debug, uint, 0644); | 187 | module_param(debug, uint, 0644); |
185 | MODULE_PARM_DESC(debug, "CPUfreq debugging: add 1 to debug core, 2 to debug drivers, and 4 to debug governors."); | 188 | MODULE_PARM_DESC(debug, "CPUfreq debugging: add 1 to debug core," |
189 | " 2 to debug drivers, and 4 to debug governors."); | ||
186 | 190 | ||
187 | module_param(debug_ratelimit, uint, 0644); | 191 | module_param(debug_ratelimit, uint, 0644); |
188 | MODULE_PARM_DESC(debug_ratelimit, "CPUfreq debugging: set to 0 to disable ratelimiting."); | 192 | MODULE_PARM_DESC(debug_ratelimit, "CPUfreq debugging:" |
193 | " set to 0 to disable ratelimiting."); | ||
189 | 194 | ||
190 | #else /* !CONFIG_CPU_FREQ_DEBUG */ | 195 | #else /* !CONFIG_CPU_FREQ_DEBUG */ |
191 | 196 | ||
@@ -219,17 +224,23 @@ static void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci) | |||
219 | if (!l_p_j_ref_freq) { | 224 | if (!l_p_j_ref_freq) { |
220 | l_p_j_ref = loops_per_jiffy; | 225 | l_p_j_ref = loops_per_jiffy; |
221 | l_p_j_ref_freq = ci->old; | 226 | l_p_j_ref_freq = ci->old; |
222 | dprintk("saving %lu as reference value for loops_per_jiffy; freq is %u kHz\n", l_p_j_ref, l_p_j_ref_freq); | 227 | dprintk("saving %lu as reference value for loops_per_jiffy;" |
228 | "freq is %u kHz\n", l_p_j_ref, l_p_j_ref_freq); | ||
223 | } | 229 | } |
224 | if ((val == CPUFREQ_PRECHANGE && ci->old < ci->new) || | 230 | if ((val == CPUFREQ_PRECHANGE && ci->old < ci->new) || |
225 | (val == CPUFREQ_POSTCHANGE && ci->old > ci->new) || | 231 | (val == CPUFREQ_POSTCHANGE && ci->old > ci->new) || |
226 | (val == CPUFREQ_RESUMECHANGE || val == CPUFREQ_SUSPENDCHANGE)) { | 232 | (val == CPUFREQ_RESUMECHANGE || val == CPUFREQ_SUSPENDCHANGE)) { |
227 | loops_per_jiffy = cpufreq_scale(l_p_j_ref, l_p_j_ref_freq, ci->new); | 233 | loops_per_jiffy = cpufreq_scale(l_p_j_ref, l_p_j_ref_freq, |
228 | dprintk("scaling loops_per_jiffy to %lu for frequency %u kHz\n", loops_per_jiffy, ci->new); | 234 | ci->new); |
235 | dprintk("scaling loops_per_jiffy to %lu" | ||
236 | "for frequency %u kHz\n", loops_per_jiffy, ci->new); | ||
229 | } | 237 | } |
230 | } | 238 | } |
231 | #else | 239 | #else |
232 | static inline void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci) { return; } | 240 | static inline void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci) |
241 | { | ||
242 | return; | ||
243 | } | ||
233 | #endif | 244 | #endif |
234 | 245 | ||
235 | 246 | ||
@@ -316,7 +327,8 @@ static int cpufreq_parse_governor (char *str_governor, unsigned int *policy, | |||
316 | if (!strnicmp(str_governor, "performance", CPUFREQ_NAME_LEN)) { | 327 | if (!strnicmp(str_governor, "performance", CPUFREQ_NAME_LEN)) { |
317 | *policy = CPUFREQ_POLICY_PERFORMANCE; | 328 | *policy = CPUFREQ_POLICY_PERFORMANCE; |
318 | err = 0; | 329 | err = 0; |
319 | } else if (!strnicmp(str_governor, "powersave", CPUFREQ_NAME_LEN)) { | 330 | } else if (!strnicmp(str_governor, "powersave", |
331 | CPUFREQ_NAME_LEN)) { | ||
320 | *policy = CPUFREQ_POLICY_POWERSAVE; | 332 | *policy = CPUFREQ_POLICY_POWERSAVE; |
321 | err = 0; | 333 | err = 0; |
322 | } | 334 | } |
@@ -328,7 +340,8 @@ static int cpufreq_parse_governor (char *str_governor, unsigned int *policy, | |||
328 | t = __find_governor(str_governor); | 340 | t = __find_governor(str_governor); |
329 | 341 | ||
330 | if (t == NULL) { | 342 | if (t == NULL) { |
331 | char *name = kasprintf(GFP_KERNEL, "cpufreq_%s", str_governor); | 343 | char *name = kasprintf(GFP_KERNEL, "cpufreq_%s", |
344 | str_governor); | ||
332 | 345 | ||
333 | if (name) { | 346 | if (name) { |
334 | int ret; | 347 | int ret; |
@@ -361,7 +374,8 @@ extern struct sysdev_class cpu_sysdev_class; | |||
361 | 374 | ||
362 | 375 | ||
363 | /** | 376 | /** |
364 | * cpufreq_per_cpu_attr_read() / show_##file_name() - print out cpufreq information | 377 | * cpufreq_per_cpu_attr_read() / show_##file_name() - |
378 | * print out cpufreq information | ||
365 | * | 379 | * |
366 | * Write out information from cpufreq_driver->policy[cpu]; object must be | 380 | * Write out information from cpufreq_driver->policy[cpu]; object must be |
367 | * "unsigned int". | 381 | * "unsigned int". |
@@ -380,7 +394,8 @@ show_one(scaling_min_freq, min); | |||
380 | show_one(scaling_max_freq, max); | 394 | show_one(scaling_max_freq, max); |
381 | show_one(scaling_cur_freq, cur); | 395 | show_one(scaling_cur_freq, cur); |
382 | 396 | ||
383 | static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_policy *policy); | 397 | static int __cpufreq_set_policy(struct cpufreq_policy *data, |
398 | struct cpufreq_policy *policy); | ||
384 | 399 | ||
385 | /** | 400 | /** |
386 | * cpufreq_per_cpu_attr_write() / store_##file_name() - sysfs write access | 401 | * cpufreq_per_cpu_attr_write() / store_##file_name() - sysfs write access |
@@ -416,7 +431,8 @@ store_one(scaling_max_freq,max); | |||
416 | /** | 431 | /** |
417 | * show_cpuinfo_cur_freq - current CPU frequency as detected by hardware | 432 | * show_cpuinfo_cur_freq - current CPU frequency as detected by hardware |
418 | */ | 433 | */ |
419 | static ssize_t show_cpuinfo_cur_freq (struct cpufreq_policy * policy, char *buf) | 434 | static ssize_t show_cpuinfo_cur_freq (struct cpufreq_policy * policy, |
435 | char *buf) | ||
420 | { | 436 | { |
421 | unsigned int cur_freq = cpufreq_get(policy->cpu); | 437 | unsigned int cur_freq = cpufreq_get(policy->cpu); |
422 | if (!cur_freq) | 438 | if (!cur_freq) |
@@ -428,7 +444,8 @@ static ssize_t show_cpuinfo_cur_freq (struct cpufreq_policy * policy, char *buf) | |||
428 | /** | 444 | /** |
429 | * show_scaling_governor - show the current policy for the specified CPU | 445 | * show_scaling_governor - show the current policy for the specified CPU |
430 | */ | 446 | */ |
431 | static ssize_t show_scaling_governor (struct cpufreq_policy * policy, char *buf) | 447 | static ssize_t show_scaling_governor (struct cpufreq_policy * policy, |
448 | char *buf) | ||
432 | { | 449 | { |
433 | if(policy->policy == CPUFREQ_POLICY_POWERSAVE) | 450 | if(policy->policy == CPUFREQ_POLICY_POWERSAVE) |
434 | return sprintf(buf, "powersave\n"); | 451 | return sprintf(buf, "powersave\n"); |
@@ -458,7 +475,8 @@ static ssize_t store_scaling_governor (struct cpufreq_policy * policy, | |||
458 | if (ret != 1) | 475 | if (ret != 1) |
459 | return -EINVAL; | 476 | return -EINVAL; |
460 | 477 | ||
461 | if (cpufreq_parse_governor(str_governor, &new_policy.policy, &new_policy.governor)) | 478 | if (cpufreq_parse_governor(str_governor, &new_policy.policy, |
479 | &new_policy.governor)) | ||
462 | return -EINVAL; | 480 | return -EINVAL; |
463 | 481 | ||
464 | lock_cpu_hotplug(); | 482 | lock_cpu_hotplug(); |
@@ -474,7 +492,10 @@ static ssize_t store_scaling_governor (struct cpufreq_policy * policy, | |||
474 | 492 | ||
475 | unlock_cpu_hotplug(); | 493 | unlock_cpu_hotplug(); |
476 | 494 | ||
477 | return ret ? ret : count; | 495 | if (ret) |
496 | return ret; | ||
497 | else | ||
498 | return count; | ||
478 | } | 499 | } |
479 | 500 | ||
480 | /** | 501 | /** |
@@ -488,7 +509,7 @@ static ssize_t show_scaling_driver (struct cpufreq_policy * policy, char *buf) | |||
488 | /** | 509 | /** |
489 | * show_scaling_available_governors - show the available CPUfreq governors | 510 | * show_scaling_available_governors - show the available CPUfreq governors |
490 | */ | 511 | */ |
491 | static ssize_t show_scaling_available_governors (struct cpufreq_policy * policy, | 512 | static ssize_t show_scaling_available_governors (struct cpufreq_policy *policy, |
492 | char *buf) | 513 | char *buf) |
493 | { | 514 | { |
494 | ssize_t i = 0; | 515 | ssize_t i = 0; |
@@ -574,7 +595,11 @@ static ssize_t show(struct kobject * kobj, struct attribute * attr ,char * buf) | |||
574 | policy = cpufreq_cpu_get(policy->cpu); | 595 | policy = cpufreq_cpu_get(policy->cpu); |
575 | if (!policy) | 596 | if (!policy) |
576 | return -EINVAL; | 597 | return -EINVAL; |
577 | ret = fattr->show ? fattr->show(policy,buf) : -EIO; | 598 | if (fattr->show) |
599 | ret = fattr->show(policy, buf); | ||
600 | else | ||
601 | ret = -EIO; | ||
602 | |||
578 | cpufreq_cpu_put(policy); | 603 | cpufreq_cpu_put(policy); |
579 | return ret; | 604 | return ret; |
580 | } | 605 | } |
@@ -588,7 +613,11 @@ static ssize_t store(struct kobject * kobj, struct attribute * attr, | |||
588 | policy = cpufreq_cpu_get(policy->cpu); | 613 | policy = cpufreq_cpu_get(policy->cpu); |
589 | if (!policy) | 614 | if (!policy) |
590 | return -EINVAL; | 615 | return -EINVAL; |
591 | ret = fattr->store ? fattr->store(policy,buf,count) : -EIO; | 616 | if (fattr->store) |
617 | ret = fattr->store(policy, buf, count); | ||
618 | else | ||
619 | ret = -EIO; | ||
620 | |||
592 | cpufreq_cpu_put(policy); | 621 | cpufreq_cpu_put(policy); |
593 | return ret; | 622 | return ret; |
594 | } | 623 | } |
@@ -913,7 +942,8 @@ static void handle_update(struct work_struct *work) | |||
913 | * We adjust to current frequency first, and need to clean up later. So either call | 942 | * We adjust to current frequency first, and need to clean up later. So either call |
914 | * to cpufreq_update_policy() or schedule handle_update()). | 943 | * to cpufreq_update_policy() or schedule handle_update()). |
915 | */ | 944 | */ |
916 | static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, unsigned int new_freq) | 945 | static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, |
946 | unsigned int new_freq) | ||
917 | { | 947 | { |
918 | struct cpufreq_freqs freqs; | 948 | struct cpufreq_freqs freqs; |
919 | 949 | ||
@@ -938,16 +968,16 @@ static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, unsigne | |||
938 | unsigned int cpufreq_quick_get(unsigned int cpu) | 968 | unsigned int cpufreq_quick_get(unsigned int cpu) |
939 | { | 969 | { |
940 | struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); | 970 | struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); |
941 | unsigned int ret = 0; | 971 | unsigned int ret_freq = 0; |
942 | 972 | ||
943 | if (policy) { | 973 | if (policy) { |
944 | mutex_lock(&policy->lock); | 974 | mutex_lock(&policy->lock); |
945 | ret = policy->cur; | 975 | ret_freq = policy->cur; |
946 | mutex_unlock(&policy->lock); | 976 | mutex_unlock(&policy->lock); |
947 | cpufreq_cpu_put(policy); | 977 | cpufreq_cpu_put(policy); |
948 | } | 978 | } |
949 | 979 | ||
950 | return (ret); | 980 | return (ret_freq); |
951 | } | 981 | } |
952 | EXPORT_SYMBOL(cpufreq_quick_get); | 982 | EXPORT_SYMBOL(cpufreq_quick_get); |
953 | 983 | ||
@@ -961,7 +991,7 @@ EXPORT_SYMBOL(cpufreq_quick_get); | |||
961 | unsigned int cpufreq_get(unsigned int cpu) | 991 | unsigned int cpufreq_get(unsigned int cpu) |
962 | { | 992 | { |
963 | struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); | 993 | struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); |
964 | unsigned int ret = 0; | 994 | unsigned int ret_freq = 0; |
965 | 995 | ||
966 | if (!policy) | 996 | if (!policy) |
967 | return 0; | 997 | return 0; |
@@ -971,12 +1001,14 @@ unsigned int cpufreq_get(unsigned int cpu) | |||
971 | 1001 | ||
972 | mutex_lock(&policy->lock); | 1002 | mutex_lock(&policy->lock); |
973 | 1003 | ||
974 | ret = cpufreq_driver->get(cpu); | 1004 | ret_freq = cpufreq_driver->get(cpu); |
975 | 1005 | ||
976 | if (ret && policy->cur && !(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) { | 1006 | if (ret_freq && policy->cur && |
977 | /* verify no discrepancy between actual and saved value exists */ | 1007 | !(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) { |
978 | if (unlikely(ret != policy->cur)) { | 1008 | /* verify no discrepancy between actual and |
979 | cpufreq_out_of_sync(cpu, policy->cur, ret); | 1009 | saved value exists */ |
1010 | if (unlikely(ret_freq != policy->cur)) { | ||
1011 | cpufreq_out_of_sync(cpu, policy->cur, ret_freq); | ||
980 | schedule_work(&policy->update); | 1012 | schedule_work(&policy->update); |
981 | } | 1013 | } |
982 | } | 1014 | } |
@@ -986,7 +1018,7 @@ unsigned int cpufreq_get(unsigned int cpu) | |||
986 | out: | 1018 | out: |
987 | cpufreq_cpu_put(policy); | 1019 | cpufreq_cpu_put(policy); |
988 | 1020 | ||
989 | return (ret); | 1021 | return (ret_freq); |
990 | } | 1022 | } |
991 | EXPORT_SYMBOL(cpufreq_get); | 1023 | EXPORT_SYMBOL(cpufreq_get); |
992 | 1024 | ||
@@ -998,7 +1030,7 @@ EXPORT_SYMBOL(cpufreq_get); | |||
998 | static int cpufreq_suspend(struct sys_device * sysdev, pm_message_t pmsg) | 1030 | static int cpufreq_suspend(struct sys_device * sysdev, pm_message_t pmsg) |
999 | { | 1031 | { |
1000 | int cpu = sysdev->id; | 1032 | int cpu = sysdev->id; |
1001 | unsigned int ret = 0; | 1033 | int ret = 0; |
1002 | unsigned int cur_freq = 0; | 1034 | unsigned int cur_freq = 0; |
1003 | struct cpufreq_policy *cpu_policy; | 1035 | struct cpufreq_policy *cpu_policy; |
1004 | 1036 | ||
@@ -1080,7 +1112,7 @@ out: | |||
1080 | static int cpufreq_resume(struct sys_device * sysdev) | 1112 | static int cpufreq_resume(struct sys_device * sysdev) |
1081 | { | 1113 | { |
1082 | int cpu = sysdev->id; | 1114 | int cpu = sysdev->id; |
1083 | unsigned int ret = 0; | 1115 | int ret = 0; |
1084 | struct cpufreq_policy *cpu_policy; | 1116 | struct cpufreq_policy *cpu_policy; |
1085 | 1117 | ||
1086 | dprintk("resuming cpu %u\n", cpu); | 1118 | dprintk("resuming cpu %u\n", cpu); |
@@ -1276,22 +1308,45 @@ int cpufreq_driver_target(struct cpufreq_policy *policy, | |||
1276 | } | 1308 | } |
1277 | EXPORT_SYMBOL_GPL(cpufreq_driver_target); | 1309 | EXPORT_SYMBOL_GPL(cpufreq_driver_target); |
1278 | 1310 | ||
1311 | int cpufreq_driver_getavg(struct cpufreq_policy *policy) | ||
1312 | { | ||
1313 | int ret = 0; | ||
1314 | |||
1315 | policy = cpufreq_cpu_get(policy->cpu); | ||
1316 | if (!policy) | ||
1317 | return -EINVAL; | ||
1318 | |||
1319 | mutex_lock(&policy->lock); | ||
1320 | |||
1321 | if (cpu_online(policy->cpu) && cpufreq_driver->getavg) | ||
1322 | ret = cpufreq_driver->getavg(policy->cpu); | ||
1323 | |||
1324 | mutex_unlock(&policy->lock); | ||
1325 | |||
1326 | cpufreq_cpu_put(policy); | ||
1327 | return ret; | ||
1328 | } | ||
1329 | EXPORT_SYMBOL_GPL(cpufreq_driver_getavg); | ||
1330 | |||
1279 | /* | 1331 | /* |
1280 | * Locking: Must be called with the lock_cpu_hotplug() lock held | 1332 | * Locking: Must be called with the lock_cpu_hotplug() lock held |
1281 | * when "event" is CPUFREQ_GOV_LIMITS | 1333 | * when "event" is CPUFREQ_GOV_LIMITS |
1282 | */ | 1334 | */ |
1283 | 1335 | ||
1284 | static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event) | 1336 | static int __cpufreq_governor(struct cpufreq_policy *policy, |
1337 | unsigned int event) | ||
1285 | { | 1338 | { |
1286 | int ret; | 1339 | int ret; |
1287 | 1340 | ||
1288 | if (!try_module_get(policy->governor->owner)) | 1341 | if (!try_module_get(policy->governor->owner)) |
1289 | return -EINVAL; | 1342 | return -EINVAL; |
1290 | 1343 | ||
1291 | dprintk("__cpufreq_governor for CPU %u, event %u\n", policy->cpu, event); | 1344 | dprintk("__cpufreq_governor for CPU %u, event %u\n", |
1345 | policy->cpu, event); | ||
1292 | ret = policy->governor->governor(policy, event); | 1346 | ret = policy->governor->governor(policy, event); |
1293 | 1347 | ||
1294 | /* we keep one module reference alive for each CPU governed by this CPU */ | 1348 | /* we keep one module reference alive for |
1349 | each CPU governed by this CPU */ | ||
1295 | if ((event != CPUFREQ_GOV_START) || ret) | 1350 | if ((event != CPUFREQ_GOV_START) || ret) |
1296 | module_put(policy->governor->owner); | 1351 | module_put(policy->governor->owner); |
1297 | if ((event == CPUFREQ_GOV_STOP) && !ret) | 1352 | if ((event == CPUFREQ_GOV_STOP) && !ret) |
@@ -1367,9 +1422,12 @@ EXPORT_SYMBOL(cpufreq_get_policy); | |||
1367 | 1422 | ||
1368 | 1423 | ||
1369 | /* | 1424 | /* |
1425 | * data : current policy. | ||
1426 | * policy : policy to be set. | ||
1370 | * Locking: Must be called with the lock_cpu_hotplug() lock held | 1427 | * Locking: Must be called with the lock_cpu_hotplug() lock held |
1371 | */ | 1428 | */ |
1372 | static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_policy *policy) | 1429 | static int __cpufreq_set_policy(struct cpufreq_policy *data, |
1430 | struct cpufreq_policy *policy) | ||
1373 | { | 1431 | { |
1374 | int ret = 0; | 1432 | int ret = 0; |
1375 | 1433 | ||
@@ -1377,7 +1435,8 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_poli | |||
1377 | dprintk("setting new policy for CPU %u: %u - %u kHz\n", policy->cpu, | 1435 | dprintk("setting new policy for CPU %u: %u - %u kHz\n", policy->cpu, |
1378 | policy->min, policy->max); | 1436 | policy->min, policy->max); |
1379 | 1437 | ||
1380 | memcpy(&policy->cpuinfo, &data->cpuinfo, sizeof(struct cpufreq_cpuinfo)); | 1438 | memcpy(&policy->cpuinfo, &data->cpuinfo, |
1439 | sizeof(struct cpufreq_cpuinfo)); | ||
1381 | 1440 | ||
1382 | if (policy->min > data->min && policy->min > policy->max) { | 1441 | if (policy->min > data->min && policy->min > policy->max) { |
1383 | ret = -EINVAL; | 1442 | ret = -EINVAL; |
@@ -1410,7 +1469,8 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_poli | |||
1410 | data->min = policy->min; | 1469 | data->min = policy->min; |
1411 | data->max = policy->max; | 1470 | data->max = policy->max; |
1412 | 1471 | ||
1413 | dprintk("new min and max freqs are %u - %u kHz\n", data->min, data->max); | 1472 | dprintk("new min and max freqs are %u - %u kHz\n", |
1473 | data->min, data->max); | ||
1414 | 1474 | ||
1415 | if (cpufreq_driver->setpolicy) { | 1475 | if (cpufreq_driver->setpolicy) { |
1416 | data->policy = policy->policy; | 1476 | data->policy = policy->policy; |
@@ -1431,10 +1491,12 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_poli | |||
1431 | data->governor = policy->governor; | 1491 | data->governor = policy->governor; |
1432 | if (__cpufreq_governor(data, CPUFREQ_GOV_START)) { | 1492 | if (__cpufreq_governor(data, CPUFREQ_GOV_START)) { |
1433 | /* new governor failed, so re-start old one */ | 1493 | /* new governor failed, so re-start old one */ |
1434 | dprintk("starting governor %s failed\n", data->governor->name); | 1494 | dprintk("starting governor %s failed\n", |
1495 | data->governor->name); | ||
1435 | if (old_gov) { | 1496 | if (old_gov) { |
1436 | data->governor = old_gov; | 1497 | data->governor = old_gov; |
1437 | __cpufreq_governor(data, CPUFREQ_GOV_START); | 1498 | __cpufreq_governor(data, |
1499 | CPUFREQ_GOV_START); | ||
1438 | } | 1500 | } |
1439 | ret = -EINVAL; | 1501 | ret = -EINVAL; |
1440 | goto error_out; | 1502 | goto error_out; |
@@ -1524,7 +1586,8 @@ int cpufreq_update_policy(unsigned int cpu) | |||
1524 | data->cur = policy.cur; | 1586 | data->cur = policy.cur; |
1525 | } else { | 1587 | } else { |
1526 | if (data->cur != policy.cur) | 1588 | if (data->cur != policy.cur) |
1527 | cpufreq_out_of_sync(cpu, data->cur, policy.cur); | 1589 | cpufreq_out_of_sync(cpu, data->cur, |
1590 | policy.cur); | ||
1528 | } | 1591 | } |
1529 | } | 1592 | } |
1530 | 1593 | ||
@@ -1626,8 +1689,10 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) | |||
1626 | 1689 | ||
1627 | /* if all ->init() calls failed, unregister */ | 1690 | /* if all ->init() calls failed, unregister */ |
1628 | if (ret) { | 1691 | if (ret) { |
1629 | dprintk("no CPU initialized for driver %s\n", driver_data->name); | 1692 | dprintk("no CPU initialized for driver %s\n", |
1630 | sysdev_driver_unregister(&cpu_sysdev_class, &cpufreq_sysdev_driver); | 1693 | driver_data->name); |
1694 | sysdev_driver_unregister(&cpu_sysdev_class, | ||
1695 | &cpufreq_sysdev_driver); | ||
1631 | 1696 | ||
1632 | spin_lock_irqsave(&cpufreq_driver_lock, flags); | 1697 | spin_lock_irqsave(&cpufreq_driver_lock, flags); |
1633 | cpufreq_driver = NULL; | 1698 | cpufreq_driver = NULL; |
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index 5ef5ede5b884..eef0270c6f3d 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c | |||
@@ -44,15 +44,17 @@ | |||
44 | * latency of the processor. The governor will work on any processor with | 44 | * latency of the processor. The governor will work on any processor with |
45 | * transition latency <= 10mS, using appropriate sampling | 45 | * transition latency <= 10mS, using appropriate sampling |
46 | * rate. | 46 | * rate. |
47 | * For CPUs with transition latency > 10mS (mostly drivers with CPUFREQ_ETERNAL) | 47 | * For CPUs with transition latency > 10mS (mostly drivers |
48 | * this governor will not work. | 48 | * with CPUFREQ_ETERNAL), this governor will not work. |
49 | * All times here are in uS. | 49 | * All times here are in uS. |
50 | */ | 50 | */ |
51 | static unsigned int def_sampling_rate; | 51 | static unsigned int def_sampling_rate; |
52 | #define MIN_SAMPLING_RATE_RATIO (2) | 52 | #define MIN_SAMPLING_RATE_RATIO (2) |
53 | /* for correct statistics, we need at least 10 ticks between each measure */ | 53 | /* for correct statistics, we need at least 10 ticks between each measure */ |
54 | #define MIN_STAT_SAMPLING_RATE (MIN_SAMPLING_RATE_RATIO * jiffies_to_usecs(10)) | 54 | #define MIN_STAT_SAMPLING_RATE \ |
55 | #define MIN_SAMPLING_RATE (def_sampling_rate / MIN_SAMPLING_RATE_RATIO) | 55 | (MIN_SAMPLING_RATE_RATIO * jiffies_to_usecs(10)) |
56 | #define MIN_SAMPLING_RATE \ | ||
57 | (def_sampling_rate / MIN_SAMPLING_RATE_RATIO) | ||
56 | #define MAX_SAMPLING_RATE (500 * def_sampling_rate) | 58 | #define MAX_SAMPLING_RATE (500 * def_sampling_rate) |
57 | #define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000) | 59 | #define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000) |
58 | #define DEF_SAMPLING_DOWN_FACTOR (1) | 60 | #define DEF_SAMPLING_DOWN_FACTOR (1) |
@@ -103,11 +105,16 @@ static struct dbs_tuners dbs_tuners_ins = { | |||
103 | 105 | ||
104 | static inline unsigned int get_cpu_idle_time(unsigned int cpu) | 106 | static inline unsigned int get_cpu_idle_time(unsigned int cpu) |
105 | { | 107 | { |
106 | return kstat_cpu(cpu).cpustat.idle + | 108 | unsigned int add_nice = 0, ret; |
109 | |||
110 | if (dbs_tuners_ins.ignore_nice) | ||
111 | add_nice = kstat_cpu(cpu).cpustat.nice; | ||
112 | |||
113 | ret = kstat_cpu(cpu).cpustat.idle + | ||
107 | kstat_cpu(cpu).cpustat.iowait + | 114 | kstat_cpu(cpu).cpustat.iowait + |
108 | ( dbs_tuners_ins.ignore_nice ? | 115 | add_nice; |
109 | kstat_cpu(cpu).cpustat.nice : | 116 | |
110 | 0); | 117 | return ret; |
111 | } | 118 | } |
112 | 119 | ||
113 | /************************** sysfs interface ************************/ | 120 | /************************** sysfs interface ************************/ |
@@ -452,6 +459,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
452 | unsigned int cpu = policy->cpu; | 459 | unsigned int cpu = policy->cpu; |
453 | struct cpu_dbs_info_s *this_dbs_info; | 460 | struct cpu_dbs_info_s *this_dbs_info; |
454 | unsigned int j; | 461 | unsigned int j; |
462 | int rc; | ||
455 | 463 | ||
456 | this_dbs_info = &per_cpu(cpu_dbs_info, cpu); | 464 | this_dbs_info = &per_cpu(cpu_dbs_info, cpu); |
457 | 465 | ||
@@ -468,6 +476,13 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
468 | break; | 476 | break; |
469 | 477 | ||
470 | mutex_lock(&dbs_mutex); | 478 | mutex_lock(&dbs_mutex); |
479 | |||
480 | rc = sysfs_create_group(&policy->kobj, &dbs_attr_group); | ||
481 | if (rc) { | ||
482 | mutex_unlock(&dbs_mutex); | ||
483 | return rc; | ||
484 | } | ||
485 | |||
471 | for_each_cpu_mask(j, policy->cpus) { | 486 | for_each_cpu_mask(j, policy->cpus) { |
472 | struct cpu_dbs_info_s *j_dbs_info; | 487 | struct cpu_dbs_info_s *j_dbs_info; |
473 | j_dbs_info = &per_cpu(cpu_dbs_info, j); | 488 | j_dbs_info = &per_cpu(cpu_dbs_info, j); |
@@ -480,7 +495,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
480 | this_dbs_info->enable = 1; | 495 | this_dbs_info->enable = 1; |
481 | this_dbs_info->down_skip = 0; | 496 | this_dbs_info->down_skip = 0; |
482 | this_dbs_info->requested_freq = policy->cur; | 497 | this_dbs_info->requested_freq = policy->cur; |
483 | sysfs_create_group(&policy->kobj, &dbs_attr_group); | 498 | |
484 | dbs_enable++; | 499 | dbs_enable++; |
485 | /* | 500 | /* |
486 | * Start the timerschedule work, when this governor | 501 | * Start the timerschedule work, when this governor |
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index e1cc5113c2ae..f697449327c6 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c | |||
@@ -41,8 +41,10 @@ | |||
41 | static unsigned int def_sampling_rate; | 41 | static unsigned int def_sampling_rate; |
42 | #define MIN_SAMPLING_RATE_RATIO (2) | 42 | #define MIN_SAMPLING_RATE_RATIO (2) |
43 | /* for correct statistics, we need at least 10 ticks between each measure */ | 43 | /* for correct statistics, we need at least 10 ticks between each measure */ |
44 | #define MIN_STAT_SAMPLING_RATE (MIN_SAMPLING_RATE_RATIO * jiffies_to_usecs(10)) | 44 | #define MIN_STAT_SAMPLING_RATE \ |
45 | #define MIN_SAMPLING_RATE (def_sampling_rate / MIN_SAMPLING_RATE_RATIO) | 45 | (MIN_SAMPLING_RATE_RATIO * jiffies_to_usecs(10)) |
46 | #define MIN_SAMPLING_RATE \ | ||
47 | (def_sampling_rate / MIN_SAMPLING_RATE_RATIO) | ||
46 | #define MAX_SAMPLING_RATE (500 * def_sampling_rate) | 48 | #define MAX_SAMPLING_RATE (500 * def_sampling_rate) |
47 | #define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000) | 49 | #define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000) |
48 | #define TRANSITION_LATENCY_LIMIT (10 * 1000) | 50 | #define TRANSITION_LATENCY_LIMIT (10 * 1000) |
@@ -206,7 +208,8 @@ static ssize_t store_sampling_rate(struct cpufreq_policy *unused, | |||
206 | ret = sscanf(buf, "%u", &input); | 208 | ret = sscanf(buf, "%u", &input); |
207 | 209 | ||
208 | mutex_lock(&dbs_mutex); | 210 | mutex_lock(&dbs_mutex); |
209 | if (ret != 1 || input > MAX_SAMPLING_RATE || input < MIN_SAMPLING_RATE) { | 211 | if (ret != 1 || input > MAX_SAMPLING_RATE |
212 | || input < MIN_SAMPLING_RATE) { | ||
210 | mutex_unlock(&dbs_mutex); | 213 | mutex_unlock(&dbs_mutex); |
211 | return -EINVAL; | 214 | return -EINVAL; |
212 | } | 215 | } |
@@ -397,8 +400,15 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) | |||
397 | * policy. To be safe, we focus 10 points under the threshold. | 400 | * policy. To be safe, we focus 10 points under the threshold. |
398 | */ | 401 | */ |
399 | if (load < (dbs_tuners_ins.up_threshold - 10)) { | 402 | if (load < (dbs_tuners_ins.up_threshold - 10)) { |
400 | unsigned int freq_next = (policy->cur * load) / | 403 | unsigned int freq_next, freq_cur; |
404 | |||
405 | freq_cur = cpufreq_driver_getavg(policy); | ||
406 | if (!freq_cur) | ||
407 | freq_cur = policy->cur; | ||
408 | |||
409 | freq_next = (freq_cur * load) / | ||
401 | (dbs_tuners_ins.up_threshold - 10); | 410 | (dbs_tuners_ins.up_threshold - 10); |
411 | |||
402 | if (!dbs_tuners_ins.powersave_bias) { | 412 | if (!dbs_tuners_ins.powersave_bias) { |
403 | __cpufreq_driver_target(policy, freq_next, | 413 | __cpufreq_driver_target(policy, freq_next, |
404 | CPUFREQ_RELATION_L); | 414 | CPUFREQ_RELATION_L); |
@@ -472,6 +482,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
472 | unsigned int cpu = policy->cpu; | 482 | unsigned int cpu = policy->cpu; |
473 | struct cpu_dbs_info_s *this_dbs_info; | 483 | struct cpu_dbs_info_s *this_dbs_info; |
474 | unsigned int j; | 484 | unsigned int j; |
485 | int rc; | ||
475 | 486 | ||
476 | this_dbs_info = &per_cpu(cpu_dbs_info, cpu); | 487 | this_dbs_info = &per_cpu(cpu_dbs_info, cpu); |
477 | 488 | ||
@@ -494,12 +505,23 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
494 | if (dbs_enable == 1) { | 505 | if (dbs_enable == 1) { |
495 | kondemand_wq = create_workqueue("kondemand"); | 506 | kondemand_wq = create_workqueue("kondemand"); |
496 | if (!kondemand_wq) { | 507 | if (!kondemand_wq) { |
497 | printk(KERN_ERR "Creation of kondemand failed\n"); | 508 | printk(KERN_ERR |
509 | "Creation of kondemand failed\n"); | ||
498 | dbs_enable--; | 510 | dbs_enable--; |
499 | mutex_unlock(&dbs_mutex); | 511 | mutex_unlock(&dbs_mutex); |
500 | return -ENOSPC; | 512 | return -ENOSPC; |
501 | } | 513 | } |
502 | } | 514 | } |
515 | |||
516 | rc = sysfs_create_group(&policy->kobj, &dbs_attr_group); | ||
517 | if (rc) { | ||
518 | if (dbs_enable == 1) | ||
519 | destroy_workqueue(kondemand_wq); | ||
520 | dbs_enable--; | ||
521 | mutex_unlock(&dbs_mutex); | ||
522 | return rc; | ||
523 | } | ||
524 | |||
503 | for_each_cpu_mask(j, policy->cpus) { | 525 | for_each_cpu_mask(j, policy->cpus) { |
504 | struct cpu_dbs_info_s *j_dbs_info; | 526 | struct cpu_dbs_info_s *j_dbs_info; |
505 | j_dbs_info = &per_cpu(cpu_dbs_info, j); | 527 | j_dbs_info = &per_cpu(cpu_dbs_info, j); |
@@ -509,7 +531,6 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
509 | j_dbs_info->prev_cpu_wall = get_jiffies_64(); | 531 | j_dbs_info->prev_cpu_wall = get_jiffies_64(); |
510 | } | 532 | } |
511 | this_dbs_info->enable = 1; | 533 | this_dbs_info->enable = 1; |
512 | sysfs_create_group(&policy->kobj, &dbs_attr_group); | ||
513 | /* | 534 | /* |
514 | * Start the timerschedule work, when this governor | 535 | * Start the timerschedule work, when this governor |
515 | * is used for first time | 536 | * is used for first time |
diff --git a/drivers/cpufreq/cpufreq_performance.c b/drivers/cpufreq/cpufreq_performance.c index de91e3371ef8..e8e1451ef1c1 100644 --- a/drivers/cpufreq/cpufreq_performance.c +++ b/drivers/cpufreq/cpufreq_performance.c | |||
@@ -15,7 +15,8 @@ | |||
15 | #include <linux/cpufreq.h> | 15 | #include <linux/cpufreq.h> |
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | 17 | ||
18 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_GOVERNOR, "performance", msg) | 18 | #define dprintk(msg...) \ |
19 | cpufreq_debug_printk(CPUFREQ_DEBUG_GOVERNOR, "performance", msg) | ||
19 | 20 | ||
20 | 21 | ||
21 | static int cpufreq_governor_performance(struct cpufreq_policy *policy, | 22 | static int cpufreq_governor_performance(struct cpufreq_policy *policy, |
@@ -24,8 +25,10 @@ static int cpufreq_governor_performance(struct cpufreq_policy *policy, | |||
24 | switch (event) { | 25 | switch (event) { |
25 | case CPUFREQ_GOV_START: | 26 | case CPUFREQ_GOV_START: |
26 | case CPUFREQ_GOV_LIMITS: | 27 | case CPUFREQ_GOV_LIMITS: |
27 | dprintk("setting to %u kHz because of event %u\n", policy->max, event); | 28 | dprintk("setting to %u kHz because of event %u\n", |
28 | __cpufreq_driver_target(policy, policy->max, CPUFREQ_RELATION_H); | 29 | policy->max, event); |
30 | __cpufreq_driver_target(policy, policy->max, | ||
31 | CPUFREQ_RELATION_H); | ||
29 | break; | 32 | break; |
30 | default: | 33 | default: |
31 | break; | 34 | break; |
diff --git a/drivers/cpufreq/cpufreq_powersave.c b/drivers/cpufreq/cpufreq_powersave.c index 0a2596044e65..13fe06b94b0a 100644 --- a/drivers/cpufreq/cpufreq_powersave.c +++ b/drivers/cpufreq/cpufreq_powersave.c | |||
@@ -15,7 +15,8 @@ | |||
15 | #include <linux/cpufreq.h> | 15 | #include <linux/cpufreq.h> |
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | 17 | ||
18 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_GOVERNOR, "powersave", msg) | 18 | #define dprintk(msg...) \ |
19 | cpufreq_debug_printk(CPUFREQ_DEBUG_GOVERNOR, "powersave", msg) | ||
19 | 20 | ||
20 | static int cpufreq_governor_powersave(struct cpufreq_policy *policy, | 21 | static int cpufreq_governor_powersave(struct cpufreq_policy *policy, |
21 | unsigned int event) | 22 | unsigned int event) |
@@ -23,8 +24,10 @@ static int cpufreq_governor_powersave(struct cpufreq_policy *policy, | |||
23 | switch (event) { | 24 | switch (event) { |
24 | case CPUFREQ_GOV_START: | 25 | case CPUFREQ_GOV_START: |
25 | case CPUFREQ_GOV_LIMITS: | 26 | case CPUFREQ_GOV_LIMITS: |
26 | dprintk("setting to %u kHz because of event %u\n", policy->min, event); | 27 | dprintk("setting to %u kHz because of event %u\n", |
27 | __cpufreq_driver_target(policy, policy->min, CPUFREQ_RELATION_L); | 28 | policy->min, event); |
29 | __cpufreq_driver_target(policy, policy->min, | ||
30 | CPUFREQ_RELATION_L); | ||
28 | break; | 31 | break; |
29 | default: | 32 | default: |
30 | break; | 33 | break; |
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index c2ecc599dc5f..6742b1adf2c8 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c | |||
@@ -351,8 +351,8 @@ __init cpufreq_stats_init(void) | |||
351 | 351 | ||
352 | register_hotcpu_notifier(&cpufreq_stat_cpu_notifier); | 352 | register_hotcpu_notifier(&cpufreq_stat_cpu_notifier); |
353 | for_each_online_cpu(cpu) { | 353 | for_each_online_cpu(cpu) { |
354 | cpufreq_stat_cpu_callback(&cpufreq_stat_cpu_notifier, CPU_ONLINE, | 354 | cpufreq_stat_cpu_callback(&cpufreq_stat_cpu_notifier, |
355 | (void *)(long)cpu); | 355 | CPU_ONLINE, (void *)(long)cpu); |
356 | } | 356 | } |
357 | return 0; | 357 | return 0; |
358 | } | 358 | } |
@@ -368,14 +368,15 @@ __exit cpufreq_stats_exit(void) | |||
368 | unregister_hotcpu_notifier(&cpufreq_stat_cpu_notifier); | 368 | unregister_hotcpu_notifier(&cpufreq_stat_cpu_notifier); |
369 | lock_cpu_hotplug(); | 369 | lock_cpu_hotplug(); |
370 | for_each_online_cpu(cpu) { | 370 | for_each_online_cpu(cpu) { |
371 | cpufreq_stat_cpu_callback(&cpufreq_stat_cpu_notifier, CPU_DEAD, | 371 | cpufreq_stat_cpu_callback(&cpufreq_stat_cpu_notifier, |
372 | (void *)(long)cpu); | 372 | CPU_DEAD, (void *)(long)cpu); |
373 | } | 373 | } |
374 | unlock_cpu_hotplug(); | 374 | unlock_cpu_hotplug(); |
375 | } | 375 | } |
376 | 376 | ||
377 | MODULE_AUTHOR ("Zou Nan hai <nanhai.zou@intel.com>"); | 377 | MODULE_AUTHOR ("Zou Nan hai <nanhai.zou@intel.com>"); |
378 | MODULE_DESCRIPTION ("'cpufreq_stats' - A driver to export cpufreq stats through sysfs filesystem"); | 378 | MODULE_DESCRIPTION ("'cpufreq_stats' - A driver to export cpufreq stats" |
379 | "through sysfs filesystem"); | ||
379 | MODULE_LICENSE ("GPL"); | 380 | MODULE_LICENSE ("GPL"); |
380 | 381 | ||
381 | module_init(cpufreq_stats_init); | 382 | module_init(cpufreq_stats_init); |
diff --git a/drivers/cpufreq/cpufreq_userspace.c b/drivers/cpufreq/cpufreq_userspace.c index a06c204589cd..2a4eb0bfaf30 100644 --- a/drivers/cpufreq/cpufreq_userspace.c +++ b/drivers/cpufreq/cpufreq_userspace.c | |||
@@ -131,19 +131,26 @@ static int cpufreq_governor_userspace(struct cpufreq_policy *policy, | |||
131 | unsigned int event) | 131 | unsigned int event) |
132 | { | 132 | { |
133 | unsigned int cpu = policy->cpu; | 133 | unsigned int cpu = policy->cpu; |
134 | int rc = 0; | ||
135 | |||
134 | switch (event) { | 136 | switch (event) { |
135 | case CPUFREQ_GOV_START: | 137 | case CPUFREQ_GOV_START: |
136 | if (!cpu_online(cpu)) | 138 | if (!cpu_online(cpu)) |
137 | return -EINVAL; | 139 | return -EINVAL; |
138 | BUG_ON(!policy->cur); | 140 | BUG_ON(!policy->cur); |
139 | mutex_lock(&userspace_mutex); | 141 | mutex_lock(&userspace_mutex); |
142 | rc = sysfs_create_file (&policy->kobj, | ||
143 | &freq_attr_scaling_setspeed.attr); | ||
144 | if (rc) | ||
145 | goto start_out; | ||
146 | |||
140 | cpu_is_managed[cpu] = 1; | 147 | cpu_is_managed[cpu] = 1; |
141 | cpu_min_freq[cpu] = policy->min; | 148 | cpu_min_freq[cpu] = policy->min; |
142 | cpu_max_freq[cpu] = policy->max; | 149 | cpu_max_freq[cpu] = policy->max; |
143 | cpu_cur_freq[cpu] = policy->cur; | 150 | cpu_cur_freq[cpu] = policy->cur; |
144 | cpu_set_freq[cpu] = policy->cur; | 151 | cpu_set_freq[cpu] = policy->cur; |
145 | sysfs_create_file (&policy->kobj, &freq_attr_scaling_setspeed.attr); | ||
146 | dprintk("managing cpu %u started (%u - %u kHz, currently %u kHz)\n", cpu, cpu_min_freq[cpu], cpu_max_freq[cpu], cpu_cur_freq[cpu]); | 152 | dprintk("managing cpu %u started (%u - %u kHz, currently %u kHz)\n", cpu, cpu_min_freq[cpu], cpu_max_freq[cpu], cpu_cur_freq[cpu]); |
153 | start_out: | ||
147 | mutex_unlock(&userspace_mutex); | 154 | mutex_unlock(&userspace_mutex); |
148 | break; | 155 | break; |
149 | case CPUFREQ_GOV_STOP: | 156 | case CPUFREQ_GOV_STOP: |
@@ -180,7 +187,7 @@ static int cpufreq_governor_userspace(struct cpufreq_policy *policy, | |||
180 | mutex_unlock(&userspace_mutex); | 187 | mutex_unlock(&userspace_mutex); |
181 | break; | 188 | break; |
182 | } | 189 | } |
183 | return 0; | 190 | return rc; |
184 | } | 191 | } |
185 | 192 | ||
186 | 193 | ||
diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c index 551f4ccf87fd..e7490925fdcf 100644 --- a/drivers/cpufreq/freq_table.c +++ b/drivers/cpufreq/freq_table.c | |||
@@ -9,7 +9,8 @@ | |||
9 | #include <linux/init.h> | 9 | #include <linux/init.h> |
10 | #include <linux/cpufreq.h> | 10 | #include <linux/cpufreq.h> |
11 | 11 | ||
12 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_CORE, "freq-table", msg) | 12 | #define dprintk(msg...) \ |
13 | cpufreq_debug_printk(CPUFREQ_DEBUG_CORE, "freq-table", msg) | ||
13 | 14 | ||
14 | /********************************************************************* | 15 | /********************************************************************* |
15 | * FREQUENCY TABLE HELPERS * | 16 | * FREQUENCY TABLE HELPERS * |
@@ -29,7 +30,8 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, | |||
29 | 30 | ||
30 | continue; | 31 | continue; |
31 | } | 32 | } |
32 | dprintk("table entry %u: %u kHz, %u index\n", i, freq, table[i].index); | 33 | dprintk("table entry %u: %u kHz, %u index\n", |
34 | i, freq, table[i].index); | ||
33 | if (freq < min_freq) | 35 | if (freq < min_freq) |
34 | min_freq = freq; | 36 | min_freq = freq; |
35 | if (freq > max_freq) | 37 | if (freq > max_freq) |
@@ -54,13 +56,14 @@ int cpufreq_frequency_table_verify(struct cpufreq_policy *policy, | |||
54 | unsigned int i; | 56 | unsigned int i; |
55 | unsigned int count = 0; | 57 | unsigned int count = 0; |
56 | 58 | ||
57 | dprintk("request for verification of policy (%u - %u kHz) for cpu %u\n", policy->min, policy->max, policy->cpu); | 59 | dprintk("request for verification of policy (%u - %u kHz) for cpu %u\n", |
60 | policy->min, policy->max, policy->cpu); | ||
58 | 61 | ||
59 | if (!cpu_online(policy->cpu)) | 62 | if (!cpu_online(policy->cpu)) |
60 | return -EINVAL; | 63 | return -EINVAL; |
61 | 64 | ||
62 | cpufreq_verify_within_limits(policy, | 65 | cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, |
63 | policy->cpuinfo.min_freq, policy->cpuinfo.max_freq); | 66 | policy->cpuinfo.max_freq); |
64 | 67 | ||
65 | for (i=0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { | 68 | for (i=0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { |
66 | unsigned int freq = table[i].frequency; | 69 | unsigned int freq = table[i].frequency; |
@@ -75,10 +78,11 @@ int cpufreq_frequency_table_verify(struct cpufreq_policy *policy, | |||
75 | if (!count) | 78 | if (!count) |
76 | policy->max = next_larger; | 79 | policy->max = next_larger; |
77 | 80 | ||
78 | cpufreq_verify_within_limits(policy, | 81 | cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, |
79 | policy->cpuinfo.min_freq, policy->cpuinfo.max_freq); | 82 | policy->cpuinfo.max_freq); |
80 | 83 | ||
81 | dprintk("verification lead to (%u - %u kHz) for cpu %u\n", policy->min, policy->max, policy->cpu); | 84 | dprintk("verification lead to (%u - %u kHz) for cpu %u\n", |
85 | policy->min, policy->max, policy->cpu); | ||
82 | 86 | ||
83 | return 0; | 87 | return 0; |
84 | } | 88 | } |
@@ -101,7 +105,8 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy, | |||
101 | }; | 105 | }; |
102 | unsigned int i; | 106 | unsigned int i; |
103 | 107 | ||
104 | dprintk("request for target %u kHz (relation: %u) for cpu %u\n", target_freq, relation, policy->cpu); | 108 | dprintk("request for target %u kHz (relation: %u) for cpu %u\n", |
109 | target_freq, relation, policy->cpu); | ||
105 | 110 | ||
106 | switch (relation) { | 111 | switch (relation) { |
107 | case CPUFREQ_RELATION_H: | 112 | case CPUFREQ_RELATION_H: |
@@ -192,7 +197,10 @@ static ssize_t show_available_freqs (struct cpufreq_policy *policy, char *buf) | |||
192 | } | 197 | } |
193 | 198 | ||
194 | struct freq_attr cpufreq_freq_attr_scaling_available_freqs = { | 199 | struct freq_attr cpufreq_freq_attr_scaling_available_freqs = { |
195 | .attr = { .name = "scaling_available_frequencies", .mode = 0444, .owner=THIS_MODULE }, | 200 | .attr = { .name = "scaling_available_frequencies", |
201 | .mode = 0444, | ||
202 | .owner=THIS_MODULE | ||
203 | }, | ||
196 | .show = show_available_freqs, | 204 | .show = show_available_freqs, |
197 | }; | 205 | }; |
198 | EXPORT_SYMBOL_GPL(cpufreq_freq_attr_scaling_available_freqs); | 206 | EXPORT_SYMBOL_GPL(cpufreq_freq_attr_scaling_available_freqs); |
diff --git a/drivers/i2c/algos/Kconfig b/drivers/i2c/algos/Kconfig index c034820615bb..af0203409dd1 100644 --- a/drivers/i2c/algos/Kconfig +++ b/drivers/i2c/algos/Kconfig | |||
@@ -38,17 +38,6 @@ config I2C_ALGOPCA | |||
38 | This support is also available as a module. If so, the module | 38 | This support is also available as a module. If so, the module |
39 | will be called i2c-algo-pca. | 39 | will be called i2c-algo-pca. |
40 | 40 | ||
41 | config I2C_ALGOITE | ||
42 | tristate "ITE I2C Algorithm" | ||
43 | depends on MIPS_ITE8172 && I2C | ||
44 | help | ||
45 | This supports the use of the ITE8172 I2C interface found on some MIPS | ||
46 | systems. Say Y if you have one of these. You should also say Y for | ||
47 | the ITE I2C peripheral driver support below. | ||
48 | |||
49 | This support is also available as a module. If so, the module | ||
50 | will be called i2c-algo-ite. | ||
51 | |||
52 | config I2C_ALGO8XX | 41 | config I2C_ALGO8XX |
53 | tristate "MPC8xx CPM I2C interface" | 42 | tristate "MPC8xx CPM I2C interface" |
54 | depends on 8xx && I2C | 43 | depends on 8xx && I2C |
diff --git a/drivers/i2c/algos/Makefile b/drivers/i2c/algos/Makefile index 208be04a3dbd..cac1051bd4f1 100644 --- a/drivers/i2c/algos/Makefile +++ b/drivers/i2c/algos/Makefile | |||
@@ -5,7 +5,6 @@ | |||
5 | obj-$(CONFIG_I2C_ALGOBIT) += i2c-algo-bit.o | 5 | obj-$(CONFIG_I2C_ALGOBIT) += i2c-algo-bit.o |
6 | obj-$(CONFIG_I2C_ALGOPCF) += i2c-algo-pcf.o | 6 | obj-$(CONFIG_I2C_ALGOPCF) += i2c-algo-pcf.o |
7 | obj-$(CONFIG_I2C_ALGOPCA) += i2c-algo-pca.o | 7 | obj-$(CONFIG_I2C_ALGOPCA) += i2c-algo-pca.o |
8 | obj-$(CONFIG_I2C_ALGOITE) += i2c-algo-ite.o | ||
9 | obj-$(CONFIG_I2C_ALGO_SGI) += i2c-algo-sgi.o | 8 | obj-$(CONFIG_I2C_ALGO_SGI) += i2c-algo-sgi.o |
10 | 9 | ||
11 | ifeq ($(CONFIG_I2C_DEBUG_ALGO),y) | 10 | ifeq ($(CONFIG_I2C_DEBUG_ALGO),y) |
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c index 21c36bfb5e6b..95aa5395a5be 100644 --- a/drivers/i2c/algos/i2c-algo-bit.c +++ b/drivers/i2c/algos/i2c-algo-bit.c | |||
@@ -540,15 +540,7 @@ int i2c_bit_add_bus(struct i2c_adapter *adap) | |||
540 | 540 | ||
541 | return i2c_add_adapter(adap); | 541 | return i2c_add_adapter(adap); |
542 | } | 542 | } |
543 | |||
544 | |||
545 | int i2c_bit_del_bus(struct i2c_adapter *adap) | ||
546 | { | ||
547 | return i2c_del_adapter(adap); | ||
548 | } | ||
549 | |||
550 | EXPORT_SYMBOL(i2c_bit_add_bus); | 543 | EXPORT_SYMBOL(i2c_bit_add_bus); |
551 | EXPORT_SYMBOL(i2c_bit_del_bus); | ||
552 | 544 | ||
553 | MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>"); | 545 | MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>"); |
554 | MODULE_DESCRIPTION("I2C-Bus bit-banging algorithm"); | 546 | MODULE_DESCRIPTION("I2C-Bus bit-banging algorithm"); |
diff --git a/drivers/i2c/algos/i2c-algo-ite.c b/drivers/i2c/algos/i2c-algo-ite.c deleted file mode 100644 index 70d8eefb5efc..000000000000 --- a/drivers/i2c/algos/i2c-algo-ite.c +++ /dev/null | |||
@@ -1,806 +0,0 @@ | |||
1 | /* | ||
2 | ------------------------------------------------------------------------- | ||
3 | i2c-algo-ite.c i2c driver algorithms for ITE adapters | ||
4 | |||
5 | Hai-Pao Fan, MontaVista Software, Inc. | ||
6 | hpfan@mvista.com or source@mvista.com | ||
7 | |||
8 | Copyright 2000 MontaVista Software Inc. | ||
9 | |||
10 | --------------------------------------------------------------------------- | ||
11 | This file was highly leveraged from i2c-algo-pcf.c, which was created | ||
12 | by Simon G. Vogl and Hans Berglund: | ||
13 | |||
14 | |||
15 | Copyright (C) 1995-1997 Simon G. Vogl | ||
16 | 1998-2000 Hans Berglund | ||
17 | |||
18 | This program is free software; you can redistribute it and/or modify | ||
19 | it under the terms of the GNU General Public License as published by | ||
20 | the Free Software Foundation; either version 2 of the License, or | ||
21 | (at your option) any later version. | ||
22 | |||
23 | This program is distributed in the hope that it will be useful, | ||
24 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
25 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
26 | GNU General Public License for more details. | ||
27 | |||
28 | You should have received a copy of the GNU General Public License | ||
29 | along with this program; if not, write to the Free Software | ||
30 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | ||
31 | /* ------------------------------------------------------------------------- */ | ||
32 | |||
33 | /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and | ||
34 | Frodo Looijaard <frodol@dds.nl> ,and also from Martin Bailey | ||
35 | <mbailey@littlefeet-inc.com> */ | ||
36 | |||
37 | #include <linux/kernel.h> | ||
38 | #include <linux/module.h> | ||
39 | #include <linux/delay.h> | ||
40 | #include <linux/slab.h> | ||
41 | #include <linux/init.h> | ||
42 | #include <asm/uaccess.h> | ||
43 | #include <linux/ioport.h> | ||
44 | #include <linux/errno.h> | ||
45 | #include <linux/sched.h> | ||
46 | |||
47 | #include <linux/i2c.h> | ||
48 | #include <linux/i2c-algo-ite.h> | ||
49 | #include "i2c-algo-ite.h" | ||
50 | |||
51 | #define PM_DSR IT8172_PCI_IO_BASE + IT_PM_DSR | ||
52 | #define PM_IBSR IT8172_PCI_IO_BASE + IT_PM_DSR + 0x04 | ||
53 | #define GPIO_CCR IT8172_PCI_IO_BASE + IT_GPCCR | ||
54 | |||
55 | #define DEB2(x) if (i2c_debug>=2) x | ||
56 | #define DEB3(x) if (i2c_debug>=3) x /* print several statistical values*/ | ||
57 | #define DEF_TIMEOUT 16 | ||
58 | |||
59 | |||
60 | /* module parameters: | ||
61 | */ | ||
62 | static int i2c_debug; | ||
63 | static int iic_test; /* see if the line-setting functions work */ | ||
64 | |||
65 | /* --- setting states on the bus with the right timing: --------------- */ | ||
66 | |||
67 | #define get_clock(adap) adap->getclock(adap->data) | ||
68 | #define iic_outw(adap, reg, val) adap->setiic(adap->data, reg, val) | ||
69 | #define iic_inw(adap, reg) adap->getiic(adap->data, reg) | ||
70 | |||
71 | |||
72 | /* --- other auxiliary functions -------------------------------------- */ | ||
73 | |||
74 | static void iic_start(struct i2c_algo_iic_data *adap) | ||
75 | { | ||
76 | iic_outw(adap,ITE_I2CHCR,ITE_CMD); | ||
77 | } | ||
78 | |||
79 | static void iic_stop(struct i2c_algo_iic_data *adap) | ||
80 | { | ||
81 | iic_outw(adap,ITE_I2CHCR,0); | ||
82 | iic_outw(adap,ITE_I2CHSR,ITE_I2CHSR_TDI); | ||
83 | } | ||
84 | |||
85 | static void iic_reset(struct i2c_algo_iic_data *adap) | ||
86 | { | ||
87 | iic_outw(adap, PM_IBSR, iic_inw(adap, PM_IBSR) | 0x80); | ||
88 | } | ||
89 | |||
90 | |||
91 | static int wait_for_bb(struct i2c_algo_iic_data *adap) | ||
92 | { | ||
93 | int timeout = DEF_TIMEOUT; | ||
94 | short status; | ||
95 | |||
96 | status = iic_inw(adap, ITE_I2CHSR); | ||
97 | #ifndef STUB_I2C | ||
98 | while (timeout-- && (status & ITE_I2CHSR_HB)) { | ||
99 | udelay(1000); /* How much is this? */ | ||
100 | status = iic_inw(adap, ITE_I2CHSR); | ||
101 | } | ||
102 | #endif | ||
103 | if (timeout<=0) { | ||
104 | printk(KERN_ERR "Timeout, host is busy\n"); | ||
105 | iic_reset(adap); | ||
106 | } | ||
107 | return(timeout<=0); | ||
108 | } | ||
109 | |||
110 | /* After we issue a transaction on the IIC bus, this function | ||
111 | * is called. It puts this process to sleep until we get an interrupt from | ||
112 | * from the controller telling us that the transaction we requested in complete. | ||
113 | */ | ||
114 | static int wait_for_pin(struct i2c_algo_iic_data *adap, short *status) { | ||
115 | |||
116 | int timeout = DEF_TIMEOUT; | ||
117 | |||
118 | timeout = wait_for_bb(adap); | ||
119 | if (timeout) { | ||
120 | DEB2(printk("Timeout waiting for host not busy\n");) | ||
121 | return -EIO; | ||
122 | } | ||
123 | timeout = DEF_TIMEOUT; | ||
124 | |||
125 | *status = iic_inw(adap, ITE_I2CHSR); | ||
126 | #ifndef STUB_I2C | ||
127 | while (timeout-- && !(*status & ITE_I2CHSR_TDI)) { | ||
128 | adap->waitforpin(); | ||
129 | *status = iic_inw(adap, ITE_I2CHSR); | ||
130 | } | ||
131 | #endif | ||
132 | if (timeout <= 0) | ||
133 | return(-1); | ||
134 | else | ||
135 | return(0); | ||
136 | } | ||
137 | |||
138 | static int wait_for_fe(struct i2c_algo_iic_data *adap, short *status) | ||
139 | { | ||
140 | int timeout = DEF_TIMEOUT; | ||
141 | |||
142 | *status = iic_inw(adap, ITE_I2CFSR); | ||
143 | #ifndef STUB_I2C | ||
144 | while (timeout-- && (*status & ITE_I2CFSR_FE)) { | ||
145 | udelay(1000); | ||
146 | iic_inw(adap, ITE_I2CFSR); | ||
147 | } | ||
148 | #endif | ||
149 | if (timeout <= 0) | ||
150 | return(-1); | ||
151 | else | ||
152 | return(0); | ||
153 | } | ||
154 | |||
155 | static int iic_init (struct i2c_algo_iic_data *adap) | ||
156 | { | ||
157 | short i; | ||
158 | |||
159 | /* Clear bit 7 to set I2C to normal operation mode */ | ||
160 | i=iic_inw(adap, PM_DSR)& 0xff7f; | ||
161 | iic_outw(adap, PM_DSR, i); | ||
162 | |||
163 | /* set IT_GPCCR port C bit 2&3 as function 2 */ | ||
164 | i = iic_inw(adap, GPIO_CCR) & 0xfc0f; | ||
165 | iic_outw(adap,GPIO_CCR,i); | ||
166 | |||
167 | /* Clear slave address/sub-address */ | ||
168 | iic_outw(adap,ITE_I2CSAR, 0); | ||
169 | iic_outw(adap,ITE_I2CSSAR, 0); | ||
170 | |||
171 | /* Set clock counter register */ | ||
172 | iic_outw(adap,ITE_I2CCKCNT, get_clock(adap)); | ||
173 | |||
174 | /* Set START/reSTART/STOP time registers */ | ||
175 | iic_outw(adap,ITE_I2CSHDR, 0x0a); | ||
176 | iic_outw(adap,ITE_I2CRSUR, 0x0a); | ||
177 | iic_outw(adap,ITE_I2CPSUR, 0x0a); | ||
178 | |||
179 | /* Enable interrupts on completing the current transaction */ | ||
180 | iic_outw(adap,ITE_I2CHCR, ITE_I2CHCR_IE | ITE_I2CHCR_HCE); | ||
181 | |||
182 | /* Clear transfer count */ | ||
183 | iic_outw(adap,ITE_I2CFBCR, 0x0); | ||
184 | |||
185 | DEB2(printk("iic_init: Initialized IIC on ITE 0x%x\n", | ||
186 | iic_inw(adap, ITE_I2CHSR))); | ||
187 | return 0; | ||
188 | } | ||
189 | |||
190 | |||
191 | /* | ||
192 | * Sanity check for the adapter hardware - check the reaction of | ||
193 | * the bus lines only if it seems to be idle. | ||
194 | */ | ||
195 | static int test_bus(struct i2c_algo_iic_data *adap, char *name) { | ||
196 | #if 0 | ||
197 | int scl,sda; | ||
198 | sda=getsda(adap); | ||
199 | if (adap->getscl==NULL) { | ||
200 | printk("test_bus: Warning: Adapter can't read from clock line - skipping test.\n"); | ||
201 | return 0; | ||
202 | } | ||
203 | scl=getscl(adap); | ||
204 | printk("test_bus: Adapter: %s scl: %d sda: %d -- testing...\n", | ||
205 | name,getscl(adap),getsda(adap)); | ||
206 | if (!scl || !sda ) { | ||
207 | printk("test_bus: %s seems to be busy.\n",adap->name); | ||
208 | goto bailout; | ||
209 | } | ||
210 | sdalo(adap); | ||
211 | printk("test_bus:1 scl: %d sda: %d\n", getscl(adap), | ||
212 | getsda(adap)); | ||
213 | if ( 0 != getsda(adap) ) { | ||
214 | printk("test_bus: %s SDA stuck high!\n",name); | ||
215 | sdahi(adap); | ||
216 | goto bailout; | ||
217 | } | ||
218 | if ( 0 == getscl(adap) ) { | ||
219 | printk("test_bus: %s SCL unexpected low while pulling SDA low!\n", | ||
220 | name); | ||
221 | goto bailout; | ||
222 | } | ||
223 | sdahi(adap); | ||
224 | printk("test_bus:2 scl: %d sda: %d\n", getscl(adap), | ||
225 | getsda(adap)); | ||
226 | if ( 0 == getsda(adap) ) { | ||
227 | printk("test_bus: %s SDA stuck low!\n",name); | ||
228 | sdahi(adap); | ||
229 | goto bailout; | ||
230 | } | ||
231 | if ( 0 == getscl(adap) ) { | ||
232 | printk("test_bus: %s SCL unexpected low while SDA high!\n", | ||
233 | adap->name); | ||
234 | goto bailout; | ||
235 | } | ||
236 | scllo(adap); | ||
237 | printk("test_bus:3 scl: %d sda: %d\n", getscl(adap), | ||
238 | getsda(adap)); | ||
239 | if ( 0 != getscl(adap) ) { | ||
240 | |||
241 | sclhi(adap); | ||
242 | goto bailout; | ||
243 | } | ||
244 | if ( 0 == getsda(adap) ) { | ||
245 | printk("test_bus: %s SDA unexpected low while pulling SCL low!\n", | ||
246 | name); | ||
247 | goto bailout; | ||
248 | } | ||
249 | sclhi(adap); | ||
250 | printk("test_bus:4 scl: %d sda: %d\n", getscl(adap), | ||
251 | getsda(adap)); | ||
252 | if ( 0 == getscl(adap) ) { | ||
253 | printk("test_bus: %s SCL stuck low!\n",name); | ||
254 | sclhi(adap); | ||
255 | goto bailout; | ||
256 | } | ||
257 | if ( 0 == getsda(adap) ) { | ||
258 | printk("test_bus: %s SDA unexpected low while SCL high!\n", | ||
259 | name); | ||
260 | goto bailout; | ||
261 | } | ||
262 | printk("test_bus: %s passed test.\n",name); | ||
263 | return 0; | ||
264 | bailout: | ||
265 | sdahi(adap); | ||
266 | sclhi(adap); | ||
267 | return -ENODEV; | ||
268 | #endif | ||
269 | return (0); | ||
270 | } | ||
271 | |||
272 | /* ----- Utility functions | ||
273 | */ | ||
274 | |||
275 | |||
276 | /* Verify the device we want to talk to on the IIC bus really exists. */ | ||
277 | static inline int try_address(struct i2c_algo_iic_data *adap, | ||
278 | unsigned int addr, int retries) | ||
279 | { | ||
280 | int i, ret = -1; | ||
281 | short status; | ||
282 | |||
283 | for (i=0;i<retries;i++) { | ||
284 | iic_outw(adap, ITE_I2CSAR, addr); | ||
285 | iic_start(adap); | ||
286 | if (wait_for_pin(adap, &status) == 0) { | ||
287 | if ((status & ITE_I2CHSR_DNE) == 0) { | ||
288 | iic_stop(adap); | ||
289 | iic_outw(adap, ITE_I2CFCR, ITE_I2CFCR_FLUSH); | ||
290 | ret=1; | ||
291 | break; /* success! */ | ||
292 | } | ||
293 | } | ||
294 | iic_stop(adap); | ||
295 | udelay(adap->udelay); | ||
296 | } | ||
297 | DEB2(if (i) printk("try_address: needed %d retries for 0x%x\n",i, | ||
298 | addr)); | ||
299 | return ret; | ||
300 | } | ||
301 | |||
302 | |||
303 | static int iic_sendbytes(struct i2c_adapter *i2c_adap,const char *buf, | ||
304 | int count) | ||
305 | { | ||
306 | struct i2c_algo_iic_data *adap = i2c_adap->algo_data; | ||
307 | int wrcount=0, timeout; | ||
308 | short status; | ||
309 | int loops, remainder, i, j; | ||
310 | union { | ||
311 | char byte[2]; | ||
312 | unsigned short word; | ||
313 | } tmp; | ||
314 | |||
315 | iic_outw(adap, ITE_I2CSSAR, (unsigned short)buf[wrcount++]); | ||
316 | count--; | ||
317 | if (count == 0) | ||
318 | return -EIO; | ||
319 | |||
320 | loops = count / 32; /* 32-byte FIFO */ | ||
321 | remainder = count % 32; | ||
322 | |||
323 | if(loops) { | ||
324 | for(i=0; i<loops; i++) { | ||
325 | |||
326 | iic_outw(adap, ITE_I2CFBCR, 32); | ||
327 | for(j=0; j<32/2; j++) { | ||
328 | tmp.byte[1] = buf[wrcount++]; | ||
329 | tmp.byte[0] = buf[wrcount++]; | ||
330 | iic_outw(adap, ITE_I2CFDR, tmp.word); | ||
331 | } | ||
332 | |||
333 | /* status FIFO overrun */ | ||
334 | iic_inw(adap, ITE_I2CFSR); | ||
335 | iic_inw(adap, ITE_I2CFBCR); | ||
336 | |||
337 | iic_outw(adap, ITE_I2CHCR, ITE_WRITE); /* Issue WRITE command */ | ||
338 | |||
339 | /* Wait for transmission to complete */ | ||
340 | timeout = wait_for_pin(adap, &status); | ||
341 | if(timeout) { | ||
342 | iic_stop(adap); | ||
343 | printk("iic_sendbytes: %s write timeout.\n", i2c_adap->name); | ||
344 | return -EREMOTEIO; /* got a better one ?? */ | ||
345 | } | ||
346 | if (status & ITE_I2CHSR_DB) { | ||
347 | iic_stop(adap); | ||
348 | printk("iic_sendbytes: %s write error - no ack.\n", i2c_adap->name); | ||
349 | return -EREMOTEIO; /* got a better one ?? */ | ||
350 | } | ||
351 | } | ||
352 | } | ||
353 | if(remainder) { | ||
354 | iic_outw(adap, ITE_I2CFBCR, remainder); | ||
355 | for(i=0; i<remainder/2; i++) { | ||
356 | tmp.byte[1] = buf[wrcount++]; | ||
357 | tmp.byte[0] = buf[wrcount++]; | ||
358 | iic_outw(adap, ITE_I2CFDR, tmp.word); | ||
359 | } | ||
360 | |||
361 | /* status FIFO overrun */ | ||
362 | iic_inw(adap, ITE_I2CFSR); | ||
363 | iic_inw(adap, ITE_I2CFBCR); | ||
364 | |||
365 | iic_outw(adap, ITE_I2CHCR, ITE_WRITE); /* Issue WRITE command */ | ||
366 | |||
367 | timeout = wait_for_pin(adap, &status); | ||
368 | if(timeout) { | ||
369 | iic_stop(adap); | ||
370 | printk("iic_sendbytes: %s write timeout.\n", i2c_adap->name); | ||
371 | return -EREMOTEIO; /* got a better one ?? */ | ||
372 | } | ||
373 | #ifndef STUB_I2C | ||
374 | if (status & ITE_I2CHSR_DB) { | ||
375 | iic_stop(adap); | ||
376 | printk("iic_sendbytes: %s write error - no ack.\n", i2c_adap->name); | ||
377 | return -EREMOTEIO; /* got a better one ?? */ | ||
378 | } | ||
379 | #endif | ||
380 | } | ||
381 | iic_stop(adap); | ||
382 | return wrcount; | ||
383 | } | ||
384 | |||
385 | |||
386 | static int iic_readbytes(struct i2c_adapter *i2c_adap, char *buf, int count, | ||
387 | int sread) | ||
388 | { | ||
389 | int rdcount=0, i, timeout; | ||
390 | short status; | ||
391 | struct i2c_algo_iic_data *adap = i2c_adap->algo_data; | ||
392 | int loops, remainder, j; | ||
393 | union { | ||
394 | char byte[2]; | ||
395 | unsigned short word; | ||
396 | } tmp; | ||
397 | |||
398 | loops = count / 32; /* 32-byte FIFO */ | ||
399 | remainder = count % 32; | ||
400 | |||
401 | if(loops) { | ||
402 | for(i=0; i<loops; i++) { | ||
403 | iic_outw(adap, ITE_I2CFBCR, 32); | ||
404 | if (sread) | ||
405 | iic_outw(adap, ITE_I2CHCR, ITE_SREAD); | ||
406 | else | ||
407 | iic_outw(adap, ITE_I2CHCR, ITE_READ); /* Issue READ command */ | ||
408 | |||
409 | timeout = wait_for_pin(adap, &status); | ||
410 | if(timeout) { | ||
411 | iic_stop(adap); | ||
412 | printk("iic_readbytes: %s read timeout.\n", i2c_adap->name); | ||
413 | return (-1); | ||
414 | } | ||
415 | #ifndef STUB_I2C | ||
416 | if (status & ITE_I2CHSR_DB) { | ||
417 | iic_stop(adap); | ||
418 | printk("iic_readbytes: %s read error - no ack.\n", i2c_adap->name); | ||
419 | return (-1); | ||
420 | } | ||
421 | #endif | ||
422 | |||
423 | timeout = wait_for_fe(adap, &status); | ||
424 | if(timeout) { | ||
425 | iic_stop(adap); | ||
426 | printk("iic_readbytes: %s FIFO is empty\n", i2c_adap->name); | ||
427 | return (-1); | ||
428 | } | ||
429 | |||
430 | for(j=0; j<32/2; j++) { | ||
431 | tmp.word = iic_inw(adap, ITE_I2CFDR); | ||
432 | buf[rdcount++] = tmp.byte[1]; | ||
433 | buf[rdcount++] = tmp.byte[0]; | ||
434 | } | ||
435 | |||
436 | /* status FIFO underrun */ | ||
437 | iic_inw(adap, ITE_I2CFSR); | ||
438 | |||
439 | } | ||
440 | } | ||
441 | |||
442 | |||
443 | if(remainder) { | ||
444 | remainder=(remainder+1)/2 * 2; | ||
445 | iic_outw(adap, ITE_I2CFBCR, remainder); | ||
446 | if (sread) | ||
447 | iic_outw(adap, ITE_I2CHCR, ITE_SREAD); | ||
448 | else | ||
449 | iic_outw(adap, ITE_I2CHCR, ITE_READ); /* Issue READ command */ | ||
450 | |||
451 | timeout = wait_for_pin(adap, &status); | ||
452 | if(timeout) { | ||
453 | iic_stop(adap); | ||
454 | printk("iic_readbytes: %s read timeout.\n", i2c_adap->name); | ||
455 | return (-1); | ||
456 | } | ||
457 | #ifndef STUB_I2C | ||
458 | if (status & ITE_I2CHSR_DB) { | ||
459 | iic_stop(adap); | ||
460 | printk("iic_readbytes: %s read error - no ack.\n", i2c_adap->name); | ||
461 | return (-1); | ||
462 | } | ||
463 | #endif | ||
464 | timeout = wait_for_fe(adap, &status); | ||
465 | if(timeout) { | ||
466 | iic_stop(adap); | ||
467 | printk("iic_readbytes: %s FIFO is empty\n", i2c_adap->name); | ||
468 | return (-1); | ||
469 | } | ||
470 | |||
471 | for(i=0; i<(remainder+1)/2; i++) { | ||
472 | tmp.word = iic_inw(adap, ITE_I2CFDR); | ||
473 | buf[rdcount++] = tmp.byte[1]; | ||
474 | buf[rdcount++] = tmp.byte[0]; | ||
475 | } | ||
476 | |||
477 | /* status FIFO underrun */ | ||
478 | iic_inw(adap, ITE_I2CFSR); | ||
479 | |||
480 | } | ||
481 | |||
482 | iic_stop(adap); | ||
483 | return rdcount; | ||
484 | } | ||
485 | |||
486 | |||
487 | /* This function implements combined transactions. Combined | ||
488 | * transactions consist of combinations of reading and writing blocks of data. | ||
489 | * Each transfer (i.e. a read or a write) is separated by a repeated start | ||
490 | * condition. | ||
491 | */ | ||
492 | #if 0 | ||
493 | static int iic_combined_transaction(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, int num) | ||
494 | { | ||
495 | int i; | ||
496 | struct i2c_msg *pmsg; | ||
497 | int ret; | ||
498 | |||
499 | DEB2(printk("Beginning combined transaction\n")); | ||
500 | |||
501 | for(i=0; i<(num-1); i++) { | ||
502 | pmsg = &msgs[i]; | ||
503 | if(pmsg->flags & I2C_M_RD) { | ||
504 | DEB2(printk(" This one is a read\n")); | ||
505 | ret = iic_readbytes(i2c_adap, pmsg->buf, pmsg->len, IIC_COMBINED_XFER); | ||
506 | } | ||
507 | else if(!(pmsg->flags & I2C_M_RD)) { | ||
508 | DEB2(printk("This one is a write\n")); | ||
509 | ret = iic_sendbytes(i2c_adap, pmsg->buf, pmsg->len, IIC_COMBINED_XFER); | ||
510 | } | ||
511 | } | ||
512 | /* Last read or write segment needs to be terminated with a stop */ | ||
513 | pmsg = &msgs[i]; | ||
514 | |||
515 | if(pmsg->flags & I2C_M_RD) { | ||
516 | DEB2(printk("Doing the last read\n")); | ||
517 | ret = iic_readbytes(i2c_adap, pmsg->buf, pmsg->len, IIC_SINGLE_XFER); | ||
518 | } | ||
519 | else if(!(pmsg->flags & I2C_M_RD)) { | ||
520 | DEB2(printk("Doing the last write\n")); | ||
521 | ret = iic_sendbytes(i2c_adap, pmsg->buf, pmsg->len, IIC_SINGLE_XFER); | ||
522 | } | ||
523 | |||
524 | return ret; | ||
525 | } | ||
526 | #endif | ||
527 | |||
528 | |||
529 | /* Whenever we initiate a transaction, the first byte clocked | ||
530 | * onto the bus after the start condition is the address (7 bit) of the | ||
531 | * device we want to talk to. This function manipulates the address specified | ||
532 | * so that it makes sense to the hardware when written to the IIC peripheral. | ||
533 | * | ||
534 | * Note: 10 bit addresses are not supported in this driver, although they are | ||
535 | * supported by the hardware. This functionality needs to be implemented. | ||
536 | */ | ||
537 | static inline int iic_doAddress(struct i2c_algo_iic_data *adap, | ||
538 | struct i2c_msg *msg, int retries) | ||
539 | { | ||
540 | unsigned short flags = msg->flags; | ||
541 | unsigned int addr; | ||
542 | int ret; | ||
543 | |||
544 | /* Ten bit addresses not supported right now */ | ||
545 | if ( (flags & I2C_M_TEN) ) { | ||
546 | #if 0 | ||
547 | addr = 0xf0 | (( msg->addr >> 7) & 0x03); | ||
548 | DEB2(printk("addr0: %d\n",addr)); | ||
549 | ret = try_address(adap, addr, retries); | ||
550 | if (ret!=1) { | ||
551 | printk("iic_doAddress: died at extended address code.\n"); | ||
552 | return -EREMOTEIO; | ||
553 | } | ||
554 | iic_outw(adap,msg->addr & 0x7f); | ||
555 | if (ret != 1) { | ||
556 | printk("iic_doAddress: died at 2nd address code.\n"); | ||
557 | return -EREMOTEIO; | ||
558 | } | ||
559 | if ( flags & I2C_M_RD ) { | ||
560 | i2c_repstart(adap); | ||
561 | addr |= 0x01; | ||
562 | ret = try_address(adap, addr, retries); | ||
563 | if (ret!=1) { | ||
564 | printk("iic_doAddress: died at extended address code.\n"); | ||
565 | return -EREMOTEIO; | ||
566 | } | ||
567 | } | ||
568 | #endif | ||
569 | } else { | ||
570 | |||
571 | addr = ( msg->addr << 1 ); | ||
572 | |||
573 | #if 0 | ||
574 | if (flags & I2C_M_RD ) | ||
575 | addr |= 1; | ||
576 | if (flags & I2C_M_REV_DIR_ADDR ) | ||
577 | addr ^= 1; | ||
578 | #endif | ||
579 | |||
580 | if (iic_inw(adap, ITE_I2CSAR) != addr) { | ||
581 | iic_outw(adap, ITE_I2CSAR, addr); | ||
582 | ret = try_address(adap, addr, retries); | ||
583 | if (ret!=1) { | ||
584 | printk("iic_doAddress: died at address code.\n"); | ||
585 | return -EREMOTEIO; | ||
586 | } | ||
587 | } | ||
588 | |||
589 | } | ||
590 | |||
591 | return 0; | ||
592 | } | ||
593 | |||
594 | |||
595 | /* Description: Prepares the controller for a transaction (clearing status | ||
596 | * registers, data buffers, etc), and then calls either iic_readbytes or | ||
597 | * iic_sendbytes to do the actual transaction. | ||
598 | * | ||
599 | * still to be done: Before we issue a transaction, we should | ||
600 | * verify that the bus is not busy or in some unknown state. | ||
601 | */ | ||
602 | static int iic_xfer(struct i2c_adapter *i2c_adap, | ||
603 | struct i2c_msg *msgs, | ||
604 | int num) | ||
605 | { | ||
606 | struct i2c_algo_iic_data *adap = i2c_adap->algo_data; | ||
607 | struct i2c_msg *pmsg; | ||
608 | int i = 0; | ||
609 | int ret, timeout; | ||
610 | |||
611 | pmsg = &msgs[i]; | ||
612 | |||
613 | if(!pmsg->len) { | ||
614 | DEB2(printk("iic_xfer: read/write length is 0\n");) | ||
615 | return -EIO; | ||
616 | } | ||
617 | if(!(pmsg->flags & I2C_M_RD) && (!(pmsg->len)%2) ) { | ||
618 | DEB2(printk("iic_xfer: write buffer length is not odd\n");) | ||
619 | return -EIO; | ||
620 | } | ||
621 | |||
622 | /* Wait for any pending transfers to complete */ | ||
623 | timeout = wait_for_bb(adap); | ||
624 | if (timeout) { | ||
625 | DEB2(printk("iic_xfer: Timeout waiting for host not busy\n");) | ||
626 | return -EIO; | ||
627 | } | ||
628 | |||
629 | /* Flush FIFO */ | ||
630 | iic_outw(adap, ITE_I2CFCR, ITE_I2CFCR_FLUSH); | ||
631 | |||
632 | /* Load address */ | ||
633 | ret = iic_doAddress(adap, pmsg, i2c_adap->retries); | ||
634 | if (ret) | ||
635 | return -EIO; | ||
636 | |||
637 | #if 0 | ||
638 | /* Combined transaction (read and write) */ | ||
639 | if(num > 1) { | ||
640 | DEB2(printk("iic_xfer: Call combined transaction\n")); | ||
641 | ret = iic_combined_transaction(i2c_adap, msgs, num); | ||
642 | } | ||
643 | #endif | ||
644 | |||
645 | DEB3(printk("iic_xfer: Msg %d, addr=0x%x, flags=0x%x, len=%d\n", | ||
646 | i, msgs[i].addr, msgs[i].flags, msgs[i].len);) | ||
647 | |||
648 | if(pmsg->flags & I2C_M_RD) /* Read */ | ||
649 | ret = iic_readbytes(i2c_adap, pmsg->buf, pmsg->len, 0); | ||
650 | else { /* Write */ | ||
651 | udelay(1000); | ||
652 | ret = iic_sendbytes(i2c_adap, pmsg->buf, pmsg->len); | ||
653 | } | ||
654 | |||
655 | if (ret != pmsg->len) | ||
656 | DEB3(printk("iic_xfer: error or fail on read/write %d bytes.\n",ret)); | ||
657 | else | ||
658 | DEB3(printk("iic_xfer: read/write %d bytes.\n",ret)); | ||
659 | |||
660 | return ret; | ||
661 | } | ||
662 | |||
663 | |||
664 | /* Implements device specific ioctls. Higher level ioctls can | ||
665 | * be found in i2c-core.c and are typical of any i2c controller (specifying | ||
666 | * slave address, timeouts, etc). These ioctls take advantage of any hardware | ||
667 | * features built into the controller for which this algorithm-adapter set | ||
668 | * was written. These ioctls allow you to take control of the data and clock | ||
669 | * lines and set the either high or low, | ||
670 | * similar to a GPIO pin. | ||
671 | */ | ||
672 | static int algo_control(struct i2c_adapter *adapter, | ||
673 | unsigned int cmd, unsigned long arg) | ||
674 | { | ||
675 | |||
676 | struct i2c_algo_iic_data *adap = adapter->algo_data; | ||
677 | struct i2c_iic_msg s_msg; | ||
678 | char *buf; | ||
679 | int ret; | ||
680 | |||
681 | if (cmd == I2C_SREAD) { | ||
682 | if(copy_from_user(&s_msg, (struct i2c_iic_msg *)arg, | ||
683 | sizeof(struct i2c_iic_msg))) | ||
684 | return -EFAULT; | ||
685 | buf = kmalloc(s_msg.len, GFP_KERNEL); | ||
686 | if (buf== NULL) | ||
687 | return -ENOMEM; | ||
688 | |||
689 | /* Flush FIFO */ | ||
690 | iic_outw(adap, ITE_I2CFCR, ITE_I2CFCR_FLUSH); | ||
691 | |||
692 | /* Load address */ | ||
693 | iic_outw(adap, ITE_I2CSAR,s_msg.addr<<1); | ||
694 | iic_outw(adap, ITE_I2CSSAR,s_msg.waddr & 0xff); | ||
695 | |||
696 | ret = iic_readbytes(adapter, buf, s_msg.len, 1); | ||
697 | if (ret>=0) { | ||
698 | if(copy_to_user( s_msg.buf, buf, s_msg.len) ) | ||
699 | ret = -EFAULT; | ||
700 | } | ||
701 | kfree(buf); | ||
702 | } | ||
703 | return 0; | ||
704 | } | ||
705 | |||
706 | |||
707 | static u32 iic_func(struct i2c_adapter *adap) | ||
708 | { | ||
709 | return I2C_FUNC_SMBUS_EMUL | I2C_FUNC_10BIT_ADDR | | ||
710 | I2C_FUNC_PROTOCOL_MANGLING; | ||
711 | } | ||
712 | |||
713 | /* -----exported algorithm data: ------------------------------------- */ | ||
714 | |||
715 | static struct i2c_algorithm iic_algo = { | ||
716 | .master_xfer = iic_xfer, | ||
717 | .algo_control = algo_control, /* ioctl */ | ||
718 | .functionality = iic_func, | ||
719 | }; | ||
720 | |||
721 | |||
722 | /* | ||
723 | * registering functions to load algorithms at runtime | ||
724 | */ | ||
725 | int i2c_iic_add_bus(struct i2c_adapter *adap) | ||
726 | { | ||
727 | struct i2c_algo_iic_data *iic_adap = adap->algo_data; | ||
728 | |||
729 | if (iic_test) { | ||
730 | int ret = test_bus(iic_adap, adap->name); | ||
731 | if (ret<0) | ||
732 | return -ENODEV; | ||
733 | } | ||
734 | |||
735 | DEB2(printk("i2c-algo-ite: hw routines for %s registered.\n", | ||
736 | adap->name)); | ||
737 | |||
738 | /* register new adapter to i2c module... */ | ||
739 | adap->algo = &iic_algo; | ||
740 | |||
741 | adap->timeout = 100; /* default values, should */ | ||
742 | adap->retries = 3; /* be replaced by defines */ | ||
743 | adap->flags = 0; | ||
744 | |||
745 | iic_init(iic_adap); | ||
746 | return i2c_add_adapter(adap); | ||
747 | } | ||
748 | |||
749 | |||
750 | int i2c_iic_del_bus(struct i2c_adapter *adap) | ||
751 | { | ||
752 | int res; | ||
753 | if ((res = i2c_del_adapter(adap)) < 0) | ||
754 | return res; | ||
755 | DEB2(printk("i2c-algo-ite: adapter unregistered: %s\n",adap->name)); | ||
756 | |||
757 | return 0; | ||
758 | } | ||
759 | |||
760 | |||
761 | int __init i2c_algo_iic_init (void) | ||
762 | { | ||
763 | printk(KERN_INFO "ITE iic (i2c) algorithm module\n"); | ||
764 | return 0; | ||
765 | } | ||
766 | |||
767 | |||
768 | void i2c_algo_iic_exit(void) | ||
769 | { | ||
770 | return; | ||
771 | } | ||
772 | |||
773 | |||
774 | EXPORT_SYMBOL(i2c_iic_add_bus); | ||
775 | EXPORT_SYMBOL(i2c_iic_del_bus); | ||
776 | |||
777 | /* The MODULE_* macros resolve to nothing if MODULES is not defined | ||
778 | * when this file is compiled. | ||
779 | */ | ||
780 | MODULE_AUTHOR("MontaVista Software <www.mvista.com>"); | ||
781 | MODULE_DESCRIPTION("ITE iic algorithm"); | ||
782 | MODULE_LICENSE("GPL"); | ||
783 | |||
784 | module_param(iic_test, bool, 0); | ||
785 | module_param(i2c_debug, int, S_IRUGO | S_IWUSR); | ||
786 | |||
787 | MODULE_PARM_DESC(iic_test, "Test if the I2C bus is available"); | ||
788 | MODULE_PARM_DESC(i2c_debug, | ||
789 | "debug level - 0 off; 1 normal; 2,3 more verbose; 9 iic-protocol"); | ||
790 | |||
791 | |||
792 | /* This function resolves to init_module (the function invoked when a module | ||
793 | * is loaded via insmod) when this file is compiled with MODULES defined. | ||
794 | * Otherwise (i.e. if you want this driver statically linked to the kernel), | ||
795 | * a pointer to this function is stored in a table and called | ||
796 | * during the initialization of the kernel (in do_basic_setup in /init/main.c) | ||
797 | * | ||
798 | * All this functionality is complements of the macros defined in linux/init.h | ||
799 | */ | ||
800 | module_init(i2c_algo_iic_init); | ||
801 | |||
802 | |||
803 | /* If MODULES is defined when this file is compiled, then this function will | ||
804 | * resolved to cleanup_module. | ||
805 | */ | ||
806 | module_exit(i2c_algo_iic_exit); | ||
diff --git a/drivers/i2c/algos/i2c-algo-ite.h b/drivers/i2c/algos/i2c-algo-ite.h deleted file mode 100644 index a8ca3c9b546a..000000000000 --- a/drivers/i2c/algos/i2c-algo-ite.h +++ /dev/null | |||
@@ -1,117 +0,0 @@ | |||
1 | /* | ||
2 | -------------------------------------------------------------------- | ||
3 | i2c-ite.h: Global defines for the I2C controller on board the | ||
4 | ITE MIPS processor. | ||
5 | -------------------------------------------------------------------- | ||
6 | Hai-Pao Fan, MontaVista Software, Inc. | ||
7 | hpfan@mvista.com or source@mvista.com | ||
8 | |||
9 | Copyright 2001 MontaVista Software Inc. | ||
10 | |||
11 | * This program is free software; you can redistribute it and/or modify it | ||
12 | * under the terms of the GNU General Public License as published by the | ||
13 | * Free Software Foundation; either version 2 of the License, or (at your | ||
14 | * option) any later version. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
19 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
22 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
23 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | * You should have received a copy of the GNU General Public License along | ||
28 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
29 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
30 | |||
31 | */ | ||
32 | |||
33 | #ifndef I2C_ITE_H | ||
34 | #define I2C_ITE_H 1 | ||
35 | |||
36 | #include <asm/it8172/it8172.h> | ||
37 | |||
38 | /* I2C Registers */ | ||
39 | #define ITE_I2CHCR IT8172_PCI_IO_BASE + IT_I2C_BASE + 0x30 | ||
40 | #define ITE_I2CHSR IT8172_PCI_IO_BASE + IT_I2C_BASE + 0x34 | ||
41 | #define ITE_I2CSAR IT8172_PCI_IO_BASE + IT_I2C_BASE + 0x38 | ||
42 | #define ITE_I2CSSAR IT8172_PCI_IO_BASE + IT_I2C_BASE + 0x3c | ||
43 | #define ITE_I2CCKCNT IT8172_PCI_IO_BASE + IT_I2C_BASE + 0x48 | ||
44 | #define ITE_I2CSHDR IT8172_PCI_IO_BASE + IT_I2C_BASE + 0x4c | ||
45 | #define ITE_I2CRSUR IT8172_PCI_IO_BASE + IT_I2C_BASE + 0x50 | ||
46 | #define ITE_I2CPSUR IT8172_PCI_IO_BASE + IT_I2C_BASE + 0x54 | ||
47 | |||
48 | #define ITE_I2CFDR IT8172_PCI_IO_BASE + IT_I2C_BASE + 0x70 | ||
49 | #define ITE_I2CFBCR IT8172_PCI_IO_BASE + IT_I2C_BASE + 0x74 | ||
50 | #define ITE_I2CFCR IT8172_PCI_IO_BASE + IT_I2C_BASE + 0x78 | ||
51 | #define ITE_I2CFSR IT8172_PCI_IO_BASE + IT_I2C_BASE + 0x7c | ||
52 | |||
53 | |||
54 | /* Host Control Register ITE_I2CHCR */ | ||
55 | #define ITE_I2CHCR_HCE 0x01 /* Enable I2C Host Controller */ | ||
56 | #define ITE_I2CHCR_IE 0x02 /* Enable the interrupt after completing | ||
57 | the current transaction */ | ||
58 | #define ITE_I2CHCR_CP_W 0x00 /* bit2-4 000 - Write */ | ||
59 | #define ITE_I2CHCR_CP_R 0x08 /* 010 - Current address read */ | ||
60 | #define ITE_I2CHCR_CP_S 0x10 /* 100 - Sequential read */ | ||
61 | #define ITE_I2CHCR_ST 0x20 /* Initiates the I2C host controller to execute | ||
62 | the command and send the data programmed in | ||
63 | all required registers to I2C bus */ | ||
64 | #define ITE_CMD ITE_I2CHCR_HCE | ITE_I2CHCR_IE | ITE_I2CHCR_ST | ||
65 | #define ITE_WRITE ITE_CMD | ITE_I2CHCR_CP_W | ||
66 | #define ITE_READ ITE_CMD | ITE_I2CHCR_CP_R | ||
67 | #define ITE_SREAD ITE_CMD | ITE_I2CHCR_CP_S | ||
68 | |||
69 | /* Host Status Register ITE_I2CHSR */ | ||
70 | #define ITE_I2CHSR_DB 0x01 /* Device is busy, receives NACK response except | ||
71 | in the first and last bytes */ | ||
72 | #define ITE_I2CHSR_DNE 0x02 /* Target address on I2C bus does not exist */ | ||
73 | #define ITE_I2CHSR_TDI 0x04 /* R/W Transaction on I2C bus was completed */ | ||
74 | #define ITE_I2CHSR_HB 0x08 /* Host controller is processing transactions */ | ||
75 | #define ITE_I2CHSR_FER 0x10 /* Error occurs in the FIFO */ | ||
76 | |||
77 | /* Slave Address Register ITE_I2CSAR */ | ||
78 | #define ITE_I2CSAR_SA_MASK 0xfe /* Target I2C device address */ | ||
79 | #define ITE_I2CSAR_ASO 0x0100 /* Output 1/0 to I2CAS port when the | ||
80 | next slave address is addressed */ | ||
81 | |||
82 | /* Slave Sub-address Register ITE_I2CSSAR */ | ||
83 | #define ITE_I2CSSAR_SUBA_MASK 0xff /* Target I2C device sub-address */ | ||
84 | |||
85 | /* Clock Counter Register ITE_I2CCKCNT */ | ||
86 | #define ITE_I2CCKCNT_STOP 0x00 /* stop I2C clock */ | ||
87 | #define ITE_I2CCKCNT_HPCC_MASK 0x7f /* SCL high period counter */ | ||
88 | #define ITE_I2CCKCNT_LPCC_MASK 0x7f00 /* SCL low period counter */ | ||
89 | |||
90 | /* START Hold Time Register ITE_I2CSHDR */ | ||
91 | /* value is counted based on 16 MHz internal clock */ | ||
92 | #define ITE_I2CSHDR_FM 0x0a /* START condition at fast mode */ | ||
93 | #define ITE_I2CSHDR_SM 0x47 /* START contition at standard mode */ | ||
94 | |||
95 | /* (Repeated) START Setup Time Register ITE_I2CRSUR */ | ||
96 | /* value is counted based on 16 MHz internal clock */ | ||
97 | #define ITE_I2CRSUR_FM 0x0a /* repeated START condition at fast mode */ | ||
98 | #define ITE_I2CRSUR_SM 0x50 /* repeated START condition at standard mode */ | ||
99 | |||
100 | /* STOP setup Time Register ITE_I2CPSUR */ | ||
101 | |||
102 | /* FIFO Data Register ITE_I2CFDR */ | ||
103 | #define ITE_I2CFDR_MASK 0xff | ||
104 | |||
105 | /* FIFO Byte Count Register ITE_I2CFBCR */ | ||
106 | #define ITE_I2CFBCR_MASK 0x3f | ||
107 | |||
108 | /* FIFO Control Register ITE_I2CFCR */ | ||
109 | #define ITE_I2CFCR_FLUSH 0x01 /* Flush FIFO and reset the FIFO point | ||
110 | and I2CFSR */ | ||
111 | /* FIFO Status Register ITE_I2CFSR */ | ||
112 | #define ITE_I2CFSR_FO 0x01 /* FIFO is overrun when write */ | ||
113 | #define ITE_I2CFSR_FU 0x02 /* FIFO is underrun when read */ | ||
114 | #define ITE_I2CFSR_FF 0x04 /* FIFO is full when write */ | ||
115 | #define ITE_I2CFSR_FE 0x08 /* FIFO is empty when read */ | ||
116 | |||
117 | #endif /* I2C_ITE_H */ | ||
diff --git a/drivers/i2c/algos/i2c-algo-pca.c b/drivers/i2c/algos/i2c-algo-pca.c index 9081c9fbcd29..36fdf971f080 100644 --- a/drivers/i2c/algos/i2c-algo-pca.c +++ b/drivers/i2c/algos/i2c-algo-pca.c | |||
@@ -381,14 +381,7 @@ int i2c_pca_add_bus(struct i2c_adapter *adap) | |||
381 | 381 | ||
382 | return rval; | 382 | return rval; |
383 | } | 383 | } |
384 | |||
385 | int i2c_pca_del_bus(struct i2c_adapter *adap) | ||
386 | { | ||
387 | return i2c_del_adapter(adap); | ||
388 | } | ||
389 | |||
390 | EXPORT_SYMBOL(i2c_pca_add_bus); | 384 | EXPORT_SYMBOL(i2c_pca_add_bus); |
391 | EXPORT_SYMBOL(i2c_pca_del_bus); | ||
392 | 385 | ||
393 | MODULE_AUTHOR("Ian Campbell <icampbell@arcom.com>"); | 386 | MODULE_AUTHOR("Ian Campbell <icampbell@arcom.com>"); |
394 | MODULE_DESCRIPTION("I2C-Bus PCA9564 algorithm"); | 387 | MODULE_DESCRIPTION("I2C-Bus PCA9564 algorithm"); |
diff --git a/drivers/i2c/algos/i2c-algo-pcf.c b/drivers/i2c/algos/i2c-algo-pcf.c index 3b2003398966..ecb2c2d7d540 100644 --- a/drivers/i2c/algos/i2c-algo-pcf.c +++ b/drivers/i2c/algos/i2c-algo-pcf.c | |||
@@ -486,15 +486,7 @@ int i2c_pcf_add_bus(struct i2c_adapter *adap) | |||
486 | 486 | ||
487 | return rval; | 487 | return rval; |
488 | } | 488 | } |
489 | |||
490 | |||
491 | int i2c_pcf_del_bus(struct i2c_adapter *adap) | ||
492 | { | ||
493 | return i2c_del_adapter(adap); | ||
494 | } | ||
495 | |||
496 | EXPORT_SYMBOL(i2c_pcf_add_bus); | 489 | EXPORT_SYMBOL(i2c_pcf_add_bus); |
497 | EXPORT_SYMBOL(i2c_pcf_del_bus); | ||
498 | 490 | ||
499 | MODULE_AUTHOR("Hans Berglund <hb@spacetec.no>"); | 491 | MODULE_AUTHOR("Hans Berglund <hb@spacetec.no>"); |
500 | MODULE_DESCRIPTION("I2C-Bus PCF8584 algorithm"); | 492 | MODULE_DESCRIPTION("I2C-Bus PCF8584 algorithm"); |
diff --git a/drivers/i2c/algos/i2c-algo-sgi.c b/drivers/i2c/algos/i2c-algo-sgi.c index 490d99997fd0..ac2d5053078a 100644 --- a/drivers/i2c/algos/i2c-algo-sgi.c +++ b/drivers/i2c/algos/i2c-algo-sgi.c | |||
@@ -171,15 +171,7 @@ int i2c_sgi_add_bus(struct i2c_adapter *adap) | |||
171 | 171 | ||
172 | return i2c_add_adapter(adap); | 172 | return i2c_add_adapter(adap); |
173 | } | 173 | } |
174 | |||
175 | |||
176 | int i2c_sgi_del_bus(struct i2c_adapter *adap) | ||
177 | { | ||
178 | return i2c_del_adapter(adap); | ||
179 | } | ||
180 | |||
181 | EXPORT_SYMBOL(i2c_sgi_add_bus); | 174 | EXPORT_SYMBOL(i2c_sgi_add_bus); |
182 | EXPORT_SYMBOL(i2c_sgi_del_bus); | ||
183 | 175 | ||
184 | MODULE_AUTHOR("Ladislav Michl <ladis@linux-mips.org>"); | 176 | MODULE_AUTHOR("Ladislav Michl <ladis@linux-mips.org>"); |
185 | MODULE_DESCRIPTION("I2C-Bus SGI algorithm"); | 177 | MODULE_DESCRIPTION("I2C-Bus SGI algorithm"); |
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 90f91d039ee2..e1989f3a2684 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -74,6 +74,13 @@ config I2C_AMD8111 | |||
74 | This driver can also be built as a module. If so, the module | 74 | This driver can also be built as a module. If so, the module |
75 | will be called i2c-amd8111. | 75 | will be called i2c-amd8111. |
76 | 76 | ||
77 | config I2C_AT91 | ||
78 | tristate "Atmel AT91 I2C Two-Wire interface (TWI)" | ||
79 | depends on I2C && ARCH_AT91 && EXPERIMENTAL | ||
80 | help | ||
81 | This supports the use of the I2C interface on Atmel AT91 | ||
82 | processors. | ||
83 | |||
77 | config I2C_AU1550 | 84 | config I2C_AU1550 |
78 | tristate "Au1550/Au1200 SMBus interface" | 85 | tristate "Au1550/Au1200 SMBus interface" |
79 | depends on I2C && (SOC_AU1550 || SOC_AU1200) | 86 | depends on I2C && (SOC_AU1550 || SOC_AU1200) |
@@ -209,18 +216,6 @@ config I2C_ISA | |||
209 | tristate | 216 | tristate |
210 | depends on I2C | 217 | depends on I2C |
211 | 218 | ||
212 | config I2C_ITE | ||
213 | tristate "ITE I2C Adapter" | ||
214 | depends on I2C && MIPS_ITE8172 | ||
215 | select I2C_ALGOITE | ||
216 | help | ||
217 | This supports the ITE8172 I2C peripheral found on some MIPS | ||
218 | systems. Say Y if you have one of these. You should also say Y for | ||
219 | the ITE I2C driver algorithm support above. | ||
220 | |||
221 | This support is also available as a module. If so, the module | ||
222 | will be called i2c-ite. | ||
223 | |||
224 | config I2C_IXP4XX | 219 | config I2C_IXP4XX |
225 | tristate "IXP4xx GPIO-Based I2C Interface" | 220 | tristate "IXP4xx GPIO-Based I2C Interface" |
226 | depends on I2C && ARCH_IXP4XX | 221 | depends on I2C && ARCH_IXP4XX |
@@ -481,6 +476,17 @@ config I2C_STUB | |||
481 | 476 | ||
482 | If you don't know what to do here, definitely say N. | 477 | If you don't know what to do here, definitely say N. |
483 | 478 | ||
479 | config I2C_VERSATILE | ||
480 | tristate "ARM Versatile/Realview I2C bus support" | ||
481 | depends on I2C && (ARCH_VERSATILE || ARCH_REALVIEW) | ||
482 | select I2C_ALGOBIT | ||
483 | help | ||
484 | Say yes if you want to support the I2C serial bus on ARMs Versatile | ||
485 | range of platforms. | ||
486 | |||
487 | This driver can also be built as a module. If so, the module | ||
488 | will be called i2c-versatile. | ||
489 | |||
484 | config I2C_VIA | 490 | config I2C_VIA |
485 | tristate "VIA 82C586B" | 491 | tristate "VIA 82C586B" |
486 | depends on I2C && PCI && EXPERIMENTAL | 492 | depends on I2C && PCI && EXPERIMENTAL |
@@ -548,4 +554,23 @@ config I2C_MV64XXX | |||
548 | This driver can also be built as a module. If so, the module | 554 | This driver can also be built as a module. If so, the module |
549 | will be called i2c-mv64xxx. | 555 | will be called i2c-mv64xxx. |
550 | 556 | ||
557 | config I2C_PNX | ||
558 | tristate "I2C bus support for Philips PNX targets" | ||
559 | depends on ARCH_PNX4008 && I2C | ||
560 | help | ||
561 | This driver supports the Philips IP3204 I2C IP block master and/or | ||
562 | slave controller | ||
563 | |||
564 | This driver can also be built as a module. If so, the module | ||
565 | will be called i2c-pnx. | ||
566 | |||
567 | config I2C_PNX_EARLY | ||
568 | bool "Early initialization for I2C on PNXxxxx" | ||
569 | depends on I2C_PNX=y | ||
570 | help | ||
571 | Under certain circumstances one may need to make sure I2C on PNXxxxx | ||
572 | is initialized earlier than some other driver that depends on it | ||
573 | (for instance, that might be USB in case of PNX4008). With this | ||
574 | option turned on you can guarantee that. | ||
575 | |||
551 | endmenu | 576 | endmenu |
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile index 493c87289b62..37196c1d0794 100644 --- a/drivers/i2c/busses/Makefile +++ b/drivers/i2c/busses/Makefile | |||
@@ -8,6 +8,7 @@ obj-$(CONFIG_I2C_ALI15X3) += i2c-ali15x3.o | |||
8 | obj-$(CONFIG_I2C_AMD756) += i2c-amd756.o | 8 | obj-$(CONFIG_I2C_AMD756) += i2c-amd756.o |
9 | obj-$(CONFIG_I2C_AMD756_S4882) += i2c-amd756-s4882.o | 9 | obj-$(CONFIG_I2C_AMD756_S4882) += i2c-amd756-s4882.o |
10 | obj-$(CONFIG_I2C_AMD8111) += i2c-amd8111.o | 10 | obj-$(CONFIG_I2C_AMD8111) += i2c-amd8111.o |
11 | obj-$(CONFIG_I2C_AT91) += i2c-at91.o | ||
11 | obj-$(CONFIG_I2C_AU1550) += i2c-au1550.o | 12 | obj-$(CONFIG_I2C_AU1550) += i2c-au1550.o |
12 | obj-$(CONFIG_I2C_ELEKTOR) += i2c-elektor.o | 13 | obj-$(CONFIG_I2C_ELEKTOR) += i2c-elektor.o |
13 | obj-$(CONFIG_I2C_HYDRA) += i2c-hydra.o | 14 | obj-$(CONFIG_I2C_HYDRA) += i2c-hydra.o |
@@ -16,7 +17,6 @@ obj-$(CONFIG_I2C_I810) += i2c-i810.o | |||
16 | obj-$(CONFIG_I2C_IBM_IIC) += i2c-ibm_iic.o | 17 | obj-$(CONFIG_I2C_IBM_IIC) += i2c-ibm_iic.o |
17 | obj-$(CONFIG_I2C_IOP3XX) += i2c-iop3xx.o | 18 | obj-$(CONFIG_I2C_IOP3XX) += i2c-iop3xx.o |
18 | obj-$(CONFIG_I2C_ISA) += i2c-isa.o | 19 | obj-$(CONFIG_I2C_ISA) += i2c-isa.o |
19 | obj-$(CONFIG_I2C_ITE) += i2c-ite.o | ||
20 | obj-$(CONFIG_I2C_IXP2000) += i2c-ixp2000.o | 20 | obj-$(CONFIG_I2C_IXP2000) += i2c-ixp2000.o |
21 | obj-$(CONFIG_I2C_IXP4XX) += i2c-ixp4xx.o | 21 | obj-$(CONFIG_I2C_IXP4XX) += i2c-ixp4xx.o |
22 | obj-$(CONFIG_I2C_POWERMAC) += i2c-powermac.o | 22 | obj-$(CONFIG_I2C_POWERMAC) += i2c-powermac.o |
@@ -29,6 +29,7 @@ obj-$(CONFIG_I2C_PARPORT) += i2c-parport.o | |||
29 | obj-$(CONFIG_I2C_PARPORT_LIGHT) += i2c-parport-light.o | 29 | obj-$(CONFIG_I2C_PARPORT_LIGHT) += i2c-parport-light.o |
30 | obj-$(CONFIG_I2C_PCA_ISA) += i2c-pca-isa.o | 30 | obj-$(CONFIG_I2C_PCA_ISA) += i2c-pca-isa.o |
31 | obj-$(CONFIG_I2C_PIIX4) += i2c-piix4.o | 31 | obj-$(CONFIG_I2C_PIIX4) += i2c-piix4.o |
32 | obj-$(CONFIG_I2C_PNX) += i2c-pnx.o | ||
32 | obj-$(CONFIG_I2C_PROSAVAGE) += i2c-prosavage.o | 33 | obj-$(CONFIG_I2C_PROSAVAGE) += i2c-prosavage.o |
33 | obj-$(CONFIG_I2C_PXA) += i2c-pxa.o | 34 | obj-$(CONFIG_I2C_PXA) += i2c-pxa.o |
34 | obj-$(CONFIG_I2C_RPXLITE) += i2c-rpx.o | 35 | obj-$(CONFIG_I2C_RPXLITE) += i2c-rpx.o |
@@ -39,6 +40,7 @@ obj-$(CONFIG_I2C_SIS5595) += i2c-sis5595.o | |||
39 | obj-$(CONFIG_I2C_SIS630) += i2c-sis630.o | 40 | obj-$(CONFIG_I2C_SIS630) += i2c-sis630.o |
40 | obj-$(CONFIG_I2C_SIS96X) += i2c-sis96x.o | 41 | obj-$(CONFIG_I2C_SIS96X) += i2c-sis96x.o |
41 | obj-$(CONFIG_I2C_STUB) += i2c-stub.o | 42 | obj-$(CONFIG_I2C_STUB) += i2c-stub.o |
43 | obj-$(CONFIG_I2C_VERSATILE) += i2c-versatile.o | ||
42 | obj-$(CONFIG_I2C_VIA) += i2c-via.o | 44 | obj-$(CONFIG_I2C_VIA) += i2c-via.o |
43 | obj-$(CONFIG_I2C_VIAPRO) += i2c-viapro.o | 45 | obj-$(CONFIG_I2C_VIAPRO) += i2c-viapro.o |
44 | obj-$(CONFIG_I2C_VOODOO3) += i2c-voodoo3.o | 46 | obj-$(CONFIG_I2C_VOODOO3) += i2c-voodoo3.o |
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c new file mode 100644 index 000000000000..67f91bdda089 --- /dev/null +++ b/drivers/i2c/busses/i2c-at91.c | |||
@@ -0,0 +1,325 @@ | |||
1 | /* | ||
2 | i2c Support for Atmel's AT91 Two-Wire Interface (TWI) | ||
3 | |||
4 | Copyright (C) 2004 Rick Bronson | ||
5 | Converted to 2.6 by Andrew Victor <andrew@sanpeople.com> | ||
6 | |||
7 | Borrowed heavily from original work by: | ||
8 | Copyright (C) 2000 Philip Edelbrock <phil@stimpy.netroedge.com> | ||
9 | |||
10 | This program is free software; you can redistribute it and/or modify | ||
11 | it under the terms of the GNU General Public License as published by | ||
12 | the Free Software Foundation; either version 2 of the License, or | ||
13 | (at your option) any later version. | ||
14 | */ | ||
15 | |||
16 | #include <linux/module.h> | ||
17 | #include <linux/version.h> | ||
18 | #include <linux/kernel.h> | ||
19 | #include <linux/slab.h> | ||
20 | #include <linux/pci.h> | ||
21 | #include <linux/types.h> | ||
22 | #include <linux/delay.h> | ||
23 | #include <linux/i2c.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <linux/clk.h> | ||
26 | #include <linux/platform_device.h> | ||
27 | |||
28 | #include <asm/io.h> | ||
29 | |||
30 | #include <asm/arch/at91_twi.h> | ||
31 | #include <asm/arch/board.h> | ||
32 | #include <asm/arch/cpu.h> | ||
33 | |||
34 | #define TWI_CLOCK 100000 /* Hz. max 400 Kbits/sec */ | ||
35 | |||
36 | |||
37 | static struct clk *twi_clk; | ||
38 | static void __iomem *twi_base; | ||
39 | |||
40 | #define at91_twi_read(reg) __raw_readl(twi_base + (reg)) | ||
41 | #define at91_twi_write(reg, val) __raw_writel((val), twi_base + (reg)) | ||
42 | |||
43 | |||
44 | /* | ||
45 | * Initialize the TWI hardware registers. | ||
46 | */ | ||
47 | static void __devinit at91_twi_hwinit(void) | ||
48 | { | ||
49 | unsigned long cdiv, ckdiv; | ||
50 | |||
51 | at91_twi_write(AT91_TWI_IDR, 0xffffffff); /* Disable all interrupts */ | ||
52 | at91_twi_write(AT91_TWI_CR, AT91_TWI_SWRST); /* Reset peripheral */ | ||
53 | at91_twi_write(AT91_TWI_CR, AT91_TWI_MSEN); /* Set Master mode */ | ||
54 | |||
55 | /* Calcuate clock dividers */ | ||
56 | cdiv = (clk_get_rate(twi_clk) / (2 * TWI_CLOCK)) - 3; | ||
57 | cdiv = cdiv + 1; /* round up */ | ||
58 | ckdiv = 0; | ||
59 | while (cdiv > 255) { | ||
60 | ckdiv++; | ||
61 | cdiv = cdiv >> 1; | ||
62 | } | ||
63 | |||
64 | if (cpu_is_at91rm9200()) { /* AT91RM9200 Errata #22 */ | ||
65 | if (ckdiv > 5) { | ||
66 | printk(KERN_ERR "AT91 I2C: Invalid TWI_CLOCK value!\n"); | ||
67 | ckdiv = 5; | ||
68 | } | ||
69 | } | ||
70 | |||
71 | at91_twi_write(AT91_TWI_CWGR, (ckdiv << 16) | (cdiv << 8) | cdiv); | ||
72 | } | ||
73 | |||
74 | /* | ||
75 | * Poll the i2c status register until the specified bit is set. | ||
76 | * Returns 0 if timed out (100 msec). | ||
77 | */ | ||
78 | static short at91_poll_status(unsigned long bit) | ||
79 | { | ||
80 | int loop_cntr = 10000; | ||
81 | |||
82 | do { | ||
83 | udelay(10); | ||
84 | } while (!(at91_twi_read(AT91_TWI_SR) & bit) && (--loop_cntr > 0)); | ||
85 | |||
86 | return (loop_cntr > 0); | ||
87 | } | ||
88 | |||
89 | static int xfer_read(struct i2c_adapter *adap, unsigned char *buf, int length) | ||
90 | { | ||
91 | /* Send Start */ | ||
92 | at91_twi_write(AT91_TWI_CR, AT91_TWI_START); | ||
93 | |||
94 | /* Read data */ | ||
95 | while (length--) { | ||
96 | if (!length) /* need to send Stop before reading last byte */ | ||
97 | at91_twi_write(AT91_TWI_CR, AT91_TWI_STOP); | ||
98 | if (!at91_poll_status(AT91_TWI_RXRDY)) { | ||
99 | dev_dbg(&adap->dev, "RXRDY timeout\n"); | ||
100 | return -ETIMEDOUT; | ||
101 | } | ||
102 | *buf++ = (at91_twi_read(AT91_TWI_RHR) & 0xff); | ||
103 | } | ||
104 | |||
105 | return 0; | ||
106 | } | ||
107 | |||
108 | static int xfer_write(struct i2c_adapter *adap, unsigned char *buf, int length) | ||
109 | { | ||
110 | /* Load first byte into transmitter */ | ||
111 | at91_twi_write(AT91_TWI_THR, *buf++); | ||
112 | |||
113 | /* Send Start */ | ||
114 | at91_twi_write(AT91_TWI_CR, AT91_TWI_START); | ||
115 | |||
116 | do { | ||
117 | if (!at91_poll_status(AT91_TWI_TXRDY)) { | ||
118 | dev_dbg(&adap->dev, "TXRDY timeout\n"); | ||
119 | return -ETIMEDOUT; | ||
120 | } | ||
121 | |||
122 | length--; /* byte was transmitted */ | ||
123 | |||
124 | if (length > 0) /* more data to send? */ | ||
125 | at91_twi_write(AT91_TWI_THR, *buf++); | ||
126 | } while (length); | ||
127 | |||
128 | /* Send Stop */ | ||
129 | at91_twi_write(AT91_TWI_CR, AT91_TWI_STOP); | ||
130 | |||
131 | return 0; | ||
132 | } | ||
133 | |||
134 | /* | ||
135 | * Generic i2c master transfer entrypoint. | ||
136 | * | ||
137 | * Note: We do not use Atmel's feature of storing the "internal device address". | ||
138 | * Instead the "internal device address" has to be written using a seperate | ||
139 | * i2c message. | ||
140 | * http://lists.arm.linux.org.uk/pipermail/linux-arm-kernel/2004-September/024411.html | ||
141 | */ | ||
142 | static int at91_xfer(struct i2c_adapter *adap, struct i2c_msg *pmsg, int num) | ||
143 | { | ||
144 | int i, ret; | ||
145 | |||
146 | dev_dbg(&adap->dev, "at91_xfer: processing %d messages:\n", num); | ||
147 | |||
148 | for (i = 0; i < num; i++) { | ||
149 | dev_dbg(&adap->dev, " #%d: %sing %d byte%s %s 0x%02x\n", i, | ||
150 | pmsg->flags & I2C_M_RD ? "read" : "writ", | ||
151 | pmsg->len, pmsg->len > 1 ? "s" : "", | ||
152 | pmsg->flags & I2C_M_RD ? "from" : "to", pmsg->addr); | ||
153 | |||
154 | at91_twi_write(AT91_TWI_MMR, (pmsg->addr << 16) | ||
155 | | ((pmsg->flags & I2C_M_RD) ? AT91_TWI_MREAD : 0)); | ||
156 | |||
157 | if (pmsg->len && pmsg->buf) { /* sanity check */ | ||
158 | if (pmsg->flags & I2C_M_RD) | ||
159 | ret = xfer_read(adap, pmsg->buf, pmsg->len); | ||
160 | else | ||
161 | ret = xfer_write(adap, pmsg->buf, pmsg->len); | ||
162 | |||
163 | if (ret) | ||
164 | return ret; | ||
165 | |||
166 | /* Wait until transfer is finished */ | ||
167 | if (!at91_poll_status(AT91_TWI_TXCOMP)) { | ||
168 | dev_dbg(&adap->dev, "TXCOMP timeout\n"); | ||
169 | return -ETIMEDOUT; | ||
170 | } | ||
171 | } | ||
172 | dev_dbg(&adap->dev, "transfer complete\n"); | ||
173 | pmsg++; /* next message */ | ||
174 | } | ||
175 | return i; | ||
176 | } | ||
177 | |||
178 | /* | ||
179 | * Return list of supported functionality. | ||
180 | */ | ||
181 | static u32 at91_func(struct i2c_adapter *adapter) | ||
182 | { | ||
183 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; | ||
184 | } | ||
185 | |||
186 | static struct i2c_algorithm at91_algorithm = { | ||
187 | .master_xfer = at91_xfer, | ||
188 | .functionality = at91_func, | ||
189 | }; | ||
190 | |||
191 | /* | ||
192 | * Main initialization routine. | ||
193 | */ | ||
194 | static int __devinit at91_i2c_probe(struct platform_device *pdev) | ||
195 | { | ||
196 | struct i2c_adapter *adapter; | ||
197 | struct resource *res; | ||
198 | int rc; | ||
199 | |||
200 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
201 | if (!res) | ||
202 | return -ENXIO; | ||
203 | |||
204 | if (!request_mem_region(res->start, res->end - res->start + 1, "at91_i2c")) | ||
205 | return -EBUSY; | ||
206 | |||
207 | twi_base = ioremap(res->start, res->end - res->start + 1); | ||
208 | if (!twi_base) { | ||
209 | rc = -ENOMEM; | ||
210 | goto fail0; | ||
211 | } | ||
212 | |||
213 | twi_clk = clk_get(NULL, "twi_clk"); | ||
214 | if (IS_ERR(twi_clk)) { | ||
215 | dev_err(&pdev->dev, "no clock defined\n"); | ||
216 | rc = -ENODEV; | ||
217 | goto fail1; | ||
218 | } | ||
219 | |||
220 | adapter = kzalloc(sizeof(struct i2c_adapter), GFP_KERNEL); | ||
221 | if (adapter == NULL) { | ||
222 | dev_err(&pdev->dev, "can't allocate inteface!\n"); | ||
223 | rc = -ENOMEM; | ||
224 | goto fail2; | ||
225 | } | ||
226 | sprintf(adapter->name, "AT91"); | ||
227 | adapter->algo = &at91_algorithm; | ||
228 | adapter->class = I2C_CLASS_HWMON; | ||
229 | adapter->dev.parent = &pdev->dev; | ||
230 | |||
231 | platform_set_drvdata(pdev, adapter); | ||
232 | |||
233 | clk_enable(twi_clk); /* enable peripheral clock */ | ||
234 | at91_twi_hwinit(); /* initialize TWI controller */ | ||
235 | |||
236 | rc = i2c_add_adapter(adapter); | ||
237 | if (rc) { | ||
238 | dev_err(&pdev->dev, "Adapter %s registration failed\n", | ||
239 | adapter->name); | ||
240 | goto fail3; | ||
241 | } | ||
242 | |||
243 | dev_info(&pdev->dev, "AT91 i2c bus driver.\n"); | ||
244 | return 0; | ||
245 | |||
246 | fail3: | ||
247 | platform_set_drvdata(pdev, NULL); | ||
248 | kfree(adapter); | ||
249 | clk_disable(twi_clk); | ||
250 | fail2: | ||
251 | clk_put(twi_clk); | ||
252 | fail1: | ||
253 | iounmap(twi_base); | ||
254 | fail0: | ||
255 | release_mem_region(res->start, res->end - res->start + 1); | ||
256 | |||
257 | return rc; | ||
258 | } | ||
259 | |||
260 | static int __devexit at91_i2c_remove(struct platform_device *pdev) | ||
261 | { | ||
262 | struct i2c_adapter *adapter = platform_get_drvdata(pdev); | ||
263 | struct resource *res; | ||
264 | int rc; | ||
265 | |||
266 | rc = i2c_del_adapter(adapter); | ||
267 | platform_set_drvdata(pdev, NULL); | ||
268 | |||
269 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
270 | iounmap(twi_base); | ||
271 | release_mem_region(res->start, res->end - res->start + 1); | ||
272 | |||
273 | clk_disable(twi_clk); /* disable peripheral clock */ | ||
274 | clk_put(twi_clk); | ||
275 | |||
276 | return rc; | ||
277 | } | ||
278 | |||
279 | #ifdef CONFIG_PM | ||
280 | |||
281 | /* NOTE: could save a few mA by keeping clock off outside of at91_xfer... */ | ||
282 | |||
283 | static int at91_i2c_suspend(struct platform_device *pdev, pm_message_t mesg) | ||
284 | { | ||
285 | clk_disable(twi_clk); | ||
286 | return 0; | ||
287 | } | ||
288 | |||
289 | static int at91_i2c_resume(struct platform_device *pdev) | ||
290 | { | ||
291 | return clk_enable(twi_clk); | ||
292 | } | ||
293 | |||
294 | #else | ||
295 | #define at91_i2c_suspend NULL | ||
296 | #define at91_i2c_resume NULL | ||
297 | #endif | ||
298 | |||
299 | static struct platform_driver at91_i2c_driver = { | ||
300 | .probe = at91_i2c_probe, | ||
301 | .remove = __devexit_p(at91_i2c_remove), | ||
302 | .suspend = at91_i2c_suspend, | ||
303 | .resume = at91_i2c_resume, | ||
304 | .driver = { | ||
305 | .name = "at91_i2c", | ||
306 | .owner = THIS_MODULE, | ||
307 | }, | ||
308 | }; | ||
309 | |||
310 | static int __init at91_i2c_init(void) | ||
311 | { | ||
312 | return platform_driver_register(&at91_i2c_driver); | ||
313 | } | ||
314 | |||
315 | static void __exit at91_i2c_exit(void) | ||
316 | { | ||
317 | platform_driver_unregister(&at91_i2c_driver); | ||
318 | } | ||
319 | |||
320 | module_init(at91_i2c_init); | ||
321 | module_exit(at91_i2c_exit); | ||
322 | |||
323 | MODULE_AUTHOR("Rick Bronson"); | ||
324 | MODULE_DESCRIPTION("I2C (TWI) driver for Atmel AT91"); | ||
325 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/i2c/busses/i2c-elektor.c b/drivers/i2c/busses/i2c-elektor.c index a591fe685f06..834967464814 100644 --- a/drivers/i2c/busses/i2c-elektor.c +++ b/drivers/i2c/busses/i2c-elektor.c | |||
@@ -293,7 +293,7 @@ static int __init i2c_pcfisa_init(void) | |||
293 | 293 | ||
294 | static void i2c_pcfisa_exit(void) | 294 | static void i2c_pcfisa_exit(void) |
295 | { | 295 | { |
296 | i2c_pcf_del_bus(&pcf_isa_ops); | 296 | i2c_del_adapter(&pcf_isa_ops); |
297 | 297 | ||
298 | if (irq > 0) { | 298 | if (irq > 0) { |
299 | disable_irq(irq); | 299 | disable_irq(irq); |
diff --git a/drivers/i2c/busses/i2c-hydra.c b/drivers/i2c/busses/i2c-hydra.c index 457d48a0ab9d..9832f773651d 100644 --- a/drivers/i2c/busses/i2c-hydra.c +++ b/drivers/i2c/busses/i2c-hydra.c | |||
@@ -146,7 +146,7 @@ static int __devinit hydra_probe(struct pci_dev *dev, | |||
146 | static void __devexit hydra_remove(struct pci_dev *dev) | 146 | static void __devexit hydra_remove(struct pci_dev *dev) |
147 | { | 147 | { |
148 | pdregw(hydra_bit_data.data, 0); /* clear SCLK_OE and SDAT_OE */ | 148 | pdregw(hydra_bit_data.data, 0); /* clear SCLK_OE and SDAT_OE */ |
149 | i2c_bit_del_bus(&hydra_adap); | 149 | i2c_del_adapter(&hydra_adap); |
150 | iounmap(hydra_bit_data.data); | 150 | iounmap(hydra_bit_data.data); |
151 | release_mem_region(pci_resource_start(dev, 0)+ | 151 | release_mem_region(pci_resource_start(dev, 0)+ |
152 | offsetof(struct Hydra, CachePD), 4); | 152 | offsetof(struct Hydra, CachePD), 4); |
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index c7be2fdbd86b..ae625b854470 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -470,12 +470,20 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id | |||
470 | int err; | 470 | int err; |
471 | 471 | ||
472 | I801_dev = dev; | 472 | I801_dev = dev; |
473 | if ((dev->device == PCI_DEVICE_ID_INTEL_82801DB_3) || | 473 | switch (dev->device) { |
474 | (dev->device == PCI_DEVICE_ID_INTEL_82801EB_3) || | 474 | case PCI_DEVICE_ID_INTEL_82801DB_3: |
475 | (dev->device == PCI_DEVICE_ID_INTEL_ESB_4)) | 475 | case PCI_DEVICE_ID_INTEL_82801EB_3: |
476 | case PCI_DEVICE_ID_INTEL_ESB_4: | ||
477 | case PCI_DEVICE_ID_INTEL_ICH6_16: | ||
478 | case PCI_DEVICE_ID_INTEL_ICH7_17: | ||
479 | case PCI_DEVICE_ID_INTEL_ESB2_17: | ||
480 | case PCI_DEVICE_ID_INTEL_ICH8_5: | ||
481 | case PCI_DEVICE_ID_INTEL_ICH9_6: | ||
476 | isich4 = 1; | 482 | isich4 = 1; |
477 | else | 483 | break; |
484 | default: | ||
478 | isich4 = 0; | 485 | isich4 = 0; |
486 | } | ||
479 | 487 | ||
480 | err = pci_enable_device(dev); | 488 | err = pci_enable_device(dev); |
481 | if (err) { | 489 | if (err) { |
diff --git a/drivers/i2c/busses/i2c-i810.c b/drivers/i2c/busses/i2c-i810.c index b66fb6bb1870..10c98bc88aa6 100644 --- a/drivers/i2c/busses/i2c-i810.c +++ b/drivers/i2c/busses/i2c-i810.c | |||
@@ -219,14 +219,14 @@ static int __devinit i810_probe(struct pci_dev *dev, const struct pci_device_id | |||
219 | return retval; | 219 | return retval; |
220 | retval = i2c_bit_add_bus(&i810_ddc_adapter); | 220 | retval = i2c_bit_add_bus(&i810_ddc_adapter); |
221 | if (retval) | 221 | if (retval) |
222 | i2c_bit_del_bus(&i810_i2c_adapter); | 222 | i2c_del_adapter(&i810_i2c_adapter); |
223 | return retval; | 223 | return retval; |
224 | } | 224 | } |
225 | 225 | ||
226 | static void __devexit i810_remove(struct pci_dev *dev) | 226 | static void __devexit i810_remove(struct pci_dev *dev) |
227 | { | 227 | { |
228 | i2c_bit_del_bus(&i810_ddc_adapter); | 228 | i2c_del_adapter(&i810_ddc_adapter); |
229 | i2c_bit_del_bus(&i810_i2c_adapter); | 229 | i2c_del_adapter(&i810_i2c_adapter); |
230 | iounmap(ioaddr); | 230 | iounmap(ioaddr); |
231 | } | 231 | } |
232 | 232 | ||
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c index 781a99c1647a..1898e9987021 100644 --- a/drivers/i2c/busses/i2c-ibm_iic.c +++ b/drivers/i2c/busses/i2c-ibm_iic.c | |||
@@ -680,6 +680,12 @@ static int __devinit iic_probe(struct ocp_device *ocp){ | |||
680 | dev->idx = ocp->def->index; | 680 | dev->idx = ocp->def->index; |
681 | ocp_set_drvdata(ocp, dev); | 681 | ocp_set_drvdata(ocp, dev); |
682 | 682 | ||
683 | if (!request_mem_region(ocp->def->paddr, sizeof(struct iic_regs), | ||
684 | "ibm_iic")) { | ||
685 | ret = -EBUSY; | ||
686 | goto fail1; | ||
687 | } | ||
688 | |||
683 | if (!(dev->vaddr = ioremap(ocp->def->paddr, sizeof(struct iic_regs)))){ | 689 | if (!(dev->vaddr = ioremap(ocp->def->paddr, sizeof(struct iic_regs)))){ |
684 | printk(KERN_CRIT "ibm-iic%d: failed to ioremap device registers\n", | 690 | printk(KERN_CRIT "ibm-iic%d: failed to ioremap device registers\n", |
685 | dev->idx); | 691 | dev->idx); |
@@ -750,6 +756,8 @@ fail: | |||
750 | 756 | ||
751 | iounmap(dev->vaddr); | 757 | iounmap(dev->vaddr); |
752 | fail2: | 758 | fail2: |
759 | release_mem_region(ocp->def->paddr, sizeof(struct iic_regs)); | ||
760 | fail1: | ||
753 | ocp_set_drvdata(ocp, NULL); | 761 | ocp_set_drvdata(ocp, NULL); |
754 | kfree(dev); | 762 | kfree(dev); |
755 | return ret; | 763 | return ret; |
@@ -777,6 +785,7 @@ static void __devexit iic_remove(struct ocp_device *ocp) | |||
777 | free_irq(dev->irq, dev); | 785 | free_irq(dev->irq, dev); |
778 | } | 786 | } |
779 | iounmap(dev->vaddr); | 787 | iounmap(dev->vaddr); |
788 | release_mem_region(ocp->def->paddr, sizeof(struct iic_regs)); | ||
780 | kfree(dev); | 789 | kfree(dev); |
781 | } | 790 | } |
782 | } | 791 | } |
diff --git a/drivers/i2c/busses/i2c-ite.c b/drivers/i2c/busses/i2c-ite.c deleted file mode 100644 index f7d71869b3b9..000000000000 --- a/drivers/i2c/busses/i2c-ite.c +++ /dev/null | |||
@@ -1,278 +0,0 @@ | |||
1 | /* | ||
2 | ------------------------------------------------------------------------- | ||
3 | i2c-adap-ite.c i2c-hw access for the IIC peripheral on the ITE MIPS system | ||
4 | ------------------------------------------------------------------------- | ||
5 | Hai-Pao Fan, MontaVista Software, Inc. | ||
6 | hpfan@mvista.com or source@mvista.com | ||
7 | |||
8 | Copyright 2001 MontaVista Software Inc. | ||
9 | |||
10 | ---------------------------------------------------------------------------- | ||
11 | This file was highly leveraged from i2c-elektor.c, which was created | ||
12 | by Simon G. Vogl and Hans Berglund: | ||
13 | |||
14 | |||
15 | Copyright (C) 1995-97 Simon G. Vogl | ||
16 | 1998-99 Hans Berglund | ||
17 | |||
18 | This program is free software; you can redistribute it and/or modify | ||
19 | it under the terms of the GNU General Public License as published by | ||
20 | the Free Software Foundation; either version 2 of the License, or | ||
21 | (at your option) any later version. | ||
22 | |||
23 | This program is distributed in the hope that it will be useful, | ||
24 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
25 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
26 | GNU General Public License for more details. | ||
27 | |||
28 | You should have received a copy of the GNU General Public License | ||
29 | along with this program; if not, write to the Free Software | ||
30 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | ||
31 | /* ------------------------------------------------------------------------- */ | ||
32 | |||
33 | /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even | ||
34 | Frodo Looijaard <frodol@dds.nl> */ | ||
35 | |||
36 | #include <linux/kernel.h> | ||
37 | #include <linux/ioport.h> | ||
38 | #include <linux/module.h> | ||
39 | #include <linux/delay.h> | ||
40 | #include <linux/slab.h> | ||
41 | #include <linux/init.h> | ||
42 | #include <linux/wait.h> | ||
43 | #include <asm/irq.h> | ||
44 | #include <asm/io.h> | ||
45 | |||
46 | #include <linux/i2c.h> | ||
47 | #include <linux/i2c-algo-ite.h> | ||
48 | #include <linux/i2c-adap-ite.h> | ||
49 | #include "../i2c-ite.h" | ||
50 | |||
51 | #define DEFAULT_BASE 0x14014030 | ||
52 | #define ITE_IIC_IO_SIZE 0x40 | ||
53 | #define DEFAULT_IRQ 0 | ||
54 | #define DEFAULT_CLOCK 0x1b0e /* default 16MHz/(27+14) = 400KHz */ | ||
55 | #define DEFAULT_OWN 0x55 | ||
56 | |||
57 | static int base; | ||
58 | static int irq; | ||
59 | static int clock; | ||
60 | static int own; | ||
61 | |||
62 | static struct iic_ite gpi; | ||
63 | static wait_queue_head_t iic_wait; | ||
64 | static int iic_pending; | ||
65 | static spinlock_t lock; | ||
66 | |||
67 | /* ----- local functions ---------------------------------------------- */ | ||
68 | |||
69 | static void iic_ite_setiic(void *data, int ctl, short val) | ||
70 | { | ||
71 | unsigned long j = jiffies + 10; | ||
72 | |||
73 | pr_debug(" Write 0x%02x to 0x%x\n",(unsigned short)val, ctl&0xff); | ||
74 | #ifdef DEBUG | ||
75 | while (time_before(jiffies, j)) | ||
76 | schedule(); | ||
77 | #endif | ||
78 | outw(val,ctl); | ||
79 | } | ||
80 | |||
81 | static short iic_ite_getiic(void *data, int ctl) | ||
82 | { | ||
83 | short val; | ||
84 | |||
85 | val = inw(ctl); | ||
86 | pr_debug("Read 0x%02x from 0x%x\n",(unsigned short)val, ctl&0xff); | ||
87 | return (val); | ||
88 | } | ||
89 | |||
90 | /* Return our slave address. This is the address | ||
91 | * put on the I2C bus when another master on the bus wants to address us | ||
92 | * as a slave | ||
93 | */ | ||
94 | static int iic_ite_getown(void *data) | ||
95 | { | ||
96 | return (gpi.iic_own); | ||
97 | } | ||
98 | |||
99 | |||
100 | static int iic_ite_getclock(void *data) | ||
101 | { | ||
102 | return (gpi.iic_clock); | ||
103 | } | ||
104 | |||
105 | |||
106 | /* Put this process to sleep. We will wake up when the | ||
107 | * IIC controller interrupts. | ||
108 | */ | ||
109 | static void iic_ite_waitforpin(void) { | ||
110 | DEFINE_WAIT(wait); | ||
111 | int timeout = 2; | ||
112 | unsigned long flags; | ||
113 | |||
114 | /* If interrupts are enabled (which they are), then put the process to | ||
115 | * sleep. This process will be awakened by two events -- either the | ||
116 | * the IIC peripheral interrupts or the timeout expires. | ||
117 | * If interrupts are not enabled then delay for a reasonable amount | ||
118 | * of time and return. | ||
119 | */ | ||
120 | if (gpi.iic_irq > 0) { | ||
121 | spin_lock_irqsave(&lock, flags); | ||
122 | if (iic_pending == 0) { | ||
123 | spin_unlock_irqrestore(&lock, flags); | ||
124 | prepare_to_wait(&iic_wait, &wait, TASK_INTERRUPTIBLE); | ||
125 | if (schedule_timeout(timeout*HZ)) { | ||
126 | spin_lock_irqsave(&lock, flags); | ||
127 | if (iic_pending == 1) { | ||
128 | iic_pending = 0; | ||
129 | } | ||
130 | spin_unlock_irqrestore(&lock, flags); | ||
131 | } | ||
132 | finish_wait(&iic_wait, &wait); | ||
133 | } else { | ||
134 | iic_pending = 0; | ||
135 | spin_unlock_irqrestore(&lock, flags); | ||
136 | } | ||
137 | } else { | ||
138 | udelay(100); | ||
139 | } | ||
140 | } | ||
141 | |||
142 | |||
143 | static irqreturn_t iic_ite_handler(int this_irq, void *dev_id) | ||
144 | { | ||
145 | spin_lock(&lock); | ||
146 | iic_pending = 1; | ||
147 | spin_unlock(&lock); | ||
148 | |||
149 | wake_up_interruptible(&iic_wait); | ||
150 | |||
151 | return IRQ_HANDLED; | ||
152 | } | ||
153 | |||
154 | |||
155 | /* Lock the region of memory where I/O registers exist. Request our | ||
156 | * interrupt line and register its associated handler. | ||
157 | */ | ||
158 | static int iic_hw_resrc_init(void) | ||
159 | { | ||
160 | if (!request_region(gpi.iic_base, ITE_IIC_IO_SIZE, "i2c")) | ||
161 | return -ENODEV; | ||
162 | |||
163 | if (gpi.iic_irq <= 0) | ||
164 | return 0; | ||
165 | |||
166 | if (request_irq(gpi.iic_irq, iic_ite_handler, 0, "ITE IIC", 0) < 0) | ||
167 | gpi.iic_irq = 0; | ||
168 | else | ||
169 | enable_irq(gpi.iic_irq); | ||
170 | |||
171 | return 0; | ||
172 | } | ||
173 | |||
174 | |||
175 | static void iic_ite_release(void) | ||
176 | { | ||
177 | if (gpi.iic_irq > 0) { | ||
178 | disable_irq(gpi.iic_irq); | ||
179 | free_irq(gpi.iic_irq, 0); | ||
180 | } | ||
181 | release_region(gpi.iic_base , 2); | ||
182 | } | ||
183 | |||
184 | /* ------------------------------------------------------------------------ | ||
185 | * Encapsulate the above functions in the correct operations structure. | ||
186 | * This is only done when more than one hardware adapter is supported. | ||
187 | */ | ||
188 | static struct i2c_algo_iic_data iic_ite_data = { | ||
189 | NULL, | ||
190 | iic_ite_setiic, | ||
191 | iic_ite_getiic, | ||
192 | iic_ite_getown, | ||
193 | iic_ite_getclock, | ||
194 | iic_ite_waitforpin, | ||
195 | 80, 80, 100, /* waits, timeout */ | ||
196 | }; | ||
197 | |||
198 | static struct i2c_adapter iic_ite_ops = { | ||
199 | .owner = THIS_MODULE, | ||
200 | .id = I2C_HW_I_IIC, | ||
201 | .algo_data = &iic_ite_data, | ||
202 | .name = "ITE IIC adapter", | ||
203 | }; | ||
204 | |||
205 | /* Called when the module is loaded. This function starts the | ||
206 | * cascade of calls up through the hierarchy of i2c modules (i.e. up to the | ||
207 | * algorithm layer and into to the core layer) | ||
208 | */ | ||
209 | static int __init iic_ite_init(void) | ||
210 | { | ||
211 | |||
212 | struct iic_ite *piic = &gpi; | ||
213 | |||
214 | printk(KERN_INFO "Initialize ITE IIC adapter module\n"); | ||
215 | if (base == 0) | ||
216 | piic->iic_base = DEFAULT_BASE; | ||
217 | else | ||
218 | piic->iic_base = base; | ||
219 | |||
220 | if (irq == 0) | ||
221 | piic->iic_irq = DEFAULT_IRQ; | ||
222 | else | ||
223 | piic->iic_irq = irq; | ||
224 | |||
225 | if (clock == 0) | ||
226 | piic->iic_clock = DEFAULT_CLOCK; | ||
227 | else | ||
228 | piic->iic_clock = clock; | ||
229 | |||
230 | if (own == 0) | ||
231 | piic->iic_own = DEFAULT_OWN; | ||
232 | else | ||
233 | piic->iic_own = own; | ||
234 | |||
235 | iic_ite_data.data = (void *)piic; | ||
236 | init_waitqueue_head(&iic_wait); | ||
237 | spin_lock_init(&lock); | ||
238 | if (iic_hw_resrc_init() == 0) { | ||
239 | if (i2c_iic_add_bus(&iic_ite_ops) < 0) | ||
240 | return -ENODEV; | ||
241 | } else { | ||
242 | return -ENODEV; | ||
243 | } | ||
244 | printk(KERN_INFO " found device at %#x irq %d.\n", | ||
245 | piic->iic_base, piic->iic_irq); | ||
246 | return 0; | ||
247 | } | ||
248 | |||
249 | |||
250 | static void iic_ite_exit(void) | ||
251 | { | ||
252 | i2c_iic_del_bus(&iic_ite_ops); | ||
253 | iic_ite_release(); | ||
254 | } | ||
255 | |||
256 | /* If modules is NOT defined when this file is compiled, then the MODULE_* | ||
257 | * macros will resolve to nothing | ||
258 | */ | ||
259 | MODULE_AUTHOR("MontaVista Software <www.mvista.com>"); | ||
260 | MODULE_DESCRIPTION("I2C-Bus adapter routines for ITE IIC bus adapter"); | ||
261 | MODULE_LICENSE("GPL"); | ||
262 | |||
263 | module_param(base, int, 0); | ||
264 | module_param(irq, int, 0); | ||
265 | module_param(clock, int, 0); | ||
266 | module_param(own, int, 0); | ||
267 | |||
268 | |||
269 | /* Called when module is loaded or when kernel is initialized. | ||
270 | * If MODULES is defined when this file is compiled, then this function will | ||
271 | * resolve to init_module (the function called when insmod is invoked for a | ||
272 | * module). Otherwise, this function is called early in the boot, when the | ||
273 | * kernel is intialized. Check out /include/init.h to see how this works. | ||
274 | */ | ||
275 | module_init(iic_ite_init); | ||
276 | |||
277 | /* Resolves to module_cleanup when MODULES is defined. */ | ||
278 | module_exit(iic_ite_exit); | ||
diff --git a/drivers/i2c/busses/i2c-ixp2000.c b/drivers/i2c/busses/i2c-ixp2000.c index dd3f4cd3aa68..efa3ecc5522a 100644 --- a/drivers/i2c/busses/i2c-ixp2000.c +++ b/drivers/i2c/busses/i2c-ixp2000.c | |||
@@ -90,7 +90,7 @@ static int ixp2000_i2c_remove(struct platform_device *plat_dev) | |||
90 | 90 | ||
91 | platform_set_drvdata(plat_dev, NULL); | 91 | platform_set_drvdata(plat_dev, NULL); |
92 | 92 | ||
93 | i2c_bit_del_bus(&drv_data->adapter); | 93 | i2c_del_adapter(&drv_data->adapter); |
94 | 94 | ||
95 | kfree(drv_data); | 95 | kfree(drv_data); |
96 | 96 | ||
diff --git a/drivers/i2c/busses/i2c-ixp4xx.c b/drivers/i2c/busses/i2c-ixp4xx.c index 68fe863f9d54..08e89b83984a 100644 --- a/drivers/i2c/busses/i2c-ixp4xx.c +++ b/drivers/i2c/busses/i2c-ixp4xx.c | |||
@@ -91,7 +91,7 @@ static int ixp4xx_i2c_remove(struct platform_device *plat_dev) | |||
91 | 91 | ||
92 | platform_set_drvdata(plat_dev, NULL); | 92 | platform_set_drvdata(plat_dev, NULL); |
93 | 93 | ||
94 | i2c_bit_del_bus(&drv_data->adapter); | 94 | i2c_del_adapter(&drv_data->adapter); |
95 | 95 | ||
96 | kfree(drv_data); | 96 | kfree(drv_data); |
97 | 97 | ||
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c index e0292e414ab2..ad37c10e7fec 100644 --- a/drivers/i2c/busses/i2c-nforce2.c +++ b/drivers/i2c/busses/i2c-nforce2.c | |||
@@ -35,7 +35,7 @@ | |||
35 | nForce4 MCP55 0368 | 35 | nForce4 MCP55 0368 |
36 | 36 | ||
37 | This driver supports the 2 SMBuses that are included in the MCP of the | 37 | This driver supports the 2 SMBuses that are included in the MCP of the |
38 | nForce2/3/4 chipsets. | 38 | nForce2/3/4/5xx chipsets. |
39 | */ | 39 | */ |
40 | 40 | ||
41 | /* Note: we assume there can only be one nForce2, with two SMBus interfaces */ | 41 | /* Note: we assume there can only be one nForce2, with two SMBus interfaces */ |
@@ -52,8 +52,8 @@ | |||
52 | #include <asm/io.h> | 52 | #include <asm/io.h> |
53 | 53 | ||
54 | MODULE_LICENSE("GPL"); | 54 | MODULE_LICENSE("GPL"); |
55 | MODULE_AUTHOR ("Hans-Frieder Vogt <hfvogt@arcor.de>"); | 55 | MODULE_AUTHOR ("Hans-Frieder Vogt <hfvogt@gmx.net>"); |
56 | MODULE_DESCRIPTION("nForce2 SMBus driver"); | 56 | MODULE_DESCRIPTION("nForce2/3/4/5xx SMBus driver"); |
57 | 57 | ||
58 | 58 | ||
59 | struct nforce2_smbus { | 59 | struct nforce2_smbus { |
@@ -80,9 +80,6 @@ struct nforce2_smbus { | |||
80 | #define NVIDIA_SMB_ADDR (smbus->base + 0x02) /* address */ | 80 | #define NVIDIA_SMB_ADDR (smbus->base + 0x02) /* address */ |
81 | #define NVIDIA_SMB_CMD (smbus->base + 0x03) /* command */ | 81 | #define NVIDIA_SMB_CMD (smbus->base + 0x03) /* command */ |
82 | #define NVIDIA_SMB_DATA (smbus->base + 0x04) /* 32 data registers */ | 82 | #define NVIDIA_SMB_DATA (smbus->base + 0x04) /* 32 data registers */ |
83 | #define NVIDIA_SMB_BCNT (smbus->base + 0x24) /* number of data bytes */ | ||
84 | #define NVIDIA_SMB_ALRM_A (smbus->base + 0x25) /* alarm address */ | ||
85 | #define NVIDIA_SMB_ALRM_D (smbus->base + 0x26) /* 2 bytes alarm data */ | ||
86 | 83 | ||
87 | #define NVIDIA_SMB_STS_DONE 0x80 | 84 | #define NVIDIA_SMB_STS_DONE 0x80 |
88 | #define NVIDIA_SMB_STS_ALRM 0x40 | 85 | #define NVIDIA_SMB_STS_ALRM 0x40 |
@@ -95,40 +92,17 @@ struct nforce2_smbus { | |||
95 | #define NVIDIA_SMB_PRTCL_BYTE 0x04 | 92 | #define NVIDIA_SMB_PRTCL_BYTE 0x04 |
96 | #define NVIDIA_SMB_PRTCL_BYTE_DATA 0x06 | 93 | #define NVIDIA_SMB_PRTCL_BYTE_DATA 0x06 |
97 | #define NVIDIA_SMB_PRTCL_WORD_DATA 0x08 | 94 | #define NVIDIA_SMB_PRTCL_WORD_DATA 0x08 |
98 | #define NVIDIA_SMB_PRTCL_BLOCK_DATA 0x0a | ||
99 | #define NVIDIA_SMB_PRTCL_PROC_CALL 0x0c | ||
100 | #define NVIDIA_SMB_PRTCL_BLOCK_PROC_CALL 0x0d | ||
101 | #define NVIDIA_SMB_PRTCL_I2C_BLOCK_DATA 0x4a | ||
102 | #define NVIDIA_SMB_PRTCL_PEC 0x80 | 95 | #define NVIDIA_SMB_PRTCL_PEC 0x80 |
103 | 96 | ||
104 | static struct pci_driver nforce2_driver; | 97 | static struct pci_driver nforce2_driver; |
105 | 98 | ||
106 | static s32 nforce2_access(struct i2c_adapter *adap, u16 addr, | 99 | /* Return -1 on error */ |
107 | unsigned short flags, char read_write, | ||
108 | u8 command, int size, union i2c_smbus_data *data); | ||
109 | static u32 nforce2_func(struct i2c_adapter *adapter); | ||
110 | |||
111 | |||
112 | static const struct i2c_algorithm smbus_algorithm = { | ||
113 | .smbus_xfer = nforce2_access, | ||
114 | .functionality = nforce2_func, | ||
115 | }; | ||
116 | |||
117 | static struct i2c_adapter nforce2_adapter = { | ||
118 | .owner = THIS_MODULE, | ||
119 | .class = I2C_CLASS_HWMON, | ||
120 | .algo = &smbus_algorithm, | ||
121 | }; | ||
122 | |||
123 | /* Return -1 on error. See smbus.h for more information */ | ||
124 | static s32 nforce2_access(struct i2c_adapter * adap, u16 addr, | 100 | static s32 nforce2_access(struct i2c_adapter * adap, u16 addr, |
125 | unsigned short flags, char read_write, | 101 | unsigned short flags, char read_write, |
126 | u8 command, int size, union i2c_smbus_data * data) | 102 | u8 command, int size, union i2c_smbus_data * data) |
127 | { | 103 | { |
128 | struct nforce2_smbus *smbus = adap->algo_data; | 104 | struct nforce2_smbus *smbus = adap->algo_data; |
129 | unsigned char protocol, pec, temp; | 105 | unsigned char protocol, pec, temp; |
130 | unsigned char len = 0; /* to keep the compiler quiet */ | ||
131 | int i; | ||
132 | 106 | ||
133 | protocol = (read_write == I2C_SMBUS_READ) ? NVIDIA_SMB_PRTCL_READ : | 107 | protocol = (read_write == I2C_SMBUS_READ) ? NVIDIA_SMB_PRTCL_READ : |
134 | NVIDIA_SMB_PRTCL_WRITE; | 108 | NVIDIA_SMB_PRTCL_WRITE; |
@@ -163,35 +137,6 @@ static s32 nforce2_access(struct i2c_adapter * adap, u16 addr, | |||
163 | protocol |= NVIDIA_SMB_PRTCL_WORD_DATA | pec; | 137 | protocol |= NVIDIA_SMB_PRTCL_WORD_DATA | pec; |
164 | break; | 138 | break; |
165 | 139 | ||
166 | case I2C_SMBUS_BLOCK_DATA: | ||
167 | outb_p(command, NVIDIA_SMB_CMD); | ||
168 | if (read_write == I2C_SMBUS_WRITE) { | ||
169 | len = min_t(u8, data->block[0], 32); | ||
170 | outb_p(len, NVIDIA_SMB_BCNT); | ||
171 | for (i = 0; i < len; i++) | ||
172 | outb_p(data->block[i + 1], NVIDIA_SMB_DATA+i); | ||
173 | } | ||
174 | protocol |= NVIDIA_SMB_PRTCL_BLOCK_DATA | pec; | ||
175 | break; | ||
176 | |||
177 | case I2C_SMBUS_I2C_BLOCK_DATA: | ||
178 | len = min_t(u8, data->block[0], 32); | ||
179 | outb_p(command, NVIDIA_SMB_CMD); | ||
180 | outb_p(len, NVIDIA_SMB_BCNT); | ||
181 | if (read_write == I2C_SMBUS_WRITE) | ||
182 | for (i = 0; i < len; i++) | ||
183 | outb_p(data->block[i + 1], NVIDIA_SMB_DATA+i); | ||
184 | protocol |= NVIDIA_SMB_PRTCL_I2C_BLOCK_DATA; | ||
185 | break; | ||
186 | |||
187 | case I2C_SMBUS_PROC_CALL: | ||
188 | dev_err(&adap->dev, "I2C_SMBUS_PROC_CALL not supported!\n"); | ||
189 | return -1; | ||
190 | |||
191 | case I2C_SMBUS_BLOCK_PROC_CALL: | ||
192 | dev_err(&adap->dev, "I2C_SMBUS_BLOCK_PROC_CALL not supported!\n"); | ||
193 | return -1; | ||
194 | |||
195 | default: | 140 | default: |
196 | dev_err(&adap->dev, "Unsupported transaction %d\n", size); | 141 | dev_err(&adap->dev, "Unsupported transaction %d\n", size); |
197 | return -1; | 142 | return -1; |
@@ -227,19 +172,8 @@ static s32 nforce2_access(struct i2c_adapter * adap, u16 addr, | |||
227 | break; | 172 | break; |
228 | 173 | ||
229 | case I2C_SMBUS_WORD_DATA: | 174 | case I2C_SMBUS_WORD_DATA: |
230 | /* case I2C_SMBUS_PROC_CALL: not supported */ | ||
231 | data->word = inb_p(NVIDIA_SMB_DATA) | (inb_p(NVIDIA_SMB_DATA+1) << 8); | 175 | data->word = inb_p(NVIDIA_SMB_DATA) | (inb_p(NVIDIA_SMB_DATA+1) << 8); |
232 | break; | 176 | break; |
233 | |||
234 | case I2C_SMBUS_BLOCK_DATA: | ||
235 | /* case I2C_SMBUS_BLOCK_PROC_CALL: not supported */ | ||
236 | len = inb_p(NVIDIA_SMB_BCNT); | ||
237 | len = min_t(u8, len, 32); | ||
238 | case I2C_SMBUS_I2C_BLOCK_DATA: | ||
239 | for (i = 0; i < len; i++) | ||
240 | data->block[i+1] = inb_p(NVIDIA_SMB_DATA + i); | ||
241 | data->block[0] = len; | ||
242 | break; | ||
243 | } | 177 | } |
244 | 178 | ||
245 | return 0; | 179 | return 0; |
@@ -250,10 +184,14 @@ static u32 nforce2_func(struct i2c_adapter *adapter) | |||
250 | { | 184 | { |
251 | /* other functionality might be possible, but is not tested */ | 185 | /* other functionality might be possible, but is not tested */ |
252 | return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | | 186 | return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | |
253 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA /* | | 187 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA; |
254 | I2C_FUNC_SMBUS_BLOCK_DATA */; | ||
255 | } | 188 | } |
256 | 189 | ||
190 | static struct i2c_algorithm smbus_algorithm = { | ||
191 | .smbus_xfer = nforce2_access, | ||
192 | .functionality = nforce2_func, | ||
193 | }; | ||
194 | |||
257 | 195 | ||
258 | static struct pci_device_id nforce2_ids[] = { | 196 | static struct pci_device_id nforce2_ids[] = { |
259 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS) }, | 197 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS) }, |
@@ -267,7 +205,6 @@ static struct pci_device_id nforce2_ids[] = { | |||
267 | { 0 } | 205 | { 0 } |
268 | }; | 206 | }; |
269 | 207 | ||
270 | |||
271 | MODULE_DEVICE_TABLE (pci, nforce2_ids); | 208 | MODULE_DEVICE_TABLE (pci, nforce2_ids); |
272 | 209 | ||
273 | 210 | ||
@@ -291,7 +228,7 @@ static int __devinit nforce2_probe_smb (struct pci_dev *dev, int bar, | |||
291 | } | 228 | } |
292 | 229 | ||
293 | smbus->base = iobase & PCI_BASE_ADDRESS_IO_MASK; | 230 | smbus->base = iobase & PCI_BASE_ADDRESS_IO_MASK; |
294 | smbus->size = 8; | 231 | smbus->size = 64; |
295 | } | 232 | } |
296 | smbus->dev = dev; | 233 | smbus->dev = dev; |
297 | 234 | ||
@@ -300,7 +237,9 @@ static int __devinit nforce2_probe_smb (struct pci_dev *dev, int bar, | |||
300 | smbus->base, smbus->base+smbus->size-1, name); | 237 | smbus->base, smbus->base+smbus->size-1, name); |
301 | return -1; | 238 | return -1; |
302 | } | 239 | } |
303 | smbus->adapter = nforce2_adapter; | 240 | smbus->adapter.owner = THIS_MODULE; |
241 | smbus->adapter.class = I2C_CLASS_HWMON; | ||
242 | smbus->adapter.algo = &smbus_algorithm; | ||
304 | smbus->adapter.algo_data = smbus; | 243 | smbus->adapter.algo_data = smbus; |
305 | smbus->adapter.dev.parent = &dev->dev; | 244 | smbus->adapter.dev.parent = &dev->dev; |
306 | snprintf(smbus->adapter.name, I2C_NAME_SIZE, | 245 | snprintf(smbus->adapter.name, I2C_NAME_SIZE, |
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index dec04da0455c..bcd8367cede1 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c | |||
@@ -231,8 +231,8 @@ static int omap_i2c_init(struct omap_i2c_dev *dev) | |||
231 | * 13 2 1 | 231 | * 13 2 1 |
232 | * 19.2 2 1 | 232 | * 19.2 2 1 |
233 | */ | 233 | */ |
234 | if (fclk_rate > 16000000) | 234 | if (fclk_rate > 12000000) |
235 | psc = (fclk_rate + 8000000) / 12000000; | 235 | psc = fclk_rate / 12000000; |
236 | } | 236 | } |
237 | 237 | ||
238 | /* Setup clock prescaler to obtain approx 12MHz I2C module clock: */ | 238 | /* Setup clock prescaler to obtain approx 12MHz I2C module clock: */ |
diff --git a/drivers/i2c/busses/i2c-parport-light.c b/drivers/i2c/busses/i2c-parport-light.c index 5eb2bd294fd9..4bc42810b9aa 100644 --- a/drivers/i2c/busses/i2c-parport-light.c +++ b/drivers/i2c/busses/i2c-parport-light.c | |||
@@ -163,7 +163,7 @@ static void __exit i2c_parport_exit(void) | |||
163 | if (adapter_parm[type].init.val) | 163 | if (adapter_parm[type].init.val) |
164 | line_set(0, &adapter_parm[type].init); | 164 | line_set(0, &adapter_parm[type].init); |
165 | 165 | ||
166 | i2c_bit_del_bus(&parport_adapter); | 166 | i2c_del_adapter(&parport_adapter); |
167 | release_region(base, 3); | 167 | release_region(base, 3); |
168 | } | 168 | } |
169 | 169 | ||
diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c index 48a829431c7b..66696a40c7b5 100644 --- a/drivers/i2c/busses/i2c-parport.c +++ b/drivers/i2c/busses/i2c-parport.c | |||
@@ -218,7 +218,7 @@ static void i2c_parport_detach (struct parport *port) | |||
218 | if (adapter_parm[type].init.val) | 218 | if (adapter_parm[type].init.val) |
219 | line_set(port, 0, &adapter_parm[type].init); | 219 | line_set(port, 0, &adapter_parm[type].init); |
220 | 220 | ||
221 | i2c_bit_del_bus(&adapter->adapter); | 221 | i2c_del_adapter(&adapter->adapter); |
222 | parport_unregister_device(adapter->pdev); | 222 | parport_unregister_device(adapter->pdev); |
223 | if (prev) | 223 | if (prev) |
224 | prev->next = adapter->next; | 224 | prev->next = adapter->next; |
diff --git a/drivers/i2c/busses/i2c-pca-isa.c b/drivers/i2c/busses/i2c-pca-isa.c index 407840b6a260..cc6536a19eca 100644 --- a/drivers/i2c/busses/i2c-pca-isa.c +++ b/drivers/i2c/busses/i2c-pca-isa.c | |||
@@ -156,7 +156,7 @@ static int __init pca_isa_init(void) | |||
156 | 156 | ||
157 | static void pca_isa_exit(void) | 157 | static void pca_isa_exit(void) |
158 | { | 158 | { |
159 | i2c_pca_del_bus(&pca_isa_ops); | 159 | i2c_del_adapter(&pca_isa_ops); |
160 | 160 | ||
161 | if (irq > 0) { | 161 | if (irq > 0) { |
162 | disable_irq(irq); | 162 | disable_irq(irq); |
diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c new file mode 100644 index 000000000000..de0bca77e926 --- /dev/null +++ b/drivers/i2c/busses/i2c-pnx.c | |||
@@ -0,0 +1,708 @@ | |||
1 | /* | ||
2 | * Provides I2C support for Philips PNX010x/PNX4008 boards. | ||
3 | * | ||
4 | * Authors: Dennis Kovalev <dkovalev@ru.mvista.com> | ||
5 | * Vitaly Wool <vwool@ru.mvista.com> | ||
6 | * | ||
7 | * 2004-2006 (c) MontaVista Software, Inc. This file is licensed under | ||
8 | * the terms of the GNU General Public License version 2. This program | ||
9 | * is licensed "as is" without any warranty of any kind, whether express | ||
10 | * or implied. | ||
11 | */ | ||
12 | |||
13 | #include <linux/module.h> | ||
14 | #include <linux/interrupt.h> | ||
15 | #include <linux/ioport.h> | ||
16 | #include <linux/delay.h> | ||
17 | #include <linux/i2c.h> | ||
18 | #include <linux/timer.h> | ||
19 | #include <linux/completion.h> | ||
20 | #include <linux/platform_device.h> | ||
21 | #include <linux/i2c-pnx.h> | ||
22 | #include <asm/hardware.h> | ||
23 | #include <asm/irq.h> | ||
24 | #include <asm/uaccess.h> | ||
25 | |||
26 | #define I2C_PNX_TIMEOUT 10 /* msec */ | ||
27 | #define I2C_PNX_SPEED_KHZ 100 | ||
28 | #define I2C_PNX_REGION_SIZE 0x100 | ||
29 | #define PNX_DEFAULT_FREQ 13 /* MHz */ | ||
30 | |||
31 | static inline int wait_timeout(long timeout, struct i2c_pnx_algo_data *data) | ||
32 | { | ||
33 | while (timeout > 0 && | ||
34 | (ioread32(I2C_REG_STS(data)) & mstatus_active)) { | ||
35 | mdelay(1); | ||
36 | timeout--; | ||
37 | } | ||
38 | return (timeout <= 0); | ||
39 | } | ||
40 | |||
41 | static inline int wait_reset(long timeout, struct i2c_pnx_algo_data *data) | ||
42 | { | ||
43 | while (timeout > 0 && | ||
44 | (ioread32(I2C_REG_CTL(data)) & mcntrl_reset)) { | ||
45 | mdelay(1); | ||
46 | timeout--; | ||
47 | } | ||
48 | return (timeout <= 0); | ||
49 | } | ||
50 | |||
51 | static inline void i2c_pnx_arm_timer(struct i2c_adapter *adap) | ||
52 | { | ||
53 | struct i2c_pnx_algo_data *data = adap->algo_data; | ||
54 | struct timer_list *timer = &data->mif.timer; | ||
55 | int expires = I2C_PNX_TIMEOUT / (1000 / HZ); | ||
56 | |||
57 | del_timer_sync(timer); | ||
58 | |||
59 | dev_dbg(&adap->dev, "Timer armed at %lu plus %u jiffies.\n", | ||
60 | jiffies, expires); | ||
61 | |||
62 | timer->expires = jiffies + expires; | ||
63 | timer->data = (unsigned long)adap; | ||
64 | |||
65 | add_timer(timer); | ||
66 | } | ||
67 | |||
68 | /** | ||
69 | * i2c_pnx_start - start a device | ||
70 | * @slave_addr: slave address | ||
71 | * @adap: pointer to adapter structure | ||
72 | * | ||
73 | * Generate a START signal in the desired mode. | ||
74 | */ | ||
75 | static int i2c_pnx_start(unsigned char slave_addr, struct i2c_adapter *adap) | ||
76 | { | ||
77 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | ||
78 | |||
79 | dev_dbg(&adap->dev, "%s(): addr 0x%x mode %d\n", __FUNCTION__, | ||
80 | slave_addr, alg_data->mif.mode); | ||
81 | |||
82 | /* Check for 7 bit slave addresses only */ | ||
83 | if (slave_addr & ~0x7f) { | ||
84 | dev_err(&adap->dev, "%s: Invalid slave address %x. " | ||
85 | "Only 7-bit addresses are supported\n", | ||
86 | adap->name, slave_addr); | ||
87 | return -EINVAL; | ||
88 | } | ||
89 | |||
90 | /* First, make sure bus is idle */ | ||
91 | if (wait_timeout(I2C_PNX_TIMEOUT, alg_data)) { | ||
92 | /* Somebody else is monopolizing the bus */ | ||
93 | dev_err(&adap->dev, "%s: Bus busy. Slave addr = %02x, " | ||
94 | "cntrl = %x, stat = %x\n", | ||
95 | adap->name, slave_addr, | ||
96 | ioread32(I2C_REG_CTL(alg_data)), | ||
97 | ioread32(I2C_REG_STS(alg_data))); | ||
98 | return -EBUSY; | ||
99 | } else if (ioread32(I2C_REG_STS(alg_data)) & mstatus_afi) { | ||
100 | /* Sorry, we lost the bus */ | ||
101 | dev_err(&adap->dev, "%s: Arbitration failure. " | ||
102 | "Slave addr = %02x\n", adap->name, slave_addr); | ||
103 | return -EIO; | ||
104 | } | ||
105 | |||
106 | /* | ||
107 | * OK, I2C is enabled and we have the bus. | ||
108 | * Clear the current TDI and AFI status flags. | ||
109 | */ | ||
110 | iowrite32(ioread32(I2C_REG_STS(alg_data)) | mstatus_tdi | mstatus_afi, | ||
111 | I2C_REG_STS(alg_data)); | ||
112 | |||
113 | dev_dbg(&adap->dev, "%s(): sending %#x\n", __FUNCTION__, | ||
114 | (slave_addr << 1) | start_bit | alg_data->mif.mode); | ||
115 | |||
116 | /* Write the slave address, START bit and R/W bit */ | ||
117 | iowrite32((slave_addr << 1) | start_bit | alg_data->mif.mode, | ||
118 | I2C_REG_TX(alg_data)); | ||
119 | |||
120 | dev_dbg(&adap->dev, "%s(): exit\n", __FUNCTION__); | ||
121 | |||
122 | return 0; | ||
123 | } | ||
124 | |||
125 | /** | ||
126 | * i2c_pnx_stop - stop a device | ||
127 | * @adap: pointer to I2C adapter structure | ||
128 | * | ||
129 | * Generate a STOP signal to terminate the master transaction. | ||
130 | */ | ||
131 | static void i2c_pnx_stop(struct i2c_adapter *adap) | ||
132 | { | ||
133 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | ||
134 | /* Only 1 msec max timeout due to interrupt context */ | ||
135 | long timeout = 1000; | ||
136 | |||
137 | dev_dbg(&adap->dev, "%s(): entering: stat = %04x.\n", | ||
138 | __FUNCTION__, ioread32(I2C_REG_STS(alg_data))); | ||
139 | |||
140 | /* Write a STOP bit to TX FIFO */ | ||
141 | iowrite32(0xff | stop_bit, I2C_REG_TX(alg_data)); | ||
142 | |||
143 | /* Wait until the STOP is seen. */ | ||
144 | while (timeout > 0 && | ||
145 | (ioread32(I2C_REG_STS(alg_data)) & mstatus_active)) { | ||
146 | /* may be called from interrupt context */ | ||
147 | udelay(1); | ||
148 | timeout--; | ||
149 | } | ||
150 | |||
151 | dev_dbg(&adap->dev, "%s(): exiting: stat = %04x.\n", | ||
152 | __FUNCTION__, ioread32(I2C_REG_STS(alg_data))); | ||
153 | } | ||
154 | |||
155 | /** | ||
156 | * i2c_pnx_master_xmit - transmit data to slave | ||
157 | * @adap: pointer to I2C adapter structure | ||
158 | * | ||
159 | * Sends one byte of data to the slave | ||
160 | */ | ||
161 | static int i2c_pnx_master_xmit(struct i2c_adapter *adap) | ||
162 | { | ||
163 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | ||
164 | u32 val; | ||
165 | |||
166 | dev_dbg(&adap->dev, "%s(): entering: stat = %04x.\n", | ||
167 | __FUNCTION__, ioread32(I2C_REG_STS(alg_data))); | ||
168 | |||
169 | if (alg_data->mif.len > 0) { | ||
170 | /* We still have something to talk about... */ | ||
171 | val = *alg_data->mif.buf++; | ||
172 | |||
173 | if (alg_data->mif.len == 1) { | ||
174 | val |= stop_bit; | ||
175 | if (!alg_data->last) | ||
176 | val |= start_bit; | ||
177 | } | ||
178 | |||
179 | alg_data->mif.len--; | ||
180 | iowrite32(val, I2C_REG_TX(alg_data)); | ||
181 | |||
182 | dev_dbg(&adap->dev, "%s(): xmit %#x [%d]\n", __FUNCTION__, | ||
183 | val, alg_data->mif.len + 1); | ||
184 | |||
185 | if (alg_data->mif.len == 0) { | ||
186 | if (alg_data->last) { | ||
187 | /* Wait until the STOP is seen. */ | ||
188 | if (wait_timeout(I2C_PNX_TIMEOUT, alg_data)) | ||
189 | dev_err(&adap->dev, "The bus is still " | ||
190 | "active after timeout\n"); | ||
191 | } | ||
192 | /* Disable master interrupts */ | ||
193 | iowrite32(ioread32(I2C_REG_CTL(alg_data)) & | ||
194 | ~(mcntrl_afie | mcntrl_naie | mcntrl_drmie), | ||
195 | I2C_REG_CTL(alg_data)); | ||
196 | |||
197 | del_timer_sync(&alg_data->mif.timer); | ||
198 | |||
199 | dev_dbg(&adap->dev, "%s(): Waking up xfer routine.\n", | ||
200 | __FUNCTION__); | ||
201 | |||
202 | complete(&alg_data->mif.complete); | ||
203 | } | ||
204 | } else if (alg_data->mif.len == 0) { | ||
205 | /* zero-sized transfer */ | ||
206 | i2c_pnx_stop(adap); | ||
207 | |||
208 | /* Disable master interrupts. */ | ||
209 | iowrite32(ioread32(I2C_REG_CTL(alg_data)) & | ||
210 | ~(mcntrl_afie | mcntrl_naie | mcntrl_drmie), | ||
211 | I2C_REG_CTL(alg_data)); | ||
212 | |||
213 | /* Stop timer. */ | ||
214 | del_timer_sync(&alg_data->mif.timer); | ||
215 | dev_dbg(&adap->dev, "%s(): Waking up xfer routine after " | ||
216 | "zero-xfer.\n", __FUNCTION__); | ||
217 | |||
218 | complete(&alg_data->mif.complete); | ||
219 | } | ||
220 | |||
221 | dev_dbg(&adap->dev, "%s(): exiting: stat = %04x.\n", | ||
222 | __FUNCTION__, ioread32(I2C_REG_STS(alg_data))); | ||
223 | |||
224 | return 0; | ||
225 | } | ||
226 | |||
227 | /** | ||
228 | * i2c_pnx_master_rcv - receive data from slave | ||
229 | * @adap: pointer to I2C adapter structure | ||
230 | * | ||
231 | * Reads one byte data from the slave | ||
232 | */ | ||
233 | static int i2c_pnx_master_rcv(struct i2c_adapter *adap) | ||
234 | { | ||
235 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | ||
236 | unsigned int val = 0; | ||
237 | u32 ctl = 0; | ||
238 | |||
239 | dev_dbg(&adap->dev, "%s(): entering: stat = %04x.\n", | ||
240 | __FUNCTION__, ioread32(I2C_REG_STS(alg_data))); | ||
241 | |||
242 | /* Check, whether there is already data, | ||
243 | * or we didn't 'ask' for it yet. | ||
244 | */ | ||
245 | if (ioread32(I2C_REG_STS(alg_data)) & mstatus_rfe) { | ||
246 | dev_dbg(&adap->dev, "%s(): Write dummy data to fill " | ||
247 | "Rx-fifo...\n", __FUNCTION__); | ||
248 | |||
249 | if (alg_data->mif.len == 1) { | ||
250 | /* Last byte, do not acknowledge next rcv. */ | ||
251 | val |= stop_bit; | ||
252 | if (!alg_data->last) | ||
253 | val |= start_bit; | ||
254 | |||
255 | /* | ||
256 | * Enable interrupt RFDAIE (data in Rx fifo), | ||
257 | * and disable DRMIE (need data for Tx) | ||
258 | */ | ||
259 | ctl = ioread32(I2C_REG_CTL(alg_data)); | ||
260 | ctl |= mcntrl_rffie | mcntrl_daie; | ||
261 | ctl &= ~mcntrl_drmie; | ||
262 | iowrite32(ctl, I2C_REG_CTL(alg_data)); | ||
263 | } | ||
264 | |||
265 | /* | ||
266 | * Now we'll 'ask' for data: | ||
267 | * For each byte we want to receive, we must | ||
268 | * write a (dummy) byte to the Tx-FIFO. | ||
269 | */ | ||
270 | iowrite32(val, I2C_REG_TX(alg_data)); | ||
271 | |||
272 | return 0; | ||
273 | } | ||
274 | |||
275 | /* Handle data. */ | ||
276 | if (alg_data->mif.len > 0) { | ||
277 | val = ioread32(I2C_REG_RX(alg_data)); | ||
278 | *alg_data->mif.buf++ = (u8) (val & 0xff); | ||
279 | dev_dbg(&adap->dev, "%s(): rcv 0x%x [%d]\n", __FUNCTION__, val, | ||
280 | alg_data->mif.len); | ||
281 | |||
282 | alg_data->mif.len--; | ||
283 | if (alg_data->mif.len == 0) { | ||
284 | if (alg_data->last) | ||
285 | /* Wait until the STOP is seen. */ | ||
286 | if (wait_timeout(I2C_PNX_TIMEOUT, alg_data)) | ||
287 | dev_err(&adap->dev, "The bus is still " | ||
288 | "active after timeout\n"); | ||
289 | |||
290 | /* Disable master interrupts */ | ||
291 | ctl = ioread32(I2C_REG_CTL(alg_data)); | ||
292 | ctl &= ~(mcntrl_afie | mcntrl_naie | mcntrl_rffie | | ||
293 | mcntrl_drmie | mcntrl_daie); | ||
294 | iowrite32(ctl, I2C_REG_CTL(alg_data)); | ||
295 | |||
296 | /* Kill timer. */ | ||
297 | del_timer_sync(&alg_data->mif.timer); | ||
298 | complete(&alg_data->mif.complete); | ||
299 | } | ||
300 | } | ||
301 | |||
302 | dev_dbg(&adap->dev, "%s(): exiting: stat = %04x.\n", | ||
303 | __FUNCTION__, ioread32(I2C_REG_STS(alg_data))); | ||
304 | |||
305 | return 0; | ||
306 | } | ||
307 | |||
308 | static irqreturn_t | ||
309 | i2c_pnx_interrupt(int irq, void *dev_id, struct pt_regs *regs) | ||
310 | { | ||
311 | u32 stat, ctl; | ||
312 | struct i2c_adapter *adap = dev_id; | ||
313 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | ||
314 | |||
315 | dev_dbg(&adap->dev, "%s(): mstat = %x mctrl = %x, mode = %d\n", | ||
316 | __FUNCTION__, | ||
317 | ioread32(I2C_REG_STS(alg_data)), | ||
318 | ioread32(I2C_REG_CTL(alg_data)), | ||
319 | alg_data->mif.mode); | ||
320 | stat = ioread32(I2C_REG_STS(alg_data)); | ||
321 | |||
322 | /* let's see what kind of event this is */ | ||
323 | if (stat & mstatus_afi) { | ||
324 | /* We lost arbitration in the midst of a transfer */ | ||
325 | alg_data->mif.ret = -EIO; | ||
326 | |||
327 | /* Disable master interrupts. */ | ||
328 | ctl = ioread32(I2C_REG_CTL(alg_data)); | ||
329 | ctl &= ~(mcntrl_afie | mcntrl_naie | mcntrl_rffie | | ||
330 | mcntrl_drmie); | ||
331 | iowrite32(ctl, I2C_REG_CTL(alg_data)); | ||
332 | |||
333 | /* Stop timer, to prevent timeout. */ | ||
334 | del_timer_sync(&alg_data->mif.timer); | ||
335 | complete(&alg_data->mif.complete); | ||
336 | } else if (stat & mstatus_nai) { | ||
337 | /* Slave did not acknowledge, generate a STOP */ | ||
338 | dev_dbg(&adap->dev, "%s(): " | ||
339 | "Slave did not acknowledge, generating a STOP.\n", | ||
340 | __FUNCTION__); | ||
341 | i2c_pnx_stop(adap); | ||
342 | |||
343 | /* Disable master interrupts. */ | ||
344 | ctl = ioread32(I2C_REG_CTL(alg_data)); | ||
345 | ctl &= ~(mcntrl_afie | mcntrl_naie | mcntrl_rffie | | ||
346 | mcntrl_drmie); | ||
347 | iowrite32(ctl, I2C_REG_CTL(alg_data)); | ||
348 | |||
349 | /* Our return value. */ | ||
350 | alg_data->mif.ret = -EIO; | ||
351 | |||
352 | /* Stop timer, to prevent timeout. */ | ||
353 | del_timer_sync(&alg_data->mif.timer); | ||
354 | complete(&alg_data->mif.complete); | ||
355 | } else { | ||
356 | /* | ||
357 | * Two options: | ||
358 | * - Master Tx needs data. | ||
359 | * - There is data in the Rx-fifo | ||
360 | * The latter is only the case if we have requested for data, | ||
361 | * via a dummy write. (See 'i2c_pnx_master_rcv'.) | ||
362 | * We therefore check, as a sanity check, whether that interrupt | ||
363 | * has been enabled. | ||
364 | */ | ||
365 | if ((stat & mstatus_drmi) || !(stat & mstatus_rfe)) { | ||
366 | if (alg_data->mif.mode == I2C_SMBUS_WRITE) { | ||
367 | i2c_pnx_master_xmit(adap); | ||
368 | } else if (alg_data->mif.mode == I2C_SMBUS_READ) { | ||
369 | i2c_pnx_master_rcv(adap); | ||
370 | } | ||
371 | } | ||
372 | } | ||
373 | |||
374 | /* Clear TDI and AFI bits */ | ||
375 | stat = ioread32(I2C_REG_STS(alg_data)); | ||
376 | iowrite32(stat | mstatus_tdi | mstatus_afi, I2C_REG_STS(alg_data)); | ||
377 | |||
378 | dev_dbg(&adap->dev, "%s(): exiting, stat = %x ctrl = %x.\n", | ||
379 | __FUNCTION__, ioread32(I2C_REG_STS(alg_data)), | ||
380 | ioread32(I2C_REG_CTL(alg_data))); | ||
381 | |||
382 | return IRQ_HANDLED; | ||
383 | } | ||
384 | |||
385 | static void i2c_pnx_timeout(unsigned long data) | ||
386 | { | ||
387 | struct i2c_adapter *adap = (struct i2c_adapter *)data; | ||
388 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | ||
389 | u32 ctl; | ||
390 | |||
391 | dev_err(&adap->dev, "Master timed out. stat = %04x, cntrl = %04x. " | ||
392 | "Resetting master...\n", | ||
393 | ioread32(I2C_REG_STS(alg_data)), | ||
394 | ioread32(I2C_REG_CTL(alg_data))); | ||
395 | |||
396 | /* Reset master and disable interrupts */ | ||
397 | ctl = ioread32(I2C_REG_CTL(alg_data)); | ||
398 | ctl &= ~(mcntrl_afie | mcntrl_naie | mcntrl_rffie | mcntrl_drmie); | ||
399 | iowrite32(ctl, I2C_REG_CTL(alg_data)); | ||
400 | |||
401 | ctl |= mcntrl_reset; | ||
402 | iowrite32(ctl, I2C_REG_CTL(alg_data)); | ||
403 | wait_reset(I2C_PNX_TIMEOUT, alg_data); | ||
404 | alg_data->mif.ret = -EIO; | ||
405 | complete(&alg_data->mif.complete); | ||
406 | } | ||
407 | |||
408 | static inline void bus_reset_if_active(struct i2c_adapter *adap) | ||
409 | { | ||
410 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | ||
411 | u32 stat; | ||
412 | |||
413 | if ((stat = ioread32(I2C_REG_STS(alg_data))) & mstatus_active) { | ||
414 | dev_err(&adap->dev, | ||
415 | "%s: Bus is still active after xfer. Reset it...\n", | ||
416 | adap->name); | ||
417 | iowrite32(ioread32(I2C_REG_CTL(alg_data)) | mcntrl_reset, | ||
418 | I2C_REG_CTL(alg_data)); | ||
419 | wait_reset(I2C_PNX_TIMEOUT, alg_data); | ||
420 | } else if (!(stat & mstatus_rfe) || !(stat & mstatus_tfe)) { | ||
421 | /* If there is data in the fifo's after transfer, | ||
422 | * flush fifo's by reset. | ||
423 | */ | ||
424 | iowrite32(ioread32(I2C_REG_CTL(alg_data)) | mcntrl_reset, | ||
425 | I2C_REG_CTL(alg_data)); | ||
426 | wait_reset(I2C_PNX_TIMEOUT, alg_data); | ||
427 | } else if (stat & mstatus_nai) { | ||
428 | iowrite32(ioread32(I2C_REG_CTL(alg_data)) | mcntrl_reset, | ||
429 | I2C_REG_CTL(alg_data)); | ||
430 | wait_reset(I2C_PNX_TIMEOUT, alg_data); | ||
431 | } | ||
432 | } | ||
433 | |||
434 | /** | ||
435 | * i2c_pnx_xfer - generic transfer entry point | ||
436 | * @adap: pointer to I2C adapter structure | ||
437 | * @msgs: array of messages | ||
438 | * @num: number of messages | ||
439 | * | ||
440 | * Initiates the transfer | ||
441 | */ | ||
442 | static int | ||
443 | i2c_pnx_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | ||
444 | { | ||
445 | struct i2c_msg *pmsg; | ||
446 | int rc = 0, completed = 0, i; | ||
447 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | ||
448 | u32 stat = ioread32(I2C_REG_STS(alg_data)); | ||
449 | |||
450 | dev_dbg(&adap->dev, "%s(): entering: %d messages, stat = %04x.\n", | ||
451 | __FUNCTION__, num, ioread32(I2C_REG_STS(alg_data))); | ||
452 | |||
453 | bus_reset_if_active(adap); | ||
454 | |||
455 | /* Process transactions in a loop. */ | ||
456 | for (i = 0; rc >= 0 && i < num; i++) { | ||
457 | u8 addr; | ||
458 | |||
459 | pmsg = &msgs[i]; | ||
460 | addr = pmsg->addr; | ||
461 | |||
462 | if (pmsg->flags & I2C_M_TEN) { | ||
463 | dev_err(&adap->dev, | ||
464 | "%s: 10 bits addr not supported!\n", | ||
465 | adap->name); | ||
466 | rc = -EINVAL; | ||
467 | break; | ||
468 | } | ||
469 | |||
470 | alg_data->mif.buf = pmsg->buf; | ||
471 | alg_data->mif.len = pmsg->len; | ||
472 | alg_data->mif.mode = (pmsg->flags & I2C_M_RD) ? | ||
473 | I2C_SMBUS_READ : I2C_SMBUS_WRITE; | ||
474 | alg_data->mif.ret = 0; | ||
475 | alg_data->last = (i == num - 1); | ||
476 | |||
477 | dev_dbg(&adap->dev, "%s(): mode %d, %d bytes\n", __FUNCTION__, | ||
478 | alg_data->mif.mode, | ||
479 | alg_data->mif.len); | ||
480 | |||
481 | i2c_pnx_arm_timer(adap); | ||
482 | |||
483 | /* initialize the completion var */ | ||
484 | init_completion(&alg_data->mif.complete); | ||
485 | |||
486 | /* Enable master interrupt */ | ||
487 | iowrite32(ioread32(I2C_REG_CTL(alg_data)) | mcntrl_afie | | ||
488 | mcntrl_naie | mcntrl_drmie, | ||
489 | I2C_REG_CTL(alg_data)); | ||
490 | |||
491 | /* Put start-code and slave-address on the bus. */ | ||
492 | rc = i2c_pnx_start(addr, adap); | ||
493 | if (rc < 0) | ||
494 | break; | ||
495 | |||
496 | /* Wait for completion */ | ||
497 | wait_for_completion(&alg_data->mif.complete); | ||
498 | |||
499 | if (!(rc = alg_data->mif.ret)) | ||
500 | completed++; | ||
501 | dev_dbg(&adap->dev, "%s(): Complete, return code = %d.\n", | ||
502 | __FUNCTION__, rc); | ||
503 | |||
504 | /* Clear TDI and AFI bits in case they are set. */ | ||
505 | if ((stat = ioread32(I2C_REG_STS(alg_data))) & mstatus_tdi) { | ||
506 | dev_dbg(&adap->dev, | ||
507 | "%s: TDI still set... clearing now.\n", | ||
508 | adap->name); | ||
509 | iowrite32(stat, I2C_REG_STS(alg_data)); | ||
510 | } | ||
511 | if ((stat = ioread32(I2C_REG_STS(alg_data))) & mstatus_afi) { | ||
512 | dev_dbg(&adap->dev, | ||
513 | "%s: AFI still set... clearing now.\n", | ||
514 | adap->name); | ||
515 | iowrite32(stat, I2C_REG_STS(alg_data)); | ||
516 | } | ||
517 | } | ||
518 | |||
519 | bus_reset_if_active(adap); | ||
520 | |||
521 | /* Cleanup to be sure... */ | ||
522 | alg_data->mif.buf = NULL; | ||
523 | alg_data->mif.len = 0; | ||
524 | |||
525 | dev_dbg(&adap->dev, "%s(): exiting, stat = %x\n", | ||
526 | __FUNCTION__, ioread32(I2C_REG_STS(alg_data))); | ||
527 | |||
528 | if (completed != num) | ||
529 | return ((rc < 0) ? rc : -EREMOTEIO); | ||
530 | |||
531 | return num; | ||
532 | } | ||
533 | |||
534 | static u32 i2c_pnx_func(struct i2c_adapter *adapter) | ||
535 | { | ||
536 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; | ||
537 | } | ||
538 | |||
539 | static struct i2c_algorithm pnx_algorithm = { | ||
540 | .master_xfer = i2c_pnx_xfer, | ||
541 | .functionality = i2c_pnx_func, | ||
542 | }; | ||
543 | |||
544 | static int i2c_pnx_controller_suspend(struct platform_device *pdev, | ||
545 | pm_message_t state) | ||
546 | { | ||
547 | struct i2c_pnx_data *i2c_pnx = platform_get_drvdata(pdev); | ||
548 | return i2c_pnx->suspend(pdev, state); | ||
549 | } | ||
550 | |||
551 | static int i2c_pnx_controller_resume(struct platform_device *pdev) | ||
552 | { | ||
553 | struct i2c_pnx_data *i2c_pnx = platform_get_drvdata(pdev); | ||
554 | return i2c_pnx->resume(pdev); | ||
555 | } | ||
556 | |||
557 | static int __devinit i2c_pnx_probe(struct platform_device *pdev) | ||
558 | { | ||
559 | unsigned long tmp; | ||
560 | int ret = 0; | ||
561 | struct i2c_pnx_algo_data *alg_data; | ||
562 | int freq_mhz; | ||
563 | struct i2c_pnx_data *i2c_pnx = pdev->dev.platform_data; | ||
564 | |||
565 | if (!i2c_pnx || !i2c_pnx->adapter) { | ||
566 | dev_err(&pdev->dev, "%s: no platform data supplied\n", | ||
567 | __FUNCTION__); | ||
568 | ret = -EINVAL; | ||
569 | goto out; | ||
570 | } | ||
571 | |||
572 | platform_set_drvdata(pdev, i2c_pnx); | ||
573 | |||
574 | if (i2c_pnx->calculate_input_freq) | ||
575 | freq_mhz = i2c_pnx->calculate_input_freq(pdev); | ||
576 | else { | ||
577 | freq_mhz = PNX_DEFAULT_FREQ; | ||
578 | dev_info(&pdev->dev, "Setting bus frequency to default value: " | ||
579 | "%d MHz", freq_mhz); | ||
580 | } | ||
581 | |||
582 | i2c_pnx->adapter->algo = &pnx_algorithm; | ||
583 | |||
584 | alg_data = i2c_pnx->adapter->algo_data; | ||
585 | init_timer(&alg_data->mif.timer); | ||
586 | alg_data->mif.timer.function = i2c_pnx_timeout; | ||
587 | alg_data->mif.timer.data = (unsigned long)i2c_pnx->adapter; | ||
588 | |||
589 | /* Register I/O resource */ | ||
590 | if (!request_region(alg_data->base, I2C_PNX_REGION_SIZE, pdev->name)) { | ||
591 | dev_err(&pdev->dev, | ||
592 | "I/O region 0x%08x for I2C already in use.\n", | ||
593 | alg_data->base); | ||
594 | ret = -ENODEV; | ||
595 | goto out_drvdata; | ||
596 | } | ||
597 | |||
598 | if (!(alg_data->ioaddr = | ||
599 | (u32)ioremap(alg_data->base, I2C_PNX_REGION_SIZE))) { | ||
600 | dev_err(&pdev->dev, "Couldn't ioremap I2C I/O region\n"); | ||
601 | ret = -ENOMEM; | ||
602 | goto out_release; | ||
603 | } | ||
604 | |||
605 | i2c_pnx->set_clock_run(pdev); | ||
606 | |||
607 | /* | ||
608 | * Clock Divisor High This value is the number of system clocks | ||
609 | * the serial clock (SCL) will be high. | ||
610 | * For example, if the system clock period is 50 ns and the maximum | ||
611 | * desired serial period is 10000 ns (100 kHz), then CLKHI would be | ||
612 | * set to 0.5*(f_sys/f_i2c)-2=0.5*(20e6/100e3)-2=98. The actual value | ||
613 | * programmed into CLKHI will vary from this slightly due to | ||
614 | * variations in the output pad's rise and fall times as well as | ||
615 | * the deglitching filter length. | ||
616 | */ | ||
617 | |||
618 | tmp = ((freq_mhz * 1000) / I2C_PNX_SPEED_KHZ) / 2 - 2; | ||
619 | iowrite32(tmp, I2C_REG_CKH(alg_data)); | ||
620 | iowrite32(tmp, I2C_REG_CKL(alg_data)); | ||
621 | |||
622 | iowrite32(mcntrl_reset, I2C_REG_CTL(alg_data)); | ||
623 | if (wait_reset(I2C_PNX_TIMEOUT, alg_data)) { | ||
624 | ret = -ENODEV; | ||
625 | goto out_unmap; | ||
626 | } | ||
627 | init_completion(&alg_data->mif.complete); | ||
628 | |||
629 | ret = request_irq(alg_data->irq, i2c_pnx_interrupt, | ||
630 | 0, pdev->name, i2c_pnx->adapter); | ||
631 | if (ret) | ||
632 | goto out_clock; | ||
633 | |||
634 | /* Register this adapter with the I2C subsystem */ | ||
635 | i2c_pnx->adapter->dev.parent = &pdev->dev; | ||
636 | ret = i2c_add_adapter(i2c_pnx->adapter); | ||
637 | if (ret < 0) { | ||
638 | dev_err(&pdev->dev, "I2C: Failed to add bus\n"); | ||
639 | goto out_irq; | ||
640 | } | ||
641 | |||
642 | dev_dbg(&pdev->dev, "%s: Master at %#8x, irq %d.\n", | ||
643 | i2c_pnx->adapter->name, alg_data->base, alg_data->irq); | ||
644 | |||
645 | return 0; | ||
646 | |||
647 | out_irq: | ||
648 | free_irq(alg_data->irq, alg_data); | ||
649 | out_clock: | ||
650 | i2c_pnx->set_clock_stop(pdev); | ||
651 | out_unmap: | ||
652 | iounmap((void *)alg_data->ioaddr); | ||
653 | out_release: | ||
654 | release_region(alg_data->base, I2C_PNX_REGION_SIZE); | ||
655 | out_drvdata: | ||
656 | platform_set_drvdata(pdev, NULL); | ||
657 | out: | ||
658 | return ret; | ||
659 | } | ||
660 | |||
661 | static int __devexit i2c_pnx_remove(struct platform_device *pdev) | ||
662 | { | ||
663 | struct i2c_pnx_data *i2c_pnx = platform_get_drvdata(pdev); | ||
664 | struct i2c_adapter *adap = i2c_pnx->adapter; | ||
665 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | ||
666 | |||
667 | free_irq(alg_data->irq, alg_data); | ||
668 | i2c_del_adapter(adap); | ||
669 | i2c_pnx->set_clock_stop(pdev); | ||
670 | iounmap((void *)alg_data->ioaddr); | ||
671 | release_region(alg_data->base, I2C_PNX_REGION_SIZE); | ||
672 | platform_set_drvdata(pdev, NULL); | ||
673 | |||
674 | return 0; | ||
675 | } | ||
676 | |||
677 | static struct platform_driver i2c_pnx_driver = { | ||
678 | .driver = { | ||
679 | .name = "pnx-i2c", | ||
680 | .owner = THIS_MODULE, | ||
681 | }, | ||
682 | .probe = i2c_pnx_probe, | ||
683 | .remove = __devexit_p(i2c_pnx_remove), | ||
684 | .suspend = i2c_pnx_controller_suspend, | ||
685 | .resume = i2c_pnx_controller_resume, | ||
686 | }; | ||
687 | |||
688 | static int __init i2c_adap_pnx_init(void) | ||
689 | { | ||
690 | return platform_driver_register(&i2c_pnx_driver); | ||
691 | } | ||
692 | |||
693 | static void __exit i2c_adap_pnx_exit(void) | ||
694 | { | ||
695 | platform_driver_unregister(&i2c_pnx_driver); | ||
696 | } | ||
697 | |||
698 | MODULE_AUTHOR("Vitaly Wool, Dennis Kovalev <source@mvista.com>"); | ||
699 | MODULE_DESCRIPTION("I2C driver for Philips IP3204-based I2C busses"); | ||
700 | MODULE_LICENSE("GPL"); | ||
701 | |||
702 | #ifdef CONFIG_I2C_PNX_EARLY | ||
703 | /* We need to make sure I2C is initialized before USB */ | ||
704 | subsys_initcall(i2c_adap_pnx_init); | ||
705 | #else | ||
706 | mudule_init(i2c_adap_pnx_init); | ||
707 | #endif | ||
708 | module_exit(i2c_adap_pnx_exit); | ||
diff --git a/drivers/i2c/busses/i2c-prosavage.c b/drivers/i2c/busses/i2c-prosavage.c index 7745e21874a8..07c1f1e27df1 100644 --- a/drivers/i2c/busses/i2c-prosavage.c +++ b/drivers/i2c/busses/i2c-prosavage.c | |||
@@ -212,7 +212,7 @@ static void prosavage_remove(struct pci_dev *dev) | |||
212 | if (chip->i2c_bus[i].adap_ok == 0) | 212 | if (chip->i2c_bus[i].adap_ok == 0) |
213 | continue; | 213 | continue; |
214 | 214 | ||
215 | ret = i2c_bit_del_bus(&chip->i2c_bus[i].adap); | 215 | ret = i2c_del_adapter(&chip->i2c_bus[i].adap); |
216 | if (ret) { | 216 | if (ret) { |
217 | dev_err(&dev->dev, "%s not removed\n", | 217 | dev_err(&dev->dev, "%s not removed\n", |
218 | chip->i2c_bus[i].adap.name); | 218 | chip->i2c_bus[i].adap.name); |
diff --git a/drivers/i2c/busses/i2c-savage4.c b/drivers/i2c/busses/i2c-savage4.c index 209f47ea1750..844b4ff90893 100644 --- a/drivers/i2c/busses/i2c-savage4.c +++ b/drivers/i2c/busses/i2c-savage4.c | |||
@@ -173,7 +173,7 @@ static int __devinit savage4_probe(struct pci_dev *dev, const struct pci_device_ | |||
173 | 173 | ||
174 | static void __devexit savage4_remove(struct pci_dev *dev) | 174 | static void __devexit savage4_remove(struct pci_dev *dev) |
175 | { | 175 | { |
176 | i2c_bit_del_bus(&savage4_i2c_adapter); | 176 | i2c_del_adapter(&savage4_i2c_adapter); |
177 | iounmap(ioaddr); | 177 | iounmap(ioaddr); |
178 | } | 178 | } |
179 | 179 | ||
diff --git a/drivers/i2c/busses/i2c-versatile.c b/drivers/i2c/busses/i2c-versatile.c new file mode 100644 index 000000000000..081d9578ce10 --- /dev/null +++ b/drivers/i2c/busses/i2c-versatile.c | |||
@@ -0,0 +1,153 @@ | |||
1 | /* | ||
2 | * i2c-versatile.c | ||
3 | * | ||
4 | * Copyright (C) 2006 ARM Ltd. | ||
5 | * written by Russell King, Deep Blue Solutions Ltd. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/module.h> | ||
13 | #include <linux/i2c.h> | ||
14 | #include <linux/i2c-algo-bit.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | |||
18 | #include <asm/io.h> | ||
19 | |||
20 | #define I2C_CONTROL 0x00 | ||
21 | #define I2C_CONTROLS 0x00 | ||
22 | #define I2C_CONTROLC 0x04 | ||
23 | #define SCL (1 << 0) | ||
24 | #define SDA (1 << 1) | ||
25 | |||
26 | struct i2c_versatile { | ||
27 | struct i2c_adapter adap; | ||
28 | struct i2c_algo_bit_data algo; | ||
29 | void __iomem *base; | ||
30 | }; | ||
31 | |||
32 | static void i2c_versatile_setsda(void *data, int state) | ||
33 | { | ||
34 | struct i2c_versatile *i2c = data; | ||
35 | |||
36 | writel(SDA, i2c->base + (state ? I2C_CONTROLS : I2C_CONTROLC)); | ||
37 | } | ||
38 | |||
39 | static void i2c_versatile_setscl(void *data, int state) | ||
40 | { | ||
41 | struct i2c_versatile *i2c = data; | ||
42 | |||
43 | writel(SCL, i2c->base + (state ? I2C_CONTROLS : I2C_CONTROLC)); | ||
44 | } | ||
45 | |||
46 | static int i2c_versatile_getsda(void *data) | ||
47 | { | ||
48 | struct i2c_versatile *i2c = data; | ||
49 | return !!(readl(i2c->base + I2C_CONTROL) & SDA); | ||
50 | } | ||
51 | |||
52 | static int i2c_versatile_getscl(void *data) | ||
53 | { | ||
54 | struct i2c_versatile *i2c = data; | ||
55 | return !!(readl(i2c->base + I2C_CONTROL) & SCL); | ||
56 | } | ||
57 | |||
58 | static struct i2c_algo_bit_data i2c_versatile_algo = { | ||
59 | .setsda = i2c_versatile_setsda, | ||
60 | .setscl = i2c_versatile_setscl, | ||
61 | .getsda = i2c_versatile_getsda, | ||
62 | .getscl = i2c_versatile_getscl, | ||
63 | .udelay = 30, | ||
64 | .timeout = HZ, | ||
65 | }; | ||
66 | |||
67 | static int i2c_versatile_probe(struct platform_device *dev) | ||
68 | { | ||
69 | struct i2c_versatile *i2c; | ||
70 | struct resource *r; | ||
71 | int ret; | ||
72 | |||
73 | r = platform_get_resource(dev, IORESOURCE_MEM, 0); | ||
74 | if (!r) { | ||
75 | ret = -EINVAL; | ||
76 | goto err_out; | ||
77 | } | ||
78 | |||
79 | if (!request_mem_region(r->start, r->end - r->start + 1, "versatile-i2c")) { | ||
80 | ret = -EBUSY; | ||
81 | goto err_out; | ||
82 | } | ||
83 | |||
84 | i2c = kzalloc(sizeof(struct i2c_versatile), GFP_KERNEL); | ||
85 | if (!i2c) { | ||
86 | ret = -ENOMEM; | ||
87 | goto err_release; | ||
88 | } | ||
89 | |||
90 | i2c->base = ioremap(r->start, r->end - r->start + 1); | ||
91 | if (!i2c->base) { | ||
92 | ret = -ENOMEM; | ||
93 | goto err_free; | ||
94 | } | ||
95 | |||
96 | writel(SCL | SDA, i2c->base + I2C_CONTROLS); | ||
97 | |||
98 | i2c->adap.owner = THIS_MODULE; | ||
99 | strlcpy(i2c->adap.name, "Versatile I2C adapter", sizeof(i2c->adap.name)); | ||
100 | i2c->adap.algo_data = &i2c->algo; | ||
101 | i2c->adap.dev.parent = &dev->dev; | ||
102 | i2c->algo = i2c_versatile_algo; | ||
103 | i2c->algo.data = i2c; | ||
104 | |||
105 | ret = i2c_bit_add_bus(&i2c->adap); | ||
106 | if (ret >= 0) { | ||
107 | platform_set_drvdata(dev, i2c); | ||
108 | return 0; | ||
109 | } | ||
110 | |||
111 | iounmap(i2c->base); | ||
112 | err_free: | ||
113 | kfree(i2c); | ||
114 | err_release: | ||
115 | release_mem_region(r->start, r->end - r->start + 1); | ||
116 | err_out: | ||
117 | return ret; | ||
118 | } | ||
119 | |||
120 | static int i2c_versatile_remove(struct platform_device *dev) | ||
121 | { | ||
122 | struct i2c_versatile *i2c = platform_get_drvdata(dev); | ||
123 | |||
124 | platform_set_drvdata(dev, NULL); | ||
125 | |||
126 | i2c_del_adapter(&i2c->adap); | ||
127 | return 0; | ||
128 | } | ||
129 | |||
130 | static struct platform_driver i2c_versatile_driver = { | ||
131 | .probe = i2c_versatile_probe, | ||
132 | .remove = i2c_versatile_remove, | ||
133 | .driver = { | ||
134 | .name = "versatile-i2c", | ||
135 | .owner = THIS_MODULE, | ||
136 | }, | ||
137 | }; | ||
138 | |||
139 | static int __init i2c_versatile_init(void) | ||
140 | { | ||
141 | return platform_driver_register(&i2c_versatile_driver); | ||
142 | } | ||
143 | |||
144 | static void __exit i2c_versatile_exit(void) | ||
145 | { | ||
146 | platform_driver_unregister(&i2c_versatile_driver); | ||
147 | } | ||
148 | |||
149 | module_init(i2c_versatile_init); | ||
150 | module_exit(i2c_versatile_exit); | ||
151 | |||
152 | MODULE_DESCRIPTION("ARM Versatile I2C bus driver"); | ||
153 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/i2c/busses/i2c-via.c b/drivers/i2c/busses/i2c-via.c index 910e200ad500..15d7e00e47e6 100644 --- a/drivers/i2c/busses/i2c-via.c +++ b/drivers/i2c/busses/i2c-via.c | |||
@@ -151,7 +151,7 @@ static int __devinit vt586b_probe(struct pci_dev *dev, const struct pci_device_i | |||
151 | 151 | ||
152 | static void __devexit vt586b_remove(struct pci_dev *dev) | 152 | static void __devexit vt586b_remove(struct pci_dev *dev) |
153 | { | 153 | { |
154 | i2c_bit_del_bus(&vt586b_adapter); | 154 | i2c_del_adapter(&vt586b_adapter); |
155 | release_region(I2C_DIR, IOSPACE); | 155 | release_region(I2C_DIR, IOSPACE); |
156 | pm_io_base = 0; | 156 | pm_io_base = 0; |
157 | } | 157 | } |
diff --git a/drivers/i2c/busses/i2c-voodoo3.c b/drivers/i2c/busses/i2c-voodoo3.c index 6c8d25183382..b0377b81744b 100644 --- a/drivers/i2c/busses/i2c-voodoo3.c +++ b/drivers/i2c/busses/i2c-voodoo3.c | |||
@@ -211,14 +211,14 @@ static int __devinit voodoo3_probe(struct pci_dev *dev, const struct pci_device_ | |||
211 | return retval; | 211 | return retval; |
212 | retval = i2c_bit_add_bus(&voodoo3_ddc_adapter); | 212 | retval = i2c_bit_add_bus(&voodoo3_ddc_adapter); |
213 | if (retval) | 213 | if (retval) |
214 | i2c_bit_del_bus(&voodoo3_i2c_adapter); | 214 | i2c_del_adapter(&voodoo3_i2c_adapter); |
215 | return retval; | 215 | return retval; |
216 | } | 216 | } |
217 | 217 | ||
218 | static void __devexit voodoo3_remove(struct pci_dev *dev) | 218 | static void __devexit voodoo3_remove(struct pci_dev *dev) |
219 | { | 219 | { |
220 | i2c_bit_del_bus(&voodoo3_i2c_adapter); | 220 | i2c_del_adapter(&voodoo3_i2c_adapter); |
221 | i2c_bit_del_bus(&voodoo3_ddc_adapter); | 221 | i2c_del_adapter(&voodoo3_ddc_adapter); |
222 | iounmap(ioaddr); | 222 | iounmap(ioaddr); |
223 | } | 223 | } |
224 | 224 | ||
diff --git a/drivers/i2c/busses/scx200_i2c.c b/drivers/i2c/busses/scx200_i2c.c index 8ddbae4fafe6..6cd96e43aa72 100644 --- a/drivers/i2c/busses/scx200_i2c.c +++ b/drivers/i2c/busses/scx200_i2c.c | |||
@@ -116,7 +116,7 @@ static int scx200_i2c_init(void) | |||
116 | 116 | ||
117 | static void scx200_i2c_cleanup(void) | 117 | static void scx200_i2c_cleanup(void) |
118 | { | 118 | { |
119 | i2c_bit_del_bus(&scx200_i2c_ops); | 119 | i2c_del_adapter(&scx200_i2c_ops); |
120 | } | 120 | } |
121 | 121 | ||
122 | module_init(scx200_i2c_init); | 122 | module_init(scx200_i2c_init); |
diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c index 93d483b8b770..ec17d6b684a2 100644 --- a/drivers/i2c/chips/ds1337.c +++ b/drivers/i2c/chips/ds1337.c | |||
@@ -347,13 +347,19 @@ static void ds1337_init_client(struct i2c_client *client) | |||
347 | 347 | ||
348 | if ((status & 0x80) || (control & 0x80)) { | 348 | if ((status & 0x80) || (control & 0x80)) { |
349 | /* RTC not running */ | 349 | /* RTC not running */ |
350 | u8 buf[16]; | 350 | u8 buf[1+16]; /* First byte is interpreted as address */ |
351 | struct i2c_msg msg[1]; | 351 | struct i2c_msg msg[1]; |
352 | 352 | ||
353 | dev_dbg(&client->dev, "%s: RTC not running!\n", __FUNCTION__); | 353 | dev_dbg(&client->dev, "%s: RTC not running!\n", __FUNCTION__); |
354 | 354 | ||
355 | /* Initialize all, including STATUS and CONTROL to zero */ | 355 | /* Initialize all, including STATUS and CONTROL to zero */ |
356 | memset(buf, 0, sizeof(buf)); | 356 | memset(buf, 0, sizeof(buf)); |
357 | |||
358 | /* Write valid values in the date/time registers */ | ||
359 | buf[1+DS1337_REG_DAY] = 1; | ||
360 | buf[1+DS1337_REG_DATE] = 1; | ||
361 | buf[1+DS1337_REG_MONTH] = 1; | ||
362 | |||
357 | msg[0].addr = client->addr; | 363 | msg[0].addr = client->addr; |
358 | msg[0].flags = 0; | 364 | msg[0].flags = 0; |
359 | msg[0].len = sizeof(buf); | 365 | msg[0].len = sizeof(buf); |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 7ca81f42d14b..3e31f1d265c9 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -127,20 +127,17 @@ static ssize_t show_client_name(struct device *dev, struct device_attribute *att | |||
127 | return sprintf(buf, "%s\n", client->name); | 127 | return sprintf(buf, "%s\n", client->name); |
128 | } | 128 | } |
129 | 129 | ||
130 | /* | 130 | /* |
131 | * We can't use the DEVICE_ATTR() macro here as we want the same filename for a | 131 | * We can't use the DEVICE_ATTR() macro here, as we used the same name for |
132 | * different type of a device. So beware if the DEVICE_ATTR() macro ever | 132 | * an i2c adapter attribute (above). |
133 | * changes, this definition will also have to change. | ||
134 | */ | 133 | */ |
135 | static struct device_attribute dev_attr_client_name = { | 134 | static struct device_attribute dev_attr_client_name = |
136 | .attr = {.name = "name", .mode = S_IRUGO, .owner = THIS_MODULE }, | 135 | __ATTR(name, S_IRUGO, &show_client_name, NULL); |
137 | .show = &show_client_name, | ||
138 | }; | ||
139 | 136 | ||
140 | 137 | ||
141 | /* --------------------------------------------------- | 138 | /* --------------------------------------------------- |
142 | * registering functions | 139 | * registering functions |
143 | * --------------------------------------------------- | 140 | * --------------------------------------------------- |
144 | */ | 141 | */ |
145 | 142 | ||
146 | /* ----- | 143 | /* ----- |
@@ -314,7 +311,7 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver) | |||
314 | res = driver_register(&driver->driver); | 311 | res = driver_register(&driver->driver); |
315 | if (res) | 312 | if (res) |
316 | return res; | 313 | return res; |
317 | 314 | ||
318 | mutex_lock(&core_lists); | 315 | mutex_lock(&core_lists); |
319 | 316 | ||
320 | list_add_tail(&driver->list,&drivers); | 317 | list_add_tail(&driver->list,&drivers); |
@@ -338,13 +335,13 @@ int i2c_del_driver(struct i2c_driver *driver) | |||
338 | struct list_head *item1, *item2, *_n; | 335 | struct list_head *item1, *item2, *_n; |
339 | struct i2c_client *client; | 336 | struct i2c_client *client; |
340 | struct i2c_adapter *adap; | 337 | struct i2c_adapter *adap; |
341 | 338 | ||
342 | int res = 0; | 339 | int res = 0; |
343 | 340 | ||
344 | mutex_lock(&core_lists); | 341 | mutex_lock(&core_lists); |
345 | 342 | ||
346 | /* Have a look at each adapter, if clients of this driver are still | 343 | /* Have a look at each adapter, if clients of this driver are still |
347 | * attached. If so, detach them to be able to kill the driver | 344 | * attached. If so, detach them to be able to kill the driver |
348 | * afterwards. | 345 | * afterwards. |
349 | */ | 346 | */ |
350 | list_for_each(item1,&adapters) { | 347 | list_for_each(item1,&adapters) { |
@@ -419,14 +416,14 @@ int i2c_attach_client(struct i2c_client *client) | |||
419 | goto out_unlock; | 416 | goto out_unlock; |
420 | } | 417 | } |
421 | list_add_tail(&client->list,&adapter->clients); | 418 | list_add_tail(&client->list,&adapter->clients); |
422 | 419 | ||
423 | client->usage_count = 0; | 420 | client->usage_count = 0; |
424 | 421 | ||
425 | client->dev.parent = &client->adapter->dev; | 422 | client->dev.parent = &client->adapter->dev; |
426 | client->dev.driver = &client->driver->driver; | 423 | client->dev.driver = &client->driver->driver; |
427 | client->dev.bus = &i2c_bus_type; | 424 | client->dev.bus = &i2c_bus_type; |
428 | client->dev.release = &i2c_client_release; | 425 | client->dev.release = &i2c_client_release; |
429 | 426 | ||
430 | snprintf(&client->dev.bus_id[0], sizeof(client->dev.bus_id), | 427 | snprintf(&client->dev.bus_id[0], sizeof(client->dev.bus_id), |
431 | "%d-%04x", i2c_adapter_id(adapter), client->addr); | 428 | "%d-%04x", i2c_adapter_id(adapter), client->addr); |
432 | dev_dbg(&adapter->dev, "client [%s] registered with bus id %s\n", | 429 | dev_dbg(&adapter->dev, "client [%s] registered with bus id %s\n", |
@@ -467,7 +464,7 @@ int i2c_detach_client(struct i2c_client *client) | |||
467 | { | 464 | { |
468 | struct i2c_adapter *adapter = client->adapter; | 465 | struct i2c_adapter *adapter = client->adapter; |
469 | int res = 0; | 466 | int res = 0; |
470 | 467 | ||
471 | if (client->usage_count > 0) { | 468 | if (client->usage_count > 0) { |
472 | dev_warn(&client->dev, "Client [%s] still busy, " | 469 | dev_warn(&client->dev, "Client [%s] still busy, " |
473 | "can't detach\n", client->name); | 470 | "can't detach\n", client->name); |
@@ -535,10 +532,10 @@ int i2c_release_client(struct i2c_client *client) | |||
535 | __FUNCTION__); | 532 | __FUNCTION__); |
536 | return -EPERM; | 533 | return -EPERM; |
537 | } | 534 | } |
538 | 535 | ||
539 | client->usage_count--; | 536 | client->usage_count--; |
540 | i2c_dec_use_client(client); | 537 | i2c_dec_use_client(client); |
541 | 538 | ||
542 | return 0; | 539 | return 0; |
543 | } | 540 | } |
544 | 541 | ||
@@ -603,7 +600,7 @@ int i2c_transfer(struct i2c_adapter * adap, struct i2c_msg *msgs, int num) | |||
603 | } | 600 | } |
604 | #endif | 601 | #endif |
605 | 602 | ||
606 | mutex_lock(&adap->bus_lock); | 603 | mutex_lock_nested(&adap->bus_lock, adap->level); |
607 | ret = adap->algo->master_xfer(adap,msgs,num); | 604 | ret = adap->algo->master_xfer(adap,msgs,num); |
608 | mutex_unlock(&adap->bus_lock); | 605 | mutex_unlock(&adap->bus_lock); |
609 | 606 | ||
@@ -624,7 +621,7 @@ int i2c_master_send(struct i2c_client *client,const char *buf ,int count) | |||
624 | msg.flags = client->flags & I2C_M_TEN; | 621 | msg.flags = client->flags & I2C_M_TEN; |
625 | msg.len = count; | 622 | msg.len = count; |
626 | msg.buf = (char *)buf; | 623 | msg.buf = (char *)buf; |
627 | 624 | ||
628 | ret = i2c_transfer(adap, &msg, 1); | 625 | ret = i2c_transfer(adap, &msg, 1); |
629 | 626 | ||
630 | /* If everything went ok (i.e. 1 msg transmitted), return #bytes | 627 | /* If everything went ok (i.e. 1 msg transmitted), return #bytes |
@@ -757,7 +754,7 @@ int i2c_probe(struct i2c_adapter *adapter, | |||
757 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_QUICK)) { | 754 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_QUICK)) { |
758 | if (address_data->probe[0] == I2C_CLIENT_END | 755 | if (address_data->probe[0] == I2C_CLIENT_END |
759 | && address_data->normal_i2c[0] == I2C_CLIENT_END) | 756 | && address_data->normal_i2c[0] == I2C_CLIENT_END) |
760 | return 0; | 757 | return 0; |
761 | 758 | ||
762 | dev_warn(&adapter->dev, "SMBus Quick command not supported, " | 759 | dev_warn(&adapter->dev, "SMBus Quick command not supported, " |
763 | "can't probe for chips\n"); | 760 | "can't probe for chips\n"); |
@@ -817,7 +814,7 @@ int i2c_probe(struct i2c_adapter *adapter, | |||
817 | struct i2c_adapter* i2c_get_adapter(int id) | 814 | struct i2c_adapter* i2c_get_adapter(int id) |
818 | { | 815 | { |
819 | struct i2c_adapter *adapter; | 816 | struct i2c_adapter *adapter; |
820 | 817 | ||
821 | mutex_lock(&core_lists); | 818 | mutex_lock(&core_lists); |
822 | adapter = (struct i2c_adapter *)idr_find(&i2c_adapter_idr, id); | 819 | adapter = (struct i2c_adapter *)idr_find(&i2c_adapter_idr, id); |
823 | if (adapter && !try_module_get(adapter->owner)) | 820 | if (adapter && !try_module_get(adapter->owner)) |
@@ -834,14 +831,14 @@ void i2c_put_adapter(struct i2c_adapter *adap) | |||
834 | 831 | ||
835 | /* The SMBus parts */ | 832 | /* The SMBus parts */ |
836 | 833 | ||
837 | #define POLY (0x1070U << 3) | 834 | #define POLY (0x1070U << 3) |
838 | static u8 | 835 | static u8 |
839 | crc8(u16 data) | 836 | crc8(u16 data) |
840 | { | 837 | { |
841 | int i; | 838 | int i; |
842 | 839 | ||
843 | for(i = 0; i < 8; i++) { | 840 | for(i = 0; i < 8; i++) { |
844 | if (data & 0x8000) | 841 | if (data & 0x8000) |
845 | data = data ^ POLY; | 842 | data = data ^ POLY; |
846 | data = data << 1; | 843 | data = data << 1; |
847 | } | 844 | } |
@@ -891,13 +888,13 @@ static int i2c_smbus_check_pec(u8 cpec, struct i2c_msg *msg) | |||
891 | rpec, cpec); | 888 | rpec, cpec); |
892 | return -1; | 889 | return -1; |
893 | } | 890 | } |
894 | return 0; | 891 | return 0; |
895 | } | 892 | } |
896 | 893 | ||
897 | s32 i2c_smbus_write_quick(struct i2c_client *client, u8 value) | 894 | s32 i2c_smbus_write_quick(struct i2c_client *client, u8 value) |
898 | { | 895 | { |
899 | return i2c_smbus_xfer(client->adapter,client->addr,client->flags, | 896 | return i2c_smbus_xfer(client->adapter,client->addr,client->flags, |
900 | value,0,I2C_SMBUS_QUICK,NULL); | 897 | value,0,I2C_SMBUS_QUICK,NULL); |
901 | } | 898 | } |
902 | 899 | ||
903 | s32 i2c_smbus_read_byte(struct i2c_client *client) | 900 | s32 i2c_smbus_read_byte(struct i2c_client *client) |
@@ -996,11 +993,11 @@ s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, u8 command, | |||
996 | I2C_SMBUS_I2C_BLOCK_DATA, &data); | 993 | I2C_SMBUS_I2C_BLOCK_DATA, &data); |
997 | } | 994 | } |
998 | 995 | ||
999 | /* Simulate a SMBus command using the i2c protocol | 996 | /* Simulate a SMBus command using the i2c protocol |
1000 | No checking of parameters is done! */ | 997 | No checking of parameters is done! */ |
1001 | static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, | 998 | static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, |
1002 | unsigned short flags, | 999 | unsigned short flags, |
1003 | char read_write, u8 command, int size, | 1000 | char read_write, u8 command, int size, |
1004 | union i2c_smbus_data * data) | 1001 | union i2c_smbus_data * data) |
1005 | { | 1002 | { |
1006 | /* So we need to generate a series of msgs. In the case of writing, we | 1003 | /* So we need to generate a series of msgs. In the case of writing, we |
@@ -1010,7 +1007,7 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, | |||
1010 | unsigned char msgbuf0[I2C_SMBUS_BLOCK_MAX+3]; | 1007 | unsigned char msgbuf0[I2C_SMBUS_BLOCK_MAX+3]; |
1011 | unsigned char msgbuf1[I2C_SMBUS_BLOCK_MAX+2]; | 1008 | unsigned char msgbuf1[I2C_SMBUS_BLOCK_MAX+2]; |
1012 | int num = read_write == I2C_SMBUS_READ?2:1; | 1009 | int num = read_write == I2C_SMBUS_READ?2:1; |
1013 | struct i2c_msg msg[2] = { { addr, flags, 1, msgbuf0 }, | 1010 | struct i2c_msg msg[2] = { { addr, flags, 1, msgbuf0 }, |
1014 | { addr, flags | I2C_M_RD, 0, msgbuf1 } | 1011 | { addr, flags | I2C_M_RD, 0, msgbuf1 } |
1015 | }; | 1012 | }; |
1016 | int i; | 1013 | int i; |
@@ -1103,14 +1100,14 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, | |||
1103 | if (i) { | 1100 | if (i) { |
1104 | /* Compute PEC if first message is a write */ | 1101 | /* Compute PEC if first message is a write */ |
1105 | if (!(msg[0].flags & I2C_M_RD)) { | 1102 | if (!(msg[0].flags & I2C_M_RD)) { |
1106 | if (num == 1) /* Write only */ | 1103 | if (num == 1) /* Write only */ |
1107 | i2c_smbus_add_pec(&msg[0]); | 1104 | i2c_smbus_add_pec(&msg[0]); |
1108 | else /* Write followed by read */ | 1105 | else /* Write followed by read */ |
1109 | partial_pec = i2c_smbus_msg_pec(0, &msg[0]); | 1106 | partial_pec = i2c_smbus_msg_pec(0, &msg[0]); |
1110 | } | 1107 | } |
1111 | /* Ask for PEC if last message is a read */ | 1108 | /* Ask for PEC if last message is a read */ |
1112 | if (msg[num-1].flags & I2C_M_RD) | 1109 | if (msg[num-1].flags & I2C_M_RD) |
1113 | msg[num-1].len++; | 1110 | msg[num-1].len++; |
1114 | } | 1111 | } |
1115 | 1112 | ||
1116 | if (i2c_transfer(adapter, msg, num) < 0) | 1113 | if (i2c_transfer(adapter, msg, num) < 0) |
@@ -1130,7 +1127,7 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, | |||
1130 | case I2C_SMBUS_BYTE_DATA: | 1127 | case I2C_SMBUS_BYTE_DATA: |
1131 | data->byte = msgbuf1[0]; | 1128 | data->byte = msgbuf1[0]; |
1132 | break; | 1129 | break; |
1133 | case I2C_SMBUS_WORD_DATA: | 1130 | case I2C_SMBUS_WORD_DATA: |
1134 | case I2C_SMBUS_PROC_CALL: | 1131 | case I2C_SMBUS_PROC_CALL: |
1135 | data->word = msgbuf1[0] | (msgbuf1[1] << 8); | 1132 | data->word = msgbuf1[0] | (msgbuf1[1] << 8); |
1136 | break; | 1133 | break; |
@@ -1146,7 +1143,7 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, | |||
1146 | 1143 | ||
1147 | 1144 | ||
1148 | s32 i2c_smbus_xfer(struct i2c_adapter * adapter, u16 addr, unsigned short flags, | 1145 | s32 i2c_smbus_xfer(struct i2c_adapter * adapter, u16 addr, unsigned short flags, |
1149 | char read_write, u8 command, int size, | 1146 | char read_write, u8 command, int size, |
1150 | union i2c_smbus_data * data) | 1147 | union i2c_smbus_data * data) |
1151 | { | 1148 | { |
1152 | s32 res; | 1149 | s32 res; |
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c index 2e22a2ffa606..ac5bd2a7ca99 100644 --- a/drivers/i2c/i2c-dev.c +++ b/drivers/i2c/i2c-dev.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | i2c-dev.c - i2c-bus driver, char device interface | 2 | i2c-dev.c - i2c-bus driver, char device interface |
3 | 3 | ||
4 | Copyright (C) 1995-97 Simon G. Vogl | 4 | Copyright (C) 1995-97 Simon G. Vogl |
5 | Copyright (C) 1998-99 Frodo Looijaard <frodol@dds.nl> | 5 | Copyright (C) 1998-99 Frodo Looijaard <frodol@dds.nl> |
@@ -90,6 +90,7 @@ static void return_i2c_dev(struct i2c_dev *i2c_dev) | |||
90 | spin_lock(&i2c_dev_list_lock); | 90 | spin_lock(&i2c_dev_list_lock); |
91 | list_del(&i2c_dev->list); | 91 | list_del(&i2c_dev->list); |
92 | spin_unlock(&i2c_dev_list_lock); | 92 | spin_unlock(&i2c_dev_list_lock); |
93 | kfree(i2c_dev); | ||
93 | } | 94 | } |
94 | 95 | ||
95 | static ssize_t show_adapter_name(struct device *dev, | 96 | static ssize_t show_adapter_name(struct device *dev, |
@@ -172,7 +173,7 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file, | |||
172 | switch ( cmd ) { | 173 | switch ( cmd ) { |
173 | case I2C_SLAVE: | 174 | case I2C_SLAVE: |
174 | case I2C_SLAVE_FORCE: | 175 | case I2C_SLAVE_FORCE: |
175 | if ((arg > 0x3ff) || | 176 | if ((arg > 0x3ff) || |
176 | (((client->flags & I2C_M_TEN) == 0) && arg > 0x7f)) | 177 | (((client->flags & I2C_M_TEN) == 0) && arg > 0x7f)) |
177 | return -EINVAL; | 178 | return -EINVAL; |
178 | if ((cmd == I2C_SLAVE) && i2c_check_addr(client->adapter,arg)) | 179 | if ((cmd == I2C_SLAVE) && i2c_check_addr(client->adapter,arg)) |
@@ -193,12 +194,11 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file, | |||
193 | return 0; | 194 | return 0; |
194 | case I2C_FUNCS: | 195 | case I2C_FUNCS: |
195 | funcs = i2c_get_functionality(client->adapter); | 196 | funcs = i2c_get_functionality(client->adapter); |
196 | return (copy_to_user((unsigned long __user *)arg, &funcs, | 197 | return put_user(funcs, (unsigned long __user *)arg); |
197 | sizeof(unsigned long)))?-EFAULT:0; | ||
198 | 198 | ||
199 | case I2C_RDWR: | 199 | case I2C_RDWR: |
200 | if (copy_from_user(&rdwr_arg, | 200 | if (copy_from_user(&rdwr_arg, |
201 | (struct i2c_rdwr_ioctl_data __user *)arg, | 201 | (struct i2c_rdwr_ioctl_data __user *)arg, |
202 | sizeof(rdwr_arg))) | 202 | sizeof(rdwr_arg))) |
203 | return -EFAULT; | 203 | return -EFAULT; |
204 | 204 | ||
@@ -206,9 +206,9 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file, | |||
206 | * be sent at once */ | 206 | * be sent at once */ |
207 | if (rdwr_arg.nmsgs > I2C_RDRW_IOCTL_MAX_MSGS) | 207 | if (rdwr_arg.nmsgs > I2C_RDRW_IOCTL_MAX_MSGS) |
208 | return -EINVAL; | 208 | return -EINVAL; |
209 | 209 | ||
210 | rdwr_pa = (struct i2c_msg *) | 210 | rdwr_pa = (struct i2c_msg *) |
211 | kmalloc(rdwr_arg.nmsgs * sizeof(struct i2c_msg), | 211 | kmalloc(rdwr_arg.nmsgs * sizeof(struct i2c_msg), |
212 | GFP_KERNEL); | 212 | GFP_KERNEL); |
213 | 213 | ||
214 | if (rdwr_pa == NULL) return -ENOMEM; | 214 | if (rdwr_pa == NULL) return -ENOMEM; |
@@ -278,9 +278,9 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file, | |||
278 | (struct i2c_smbus_ioctl_data __user *) arg, | 278 | (struct i2c_smbus_ioctl_data __user *) arg, |
279 | sizeof(struct i2c_smbus_ioctl_data))) | 279 | sizeof(struct i2c_smbus_ioctl_data))) |
280 | return -EFAULT; | 280 | return -EFAULT; |
281 | if ((data_arg.size != I2C_SMBUS_BYTE) && | 281 | if ((data_arg.size != I2C_SMBUS_BYTE) && |
282 | (data_arg.size != I2C_SMBUS_QUICK) && | 282 | (data_arg.size != I2C_SMBUS_QUICK) && |
283 | (data_arg.size != I2C_SMBUS_BYTE_DATA) && | 283 | (data_arg.size != I2C_SMBUS_BYTE_DATA) && |
284 | (data_arg.size != I2C_SMBUS_WORD_DATA) && | 284 | (data_arg.size != I2C_SMBUS_WORD_DATA) && |
285 | (data_arg.size != I2C_SMBUS_PROC_CALL) && | 285 | (data_arg.size != I2C_SMBUS_PROC_CALL) && |
286 | (data_arg.size != I2C_SMBUS_BLOCK_DATA) && | 286 | (data_arg.size != I2C_SMBUS_BLOCK_DATA) && |
@@ -291,11 +291,11 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file, | |||
291 | data_arg.size); | 291 | data_arg.size); |
292 | return -EINVAL; | 292 | return -EINVAL; |
293 | } | 293 | } |
294 | /* Note that I2C_SMBUS_READ and I2C_SMBUS_WRITE are 0 and 1, | 294 | /* Note that I2C_SMBUS_READ and I2C_SMBUS_WRITE are 0 and 1, |
295 | so the check is valid if size==I2C_SMBUS_QUICK too. */ | 295 | so the check is valid if size==I2C_SMBUS_QUICK too. */ |
296 | if ((data_arg.read_write != I2C_SMBUS_READ) && | 296 | if ((data_arg.read_write != I2C_SMBUS_READ) && |
297 | (data_arg.read_write != I2C_SMBUS_WRITE)) { | 297 | (data_arg.read_write != I2C_SMBUS_WRITE)) { |
298 | dev_dbg(&client->adapter->dev, | 298 | dev_dbg(&client->adapter->dev, |
299 | "read_write out of range (%x) in ioctl I2C_SMBUS.\n", | 299 | "read_write out of range (%x) in ioctl I2C_SMBUS.\n", |
300 | data_arg.read_write); | 300 | data_arg.read_write); |
301 | return -EINVAL; | 301 | return -EINVAL; |
@@ -304,7 +304,7 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file, | |||
304 | /* Note that command values are always valid! */ | 304 | /* Note that command values are always valid! */ |
305 | 305 | ||
306 | if ((data_arg.size == I2C_SMBUS_QUICK) || | 306 | if ((data_arg.size == I2C_SMBUS_QUICK) || |
307 | ((data_arg.size == I2C_SMBUS_BYTE) && | 307 | ((data_arg.size == I2C_SMBUS_BYTE) && |
308 | (data_arg.read_write == I2C_SMBUS_WRITE))) | 308 | (data_arg.read_write == I2C_SMBUS_WRITE))) |
309 | /* These are special: we do not use data */ | 309 | /* These are special: we do not use data */ |
310 | return i2c_smbus_xfer(client->adapter, client->addr, | 310 | return i2c_smbus_xfer(client->adapter, client->addr, |
@@ -322,14 +322,14 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file, | |||
322 | if ((data_arg.size == I2C_SMBUS_BYTE_DATA) || | 322 | if ((data_arg.size == I2C_SMBUS_BYTE_DATA) || |
323 | (data_arg.size == I2C_SMBUS_BYTE)) | 323 | (data_arg.size == I2C_SMBUS_BYTE)) |
324 | datasize = sizeof(data_arg.data->byte); | 324 | datasize = sizeof(data_arg.data->byte); |
325 | else if ((data_arg.size == I2C_SMBUS_WORD_DATA) || | 325 | else if ((data_arg.size == I2C_SMBUS_WORD_DATA) || |
326 | (data_arg.size == I2C_SMBUS_PROC_CALL)) | 326 | (data_arg.size == I2C_SMBUS_PROC_CALL)) |
327 | datasize = sizeof(data_arg.data->word); | 327 | datasize = sizeof(data_arg.data->word); |
328 | else /* size == smbus block, i2c block, or block proc. call */ | 328 | else /* size == smbus block, i2c block, or block proc. call */ |
329 | datasize = sizeof(data_arg.data->block); | 329 | datasize = sizeof(data_arg.data->block); |
330 | 330 | ||
331 | if ((data_arg.size == I2C_SMBUS_PROC_CALL) || | 331 | if ((data_arg.size == I2C_SMBUS_PROC_CALL) || |
332 | (data_arg.size == I2C_SMBUS_BLOCK_PROC_CALL) || | 332 | (data_arg.size == I2C_SMBUS_BLOCK_PROC_CALL) || |
333 | (data_arg.read_write == I2C_SMBUS_WRITE)) { | 333 | (data_arg.read_write == I2C_SMBUS_WRITE)) { |
334 | if (copy_from_user(&temp, data_arg.data, datasize)) | 334 | if (copy_from_user(&temp, data_arg.data, datasize)) |
335 | return -EFAULT; | 335 | return -EFAULT; |
@@ -337,8 +337,8 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file, | |||
337 | res = i2c_smbus_xfer(client->adapter,client->addr,client->flags, | 337 | res = i2c_smbus_xfer(client->adapter,client->addr,client->flags, |
338 | data_arg.read_write, | 338 | data_arg.read_write, |
339 | data_arg.command,data_arg.size,&temp); | 339 | data_arg.command,data_arg.size,&temp); |
340 | if (! res && ((data_arg.size == I2C_SMBUS_PROC_CALL) || | 340 | if (! res && ((data_arg.size == I2C_SMBUS_PROC_CALL) || |
341 | (data_arg.size == I2C_SMBUS_BLOCK_PROC_CALL) || | 341 | (data_arg.size == I2C_SMBUS_BLOCK_PROC_CALL) || |
342 | (data_arg.read_write == I2C_SMBUS_READ))) { | 342 | (data_arg.read_write == I2C_SMBUS_READ))) { |
343 | if (copy_to_user(data_arg.data, &temp, datasize)) | 343 | if (copy_to_user(data_arg.data, &temp, datasize)) |
344 | return -EFAULT; | 344 | return -EFAULT; |
@@ -417,8 +417,8 @@ static int i2cdev_attach_adapter(struct i2c_adapter *adap) | |||
417 | i2c_dev->dev = device_create(i2c_dev_class, &adap->dev, | 417 | i2c_dev->dev = device_create(i2c_dev_class, &adap->dev, |
418 | MKDEV(I2C_MAJOR, adap->nr), | 418 | MKDEV(I2C_MAJOR, adap->nr), |
419 | "i2c-%d", adap->nr); | 419 | "i2c-%d", adap->nr); |
420 | if (!i2c_dev->dev) { | 420 | if (IS_ERR(i2c_dev->dev)) { |
421 | res = -ENODEV; | 421 | res = PTR_ERR(i2c_dev->dev); |
422 | goto error; | 422 | goto error; |
423 | } | 423 | } |
424 | res = device_create_file(i2c_dev->dev, &dev_attr_name); | 424 | res = device_create_file(i2c_dev->dev, &dev_attr_name); |
@@ -432,7 +432,6 @@ error_destroy: | |||
432 | device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr)); | 432 | device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr)); |
433 | error: | 433 | error: |
434 | return_i2c_dev(i2c_dev); | 434 | return_i2c_dev(i2c_dev); |
435 | kfree(i2c_dev); | ||
436 | return res; | 435 | return res; |
437 | } | 436 | } |
438 | 437 | ||
@@ -447,7 +446,6 @@ static int i2cdev_detach_adapter(struct i2c_adapter *adap) | |||
447 | device_remove_file(i2c_dev->dev, &dev_attr_name); | 446 | device_remove_file(i2c_dev->dev, &dev_attr_name); |
448 | return_i2c_dev(i2c_dev); | 447 | return_i2c_dev(i2c_dev); |
449 | device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr)); | 448 | device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr)); |
450 | kfree(i2c_dev); | ||
451 | 449 | ||
452 | pr_debug("i2c-dev: adapter [%s] unregistered\n", adap->name); | 450 | pr_debug("i2c-dev: adapter [%s] unregistered\n", adap->name); |
453 | return 0; | 451 | return 0; |
diff --git a/drivers/ieee1394/pcilynx.c b/drivers/ieee1394/pcilynx.c index 13a617917bf2..fbb7f14ec509 100644 --- a/drivers/ieee1394/pcilynx.c +++ b/drivers/ieee1394/pcilynx.c | |||
@@ -1485,7 +1485,7 @@ static int __devinit add_card(struct pci_dev *dev, | |||
1485 | 1485 | ||
1486 | } | 1486 | } |
1487 | 1487 | ||
1488 | i2c_bit_del_bus(i2c_ad); | 1488 | i2c_del_adapter(i2c_ad); |
1489 | kfree(i2c_ad); | 1489 | kfree(i2c_ad); |
1490 | } | 1490 | } |
1491 | } | 1491 | } |
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 3d5f19658032..6b46c9bf1d20 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig | |||
@@ -146,7 +146,7 @@ config TOUCHSCREEN_TOUCHWIN | |||
146 | 146 | ||
147 | config TOUCHSCREEN_UCB1400 | 147 | config TOUCHSCREEN_UCB1400 |
148 | tristate "Philips UCB1400 touchscreen" | 148 | tristate "Philips UCB1400 touchscreen" |
149 | depends on SND_AC97_BUS | 149 | select AC97_BUS |
150 | help | 150 | help |
151 | This enables support for the Philips UCB1400 touchscreen interface. | 151 | This enables support for the Philips UCB1400 touchscreen interface. |
152 | The UCB1400 is an AC97 audio codec. The touchscreen interface | 152 | The UCB1400 is an AC97 audio codec. The touchscreen interface |
diff --git a/drivers/media/dvb/pluto2/pluto2.c b/drivers/media/dvb/pluto2/pluto2.c index 8e4ce101eb22..ffda71dfdd65 100644 --- a/drivers/media/dvb/pluto2/pluto2.c +++ b/drivers/media/dvb/pluto2/pluto2.c | |||
@@ -650,7 +650,7 @@ static int __devinit pluto2_probe(struct pci_dev *pdev, | |||
650 | /* dvb */ | 650 | /* dvb */ |
651 | ret = dvb_register_adapter(&pluto->dvb_adapter, DRIVER_NAME, THIS_MODULE, &pdev->dev); | 651 | ret = dvb_register_adapter(&pluto->dvb_adapter, DRIVER_NAME, THIS_MODULE, &pdev->dev); |
652 | if (ret < 0) | 652 | if (ret < 0) |
653 | goto err_i2c_bit_del_bus; | 653 | goto err_i2c_del_adapter; |
654 | 654 | ||
655 | dvb_adapter = &pluto->dvb_adapter; | 655 | dvb_adapter = &pluto->dvb_adapter; |
656 | 656 | ||
@@ -712,8 +712,8 @@ err_dvb_dmx_release: | |||
712 | dvb_dmx_release(dvbdemux); | 712 | dvb_dmx_release(dvbdemux); |
713 | err_dvb_unregister_adapter: | 713 | err_dvb_unregister_adapter: |
714 | dvb_unregister_adapter(dvb_adapter); | 714 | dvb_unregister_adapter(dvb_adapter); |
715 | err_i2c_bit_del_bus: | 715 | err_i2c_del_adapter: |
716 | i2c_bit_del_bus(&pluto->i2c_adap); | 716 | i2c_del_adapter(&pluto->i2c_adap); |
717 | err_pluto_hw_exit: | 717 | err_pluto_hw_exit: |
718 | pluto_hw_exit(pluto); | 718 | pluto_hw_exit(pluto); |
719 | err_free_irq: | 719 | err_free_irq: |
@@ -748,7 +748,7 @@ static void __devexit pluto2_remove(struct pci_dev *pdev) | |||
748 | dvb_dmxdev_release(&pluto->dmxdev); | 748 | dvb_dmxdev_release(&pluto->dmxdev); |
749 | dvb_dmx_release(dvbdemux); | 749 | dvb_dmx_release(dvbdemux); |
750 | dvb_unregister_adapter(dvb_adapter); | 750 | dvb_unregister_adapter(dvb_adapter); |
751 | i2c_bit_del_bus(&pluto->i2c_adap); | 751 | i2c_del_adapter(&pluto->i2c_adap); |
752 | pluto_hw_exit(pluto); | 752 | pluto_hw_exit(pluto); |
753 | free_irq(pdev->irq, pluto); | 753 | free_irq(pdev->irq, pluto); |
754 | pci_iounmap(pdev, pluto->io_mem); | 754 | pci_iounmap(pdev, pluto->io_mem); |
diff --git a/drivers/media/video/bt8xx/bttv-i2c.c b/drivers/media/video/bt8xx/bttv-i2c.c index 70de6c96e201..62b873076e09 100644 --- a/drivers/media/video/bt8xx/bttv-i2c.c +++ b/drivers/media/video/bt8xx/bttv-i2c.c | |||
@@ -479,11 +479,7 @@ int __devexit fini_bttv_i2c(struct bttv *btv) | |||
479 | if (0 != btv->i2c_rc) | 479 | if (0 != btv->i2c_rc) |
480 | return 0; | 480 | return 0; |
481 | 481 | ||
482 | if (btv->use_i2c_hw) { | 482 | return i2c_del_adapter(&btv->c.i2c_adap); |
483 | return i2c_del_adapter(&btv->c.i2c_adap); | ||
484 | } else { | ||
485 | return i2c_bit_del_bus(&btv->c.i2c_adap); | ||
486 | } | ||
487 | } | 483 | } |
488 | 484 | ||
489 | /* | 485 | /* |
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c index 4b655f2ef278..453af5e943ff 100644 --- a/drivers/media/video/cx88/cx88-core.c +++ b/drivers/media/video/cx88/cx88-core.c | |||
@@ -1153,7 +1153,7 @@ void cx88_core_put(struct cx88_core *core, struct pci_dev *pci) | |||
1153 | mutex_lock(&devlist); | 1153 | mutex_lock(&devlist); |
1154 | cx88_ir_fini(core); | 1154 | cx88_ir_fini(core); |
1155 | if (0 == core->i2c_rc) | 1155 | if (0 == core->i2c_rc) |
1156 | i2c_bit_del_bus(&core->i2c_adap); | 1156 | i2c_del_adapter(&core->i2c_adap); |
1157 | list_del(&core->devlist); | 1157 | list_del(&core->devlist); |
1158 | iounmap(core->lmmio); | 1158 | iounmap(core->lmmio); |
1159 | cx88_devcount--; | 1159 | cx88_devcount--; |
diff --git a/drivers/media/video/cx88/cx88-vp3054-i2c.c b/drivers/media/video/cx88/cx88-vp3054-i2c.c index 2b4f1970c7df..6068c9bf82cd 100644 --- a/drivers/media/video/cx88/cx88-vp3054-i2c.c +++ b/drivers/media/video/cx88/cx88-vp3054-i2c.c | |||
@@ -168,7 +168,7 @@ void vp3054_i2c_remove(struct cx8802_dev *dev) | |||
168 | dev->core->board != CX88_BOARD_DNTV_LIVE_DVB_T_PRO) | 168 | dev->core->board != CX88_BOARD_DNTV_LIVE_DVB_T_PRO) |
169 | return; | 169 | return; |
170 | 170 | ||
171 | i2c_bit_del_bus(&vp3054_i2c->adap); | 171 | i2c_del_adapter(&vp3054_i2c->adap); |
172 | kfree(vp3054_i2c); | 172 | kfree(vp3054_i2c); |
173 | } | 173 | } |
174 | 174 | ||
diff --git a/drivers/media/video/usbvision/usbvision-i2c.c b/drivers/media/video/usbvision/usbvision-i2c.c index 92bf9a1f1e2c..0f3fba7ea6fe 100644 --- a/drivers/media/video/usbvision/usbvision-i2c.c +++ b/drivers/media/video/usbvision/usbvision-i2c.c | |||
@@ -50,6 +50,11 @@ MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); | |||
50 | #define PDEBUG(level, fmt, args...) \ | 50 | #define PDEBUG(level, fmt, args...) \ |
51 | if (i2c_debug & (level)) info("[%s:%d] " fmt, __PRETTY_FUNCTION__, __LINE__ , ## args) | 51 | if (i2c_debug & (level)) info("[%s:%d] " fmt, __PRETTY_FUNCTION__, __LINE__ , ## args) |
52 | 52 | ||
53 | static int usbvision_i2c_write(void *data, unsigned char addr, char *buf, | ||
54 | short len); | ||
55 | static int usbvision_i2c_read(void *data, unsigned char addr, char *buf, | ||
56 | short len); | ||
57 | |||
53 | static inline int try_write_address(struct i2c_adapter *i2c_adap, | 58 | static inline int try_write_address(struct i2c_adapter *i2c_adap, |
54 | unsigned char addr, int retries) | 59 | unsigned char addr, int retries) |
55 | { | 60 | { |
@@ -61,7 +66,7 @@ static inline int try_write_address(struct i2c_adapter *i2c_adap, | |||
61 | data = i2c_get_adapdata(i2c_adap); | 66 | data = i2c_get_adapdata(i2c_adap); |
62 | buf[0] = 0x00; | 67 | buf[0] = 0x00; |
63 | for (i = 0; i <= retries; i++) { | 68 | for (i = 0; i <= retries; i++) { |
64 | ret = (adap->outb(data, addr, buf, 1)); | 69 | ret = (usbvision_i2c_write(data, addr, buf, 1)); |
65 | if (ret == 1) | 70 | if (ret == 1) |
66 | break; /* success! */ | 71 | break; /* success! */ |
67 | udelay(5 /*adap->udelay */ ); | 72 | udelay(5 /*adap->udelay */ ); |
@@ -86,7 +91,7 @@ static inline int try_read_address(struct i2c_adapter *i2c_adap, | |||
86 | 91 | ||
87 | data = i2c_get_adapdata(i2c_adap); | 92 | data = i2c_get_adapdata(i2c_adap); |
88 | for (i = 0; i <= retries; i++) { | 93 | for (i = 0; i <= retries; i++) { |
89 | ret = (adap->inb(data, addr, buf, 1)); | 94 | ret = (usbvision_i2c_read(data, addr, buf, 1)); |
90 | if (ret == 1) | 95 | if (ret == 1) |
91 | break; /* success! */ | 96 | break; /* success! */ |
92 | udelay(5 /*adap->udelay */ ); | 97 | udelay(5 /*adap->udelay */ ); |
@@ -153,7 +158,6 @@ static int | |||
153 | usb_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], int num) | 158 | usb_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], int num) |
154 | { | 159 | { |
155 | struct i2c_msg *pmsg; | 160 | struct i2c_msg *pmsg; |
156 | struct i2c_algo_usb_data *adap = i2c_adap->algo_data; | ||
157 | void *data; | 161 | void *data; |
158 | int i, ret; | 162 | int i, ret; |
159 | unsigned char addr; | 163 | unsigned char addr; |
@@ -170,13 +174,13 @@ usb_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], int num) | |||
170 | 174 | ||
171 | if (pmsg->flags & I2C_M_RD) { | 175 | if (pmsg->flags & I2C_M_RD) { |
172 | /* read bytes into buffer */ | 176 | /* read bytes into buffer */ |
173 | ret = (adap->inb(data, addr, pmsg->buf, pmsg->len)); | 177 | ret = (usbvision_i2c_read(data, addr, pmsg->buf, pmsg->len)); |
174 | if (ret < pmsg->len) { | 178 | if (ret < pmsg->len) { |
175 | return (ret < 0) ? ret : -EREMOTEIO; | 179 | return (ret < 0) ? ret : -EREMOTEIO; |
176 | } | 180 | } |
177 | } else { | 181 | } else { |
178 | /* write bytes from buffer */ | 182 | /* write bytes from buffer */ |
179 | ret = (adap->outb(data, addr, pmsg->buf, pmsg->len)); | 183 | ret = (usbvision_i2c_write(data, addr, pmsg->buf, pmsg->len)); |
180 | if (ret < pmsg->len) { | 184 | if (ret < pmsg->len) { |
181 | return (ret < 0) ? ret : -EREMOTEIO; | 185 | return (ret < 0) ? ret : -EREMOTEIO; |
182 | } | 186 | } |
diff --git a/drivers/media/video/vino.c b/drivers/media/video/vino.c index 6b6dff4d236a..a373c142e742 100644 --- a/drivers/media/video/vino.c +++ b/drivers/media/video/vino.c | |||
@@ -782,7 +782,7 @@ static int vino_i2c_add_bus(void) | |||
782 | 782 | ||
783 | static int vino_i2c_del_bus(void) | 783 | static int vino_i2c_del_bus(void) |
784 | { | 784 | { |
785 | return i2c_sgi_del_bus(&vino_i2c_adapter); | 785 | return i2c_del_adapter(&vino_i2c_adapter); |
786 | } | 786 | } |
787 | 787 | ||
788 | static int i2c_camera_command(unsigned int cmd, void *arg) | 788 | static int i2c_camera_command(unsigned int cmd, void *arg) |
diff --git a/drivers/media/video/zoran_card.c b/drivers/media/video/zoran_card.c index 653822ce391c..4d1eb2fba34a 100644 --- a/drivers/media/video/zoran_card.c +++ b/drivers/media/video/zoran_card.c | |||
@@ -849,7 +849,7 @@ zoran_register_i2c (struct zoran *zr) | |||
849 | static void | 849 | static void |
850 | zoran_unregister_i2c (struct zoran *zr) | 850 | zoran_unregister_i2c (struct zoran *zr) |
851 | { | 851 | { |
852 | i2c_bit_del_bus((&zr->i2c_adapter)); | 852 | i2c_del_adapter(&zr->i2c_adapter); |
853 | } | 853 | } |
854 | 854 | ||
855 | /* Check a zoran_params struct for correctness, insert default params */ | 855 | /* Check a zoran_params struct for correctness, insert default params */ |
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c index 931028f672de..35ad5cff18e6 100644 --- a/drivers/net/8139too.c +++ b/drivers/net/8139too.c | |||
@@ -2131,14 +2131,15 @@ static int rtl8139_poll(struct net_device *dev, int *budget) | |||
2131 | } | 2131 | } |
2132 | 2132 | ||
2133 | if (done) { | 2133 | if (done) { |
2134 | unsigned long flags; | ||
2134 | /* | 2135 | /* |
2135 | * Order is important since data can get interrupted | 2136 | * Order is important since data can get interrupted |
2136 | * again when we think we are done. | 2137 | * again when we think we are done. |
2137 | */ | 2138 | */ |
2138 | local_irq_disable(); | 2139 | local_irq_save(flags); |
2139 | RTL_W16_F(IntrMask, rtl8139_intr_mask); | 2140 | RTL_W16_F(IntrMask, rtl8139_intr_mask); |
2140 | __netif_rx_complete(dev); | 2141 | __netif_rx_complete(dev); |
2141 | local_irq_enable(); | 2142 | local_irq_restore(flags); |
2142 | } | 2143 | } |
2143 | spin_unlock(&tp->rx_lock); | 2144 | spin_unlock(&tp->rx_lock); |
2144 | 2145 | ||
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c index 143302a8e79c..72ba1a70f35f 100644 --- a/drivers/rtc/rtc-sh.c +++ b/drivers/rtc/rtc-sh.c | |||
@@ -2,6 +2,7 @@ | |||
2 | * SuperH On-Chip RTC Support | 2 | * SuperH On-Chip RTC Support |
3 | * | 3 | * |
4 | * Copyright (C) 2006 Paul Mundt | 4 | * Copyright (C) 2006 Paul Mundt |
5 | * Copyright (C) 2006 Jamie Lenehan | ||
5 | * | 6 | * |
6 | * Based on the old arch/sh/kernel/cpu/rtc.c by: | 7 | * Based on the old arch/sh/kernel/cpu/rtc.c by: |
7 | * | 8 | * |
@@ -21,7 +22,10 @@ | |||
21 | #include <linux/seq_file.h> | 22 | #include <linux/seq_file.h> |
22 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
23 | #include <linux/spinlock.h> | 24 | #include <linux/spinlock.h> |
24 | #include <asm/io.h> | 25 | #include <linux/io.h> |
26 | |||
27 | #define DRV_NAME "sh-rtc" | ||
28 | #define DRV_VERSION "0.1.2" | ||
25 | 29 | ||
26 | #ifdef CONFIG_CPU_SH3 | 30 | #ifdef CONFIG_CPU_SH3 |
27 | #define rtc_reg_size sizeof(u16) | 31 | #define rtc_reg_size sizeof(u16) |
@@ -33,22 +37,26 @@ | |||
33 | 37 | ||
34 | #define RTC_REG(r) ((r) * rtc_reg_size) | 38 | #define RTC_REG(r) ((r) * rtc_reg_size) |
35 | 39 | ||
36 | #define R64CNT RTC_REG(0) | 40 | #define R64CNT RTC_REG(0) |
37 | #define RSECCNT RTC_REG(1) | 41 | |
38 | #define RMINCNT RTC_REG(2) | 42 | #define RSECCNT RTC_REG(1) /* RTC sec */ |
39 | #define RHRCNT RTC_REG(3) | 43 | #define RMINCNT RTC_REG(2) /* RTC min */ |
40 | #define RWKCNT RTC_REG(4) | 44 | #define RHRCNT RTC_REG(3) /* RTC hour */ |
41 | #define RDAYCNT RTC_REG(5) | 45 | #define RWKCNT RTC_REG(4) /* RTC week */ |
42 | #define RMONCNT RTC_REG(6) | 46 | #define RDAYCNT RTC_REG(5) /* RTC day */ |
43 | #define RYRCNT RTC_REG(7) | 47 | #define RMONCNT RTC_REG(6) /* RTC month */ |
44 | #define RSECAR RTC_REG(8) | 48 | #define RYRCNT RTC_REG(7) /* RTC year */ |
45 | #define RMINAR RTC_REG(9) | 49 | #define RSECAR RTC_REG(8) /* ALARM sec */ |
46 | #define RHRAR RTC_REG(10) | 50 | #define RMINAR RTC_REG(9) /* ALARM min */ |
47 | #define RWKAR RTC_REG(11) | 51 | #define RHRAR RTC_REG(10) /* ALARM hour */ |
48 | #define RDAYAR RTC_REG(12) | 52 | #define RWKAR RTC_REG(11) /* ALARM week */ |
49 | #define RMONAR RTC_REG(13) | 53 | #define RDAYAR RTC_REG(12) /* ALARM day */ |
50 | #define RCR1 RTC_REG(14) | 54 | #define RMONAR RTC_REG(13) /* ALARM month */ |
51 | #define RCR2 RTC_REG(15) | 55 | #define RCR1 RTC_REG(14) /* Control */ |
56 | #define RCR2 RTC_REG(15) /* Control */ | ||
57 | |||
58 | /* ALARM Bits - or with BCD encoded value */ | ||
59 | #define AR_ENB 0x80 /* Enable for alarm cmp */ | ||
52 | 60 | ||
53 | /* RCR1 Bits */ | 61 | /* RCR1 Bits */ |
54 | #define RCR1_CF 0x80 /* Carry Flag */ | 62 | #define RCR1_CF 0x80 /* Carry Flag */ |
@@ -71,22 +79,28 @@ struct sh_rtc { | |||
71 | unsigned int alarm_irq, periodic_irq, carry_irq; | 79 | unsigned int alarm_irq, periodic_irq, carry_irq; |
72 | struct rtc_device *rtc_dev; | 80 | struct rtc_device *rtc_dev; |
73 | spinlock_t lock; | 81 | spinlock_t lock; |
82 | int rearm_aie; | ||
74 | }; | 83 | }; |
75 | 84 | ||
76 | static irqreturn_t sh_rtc_interrupt(int irq, void *id) | 85 | static irqreturn_t sh_rtc_interrupt(int irq, void *dev_id) |
77 | { | 86 | { |
78 | struct platform_device *pdev = id; | 87 | struct platform_device *pdev = to_platform_device(dev_id); |
79 | struct sh_rtc *rtc = platform_get_drvdata(pdev); | 88 | struct sh_rtc *rtc = platform_get_drvdata(pdev); |
80 | unsigned int tmp, events = 0; | 89 | unsigned int tmp, events = 0; |
81 | 90 | ||
82 | spin_lock(&rtc->lock); | 91 | spin_lock(&rtc->lock); |
83 | 92 | ||
84 | tmp = readb(rtc->regbase + RCR1); | 93 | tmp = readb(rtc->regbase + RCR1); |
94 | tmp &= ~RCR1_CF; | ||
85 | 95 | ||
86 | if (tmp & RCR1_AF) | 96 | if (rtc->rearm_aie) { |
87 | events |= RTC_AF | RTC_IRQF; | 97 | if (tmp & RCR1_AF) |
88 | 98 | tmp &= ~RCR1_AF; /* try to clear AF again */ | |
89 | tmp &= ~(RCR1_CF | RCR1_AF); | 99 | else { |
100 | tmp |= RCR1_AIE; /* AF has cleared, rearm IRQ */ | ||
101 | rtc->rearm_aie = 0; | ||
102 | } | ||
103 | } | ||
90 | 104 | ||
91 | writeb(tmp, rtc->regbase + RCR1); | 105 | writeb(tmp, rtc->regbase + RCR1); |
92 | 106 | ||
@@ -97,9 +111,45 @@ static irqreturn_t sh_rtc_interrupt(int irq, void *id) | |||
97 | return IRQ_HANDLED; | 111 | return IRQ_HANDLED; |
98 | } | 112 | } |
99 | 113 | ||
100 | static irqreturn_t sh_rtc_periodic(int irq, void *id) | 114 | static irqreturn_t sh_rtc_alarm(int irq, void *dev_id) |
115 | { | ||
116 | struct platform_device *pdev = to_platform_device(dev_id); | ||
117 | struct sh_rtc *rtc = platform_get_drvdata(pdev); | ||
118 | unsigned int tmp, events = 0; | ||
119 | |||
120 | spin_lock(&rtc->lock); | ||
121 | |||
122 | tmp = readb(rtc->regbase + RCR1); | ||
123 | |||
124 | /* | ||
125 | * If AF is set then the alarm has triggered. If we clear AF while | ||
126 | * the alarm time still matches the RTC time then AF will | ||
127 | * immediately be set again, and if AIE is enabled then the alarm | ||
128 | * interrupt will immediately be retrigger. So we clear AIE here | ||
129 | * and use rtc->rearm_aie so that the carry interrupt will keep | ||
130 | * trying to clear AF and once it stays cleared it'll re-enable | ||
131 | * AIE. | ||
132 | */ | ||
133 | if (tmp & RCR1_AF) { | ||
134 | events |= RTC_AF | RTC_IRQF; | ||
135 | |||
136 | tmp &= ~(RCR1_AF|RCR1_AIE); | ||
137 | |||
138 | writeb(tmp, rtc->regbase + RCR1); | ||
139 | |||
140 | rtc->rearm_aie = 1; | ||
141 | |||
142 | rtc_update_irq(&rtc->rtc_dev->class_dev, 1, events); | ||
143 | } | ||
144 | |||
145 | spin_unlock(&rtc->lock); | ||
146 | return IRQ_HANDLED; | ||
147 | } | ||
148 | |||
149 | static irqreturn_t sh_rtc_periodic(int irq, void *dev_id) | ||
101 | { | 150 | { |
102 | struct sh_rtc *rtc = dev_get_drvdata(id); | 151 | struct platform_device *pdev = to_platform_device(dev_id); |
152 | struct sh_rtc *rtc = platform_get_drvdata(pdev); | ||
103 | 153 | ||
104 | spin_lock(&rtc->lock); | 154 | spin_lock(&rtc->lock); |
105 | 155 | ||
@@ -139,10 +189,11 @@ static inline void sh_rtc_setaie(struct device *dev, unsigned int enable) | |||
139 | 189 | ||
140 | tmp = readb(rtc->regbase + RCR1); | 190 | tmp = readb(rtc->regbase + RCR1); |
141 | 191 | ||
142 | if (enable) | 192 | if (!enable) { |
143 | tmp |= RCR1_AIE; | ||
144 | else | ||
145 | tmp &= ~RCR1_AIE; | 193 | tmp &= ~RCR1_AIE; |
194 | rtc->rearm_aie = 0; | ||
195 | } else if (rtc->rearm_aie == 0) | ||
196 | tmp |= RCR1_AIE; | ||
146 | 197 | ||
147 | writeb(tmp, rtc->regbase + RCR1); | 198 | writeb(tmp, rtc->regbase + RCR1); |
148 | 199 | ||
@@ -177,7 +228,7 @@ static int sh_rtc_open(struct device *dev) | |||
177 | goto err_bad_carry; | 228 | goto err_bad_carry; |
178 | } | 229 | } |
179 | 230 | ||
180 | ret = request_irq(rtc->alarm_irq, sh_rtc_interrupt, IRQF_DISABLED, | 231 | ret = request_irq(rtc->alarm_irq, sh_rtc_alarm, IRQF_DISABLED, |
181 | "sh-rtc alarm", dev); | 232 | "sh-rtc alarm", dev); |
182 | if (unlikely(ret)) { | 233 | if (unlikely(ret)) { |
183 | dev_err(dev, "request alarm IRQ failed with %d, IRQ %d\n", | 234 | dev_err(dev, "request alarm IRQ failed with %d, IRQ %d\n", |
@@ -200,6 +251,7 @@ static void sh_rtc_release(struct device *dev) | |||
200 | struct sh_rtc *rtc = dev_get_drvdata(dev); | 251 | struct sh_rtc *rtc = dev_get_drvdata(dev); |
201 | 252 | ||
202 | sh_rtc_setpie(dev, 0); | 253 | sh_rtc_setpie(dev, 0); |
254 | sh_rtc_setaie(dev, 0); | ||
203 | 255 | ||
204 | free_irq(rtc->periodic_irq, dev); | 256 | free_irq(rtc->periodic_irq, dev); |
205 | free_irq(rtc->carry_irq, dev); | 257 | free_irq(rtc->carry_irq, dev); |
@@ -267,7 +319,7 @@ static int sh_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
267 | tm->tm_hour = BCD2BIN(readb(rtc->regbase + RHRCNT)); | 319 | tm->tm_hour = BCD2BIN(readb(rtc->regbase + RHRCNT)); |
268 | tm->tm_wday = BCD2BIN(readb(rtc->regbase + RWKCNT)); | 320 | tm->tm_wday = BCD2BIN(readb(rtc->regbase + RWKCNT)); |
269 | tm->tm_mday = BCD2BIN(readb(rtc->regbase + RDAYCNT)); | 321 | tm->tm_mday = BCD2BIN(readb(rtc->regbase + RDAYCNT)); |
270 | tm->tm_mon = BCD2BIN(readb(rtc->regbase + RMONCNT)); | 322 | tm->tm_mon = BCD2BIN(readb(rtc->regbase + RMONCNT)) - 1; |
271 | 323 | ||
272 | #if defined(CONFIG_CPU_SH4) | 324 | #if defined(CONFIG_CPU_SH4) |
273 | yr = readw(rtc->regbase + RYRCNT); | 325 | yr = readw(rtc->regbase + RYRCNT); |
@@ -295,7 +347,7 @@ static int sh_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
295 | "mday=%d, mon=%d, year=%d, wday=%d\n", | 347 | "mday=%d, mon=%d, year=%d, wday=%d\n", |
296 | __FUNCTION__, | 348 | __FUNCTION__, |
297 | tm->tm_sec, tm->tm_min, tm->tm_hour, | 349 | tm->tm_sec, tm->tm_min, tm->tm_hour, |
298 | tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); | 350 | tm->tm_mday, tm->tm_mon + 1, tm->tm_year, tm->tm_wday); |
299 | 351 | ||
300 | if (rtc_valid_tm(tm) < 0) | 352 | if (rtc_valid_tm(tm) < 0) |
301 | dev_err(dev, "invalid date\n"); | 353 | dev_err(dev, "invalid date\n"); |
@@ -322,7 +374,7 @@ static int sh_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
322 | writeb(BIN2BCD(tm->tm_hour), rtc->regbase + RHRCNT); | 374 | writeb(BIN2BCD(tm->tm_hour), rtc->regbase + RHRCNT); |
323 | writeb(BIN2BCD(tm->tm_wday), rtc->regbase + RWKCNT); | 375 | writeb(BIN2BCD(tm->tm_wday), rtc->regbase + RWKCNT); |
324 | writeb(BIN2BCD(tm->tm_mday), rtc->regbase + RDAYCNT); | 376 | writeb(BIN2BCD(tm->tm_mday), rtc->regbase + RDAYCNT); |
325 | writeb(BIN2BCD(tm->tm_mon), rtc->regbase + RMONCNT); | 377 | writeb(BIN2BCD(tm->tm_mon + 1), rtc->regbase + RMONCNT); |
326 | 378 | ||
327 | #ifdef CONFIG_CPU_SH3 | 379 | #ifdef CONFIG_CPU_SH3 |
328 | year = tm->tm_year % 100; | 380 | year = tm->tm_year % 100; |
@@ -344,12 +396,136 @@ static int sh_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
344 | return 0; | 396 | return 0; |
345 | } | 397 | } |
346 | 398 | ||
399 | static inline int sh_rtc_read_alarm_value(struct sh_rtc *rtc, int reg_off) | ||
400 | { | ||
401 | unsigned int byte; | ||
402 | int value = 0xff; /* return 0xff for ignored values */ | ||
403 | |||
404 | byte = readb(rtc->regbase + reg_off); | ||
405 | if (byte & AR_ENB) { | ||
406 | byte &= ~AR_ENB; /* strip the enable bit */ | ||
407 | value = BCD2BIN(byte); | ||
408 | } | ||
409 | |||
410 | return value; | ||
411 | } | ||
412 | |||
413 | static int sh_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *wkalrm) | ||
414 | { | ||
415 | struct platform_device *pdev = to_platform_device(dev); | ||
416 | struct sh_rtc *rtc = platform_get_drvdata(pdev); | ||
417 | struct rtc_time* tm = &wkalrm->time; | ||
418 | |||
419 | spin_lock_irq(&rtc->lock); | ||
420 | |||
421 | tm->tm_sec = sh_rtc_read_alarm_value(rtc, RSECAR); | ||
422 | tm->tm_min = sh_rtc_read_alarm_value(rtc, RMINAR); | ||
423 | tm->tm_hour = sh_rtc_read_alarm_value(rtc, RHRAR); | ||
424 | tm->tm_wday = sh_rtc_read_alarm_value(rtc, RWKAR); | ||
425 | tm->tm_mday = sh_rtc_read_alarm_value(rtc, RDAYAR); | ||
426 | tm->tm_mon = sh_rtc_read_alarm_value(rtc, RMONAR); | ||
427 | if (tm->tm_mon > 0) | ||
428 | tm->tm_mon -= 1; /* RTC is 1-12, tm_mon is 0-11 */ | ||
429 | tm->tm_year = 0xffff; | ||
430 | |||
431 | spin_unlock_irq(&rtc->lock); | ||
432 | |||
433 | return 0; | ||
434 | } | ||
435 | |||
436 | static inline void sh_rtc_write_alarm_value(struct sh_rtc *rtc, | ||
437 | int value, int reg_off) | ||
438 | { | ||
439 | /* < 0 for a value that is ignored */ | ||
440 | if (value < 0) | ||
441 | writeb(0, rtc->regbase + reg_off); | ||
442 | else | ||
443 | writeb(BIN2BCD(value) | AR_ENB, rtc->regbase + reg_off); | ||
444 | } | ||
445 | |||
446 | static int sh_rtc_check_alarm(struct rtc_time* tm) | ||
447 | { | ||
448 | /* | ||
449 | * The original rtc says anything > 0xc0 is "don't care" or "match | ||
450 | * all" - most users use 0xff but rtc-dev uses -1 for the same thing. | ||
451 | * The original rtc doesn't support years - some things use -1 and | ||
452 | * some 0xffff. We use -1 to make out tests easier. | ||
453 | */ | ||
454 | if (tm->tm_year == 0xffff) | ||
455 | tm->tm_year = -1; | ||
456 | if (tm->tm_mon >= 0xff) | ||
457 | tm->tm_mon = -1; | ||
458 | if (tm->tm_mday >= 0xff) | ||
459 | tm->tm_mday = -1; | ||
460 | if (tm->tm_wday >= 0xff) | ||
461 | tm->tm_wday = -1; | ||
462 | if (tm->tm_hour >= 0xff) | ||
463 | tm->tm_hour = -1; | ||
464 | if (tm->tm_min >= 0xff) | ||
465 | tm->tm_min = -1; | ||
466 | if (tm->tm_sec >= 0xff) | ||
467 | tm->tm_sec = -1; | ||
468 | |||
469 | if (tm->tm_year > 9999 || | ||
470 | tm->tm_mon >= 12 || | ||
471 | tm->tm_mday == 0 || tm->tm_mday >= 32 || | ||
472 | tm->tm_wday >= 7 || | ||
473 | tm->tm_hour >= 24 || | ||
474 | tm->tm_min >= 60 || | ||
475 | tm->tm_sec >= 60) | ||
476 | return -EINVAL; | ||
477 | |||
478 | return 0; | ||
479 | } | ||
480 | |||
481 | static int sh_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *wkalrm) | ||
482 | { | ||
483 | struct platform_device *pdev = to_platform_device(dev); | ||
484 | struct sh_rtc *rtc = platform_get_drvdata(pdev); | ||
485 | unsigned int rcr1; | ||
486 | struct rtc_time *tm = &wkalrm->time; | ||
487 | int mon, err; | ||
488 | |||
489 | err = sh_rtc_check_alarm(tm); | ||
490 | if (unlikely(err < 0)) | ||
491 | return err; | ||
492 | |||
493 | spin_lock_irq(&rtc->lock); | ||
494 | |||
495 | /* disable alarm interrupt and clear flag */ | ||
496 | rcr1 = readb(rtc->regbase + RCR1); | ||
497 | rcr1 &= ~RCR1_AF; | ||
498 | writeb(rcr1 & ~RCR1_AIE, rtc->regbase + RCR1); | ||
499 | |||
500 | rtc->rearm_aie = 0; | ||
501 | |||
502 | /* set alarm time */ | ||
503 | sh_rtc_write_alarm_value(rtc, tm->tm_sec, RSECAR); | ||
504 | sh_rtc_write_alarm_value(rtc, tm->tm_min, RMINAR); | ||
505 | sh_rtc_write_alarm_value(rtc, tm->tm_hour, RHRAR); | ||
506 | sh_rtc_write_alarm_value(rtc, tm->tm_wday, RWKAR); | ||
507 | sh_rtc_write_alarm_value(rtc, tm->tm_mday, RDAYAR); | ||
508 | mon = tm->tm_mon; | ||
509 | if (mon >= 0) | ||
510 | mon += 1; | ||
511 | sh_rtc_write_alarm_value(rtc, mon, RMONAR); | ||
512 | |||
513 | /* Restore interrupt activation status */ | ||
514 | writeb(rcr1, rtc->regbase + RCR1); | ||
515 | |||
516 | spin_unlock_irq(&rtc->lock); | ||
517 | |||
518 | return 0; | ||
519 | } | ||
520 | |||
347 | static struct rtc_class_ops sh_rtc_ops = { | 521 | static struct rtc_class_ops sh_rtc_ops = { |
348 | .open = sh_rtc_open, | 522 | .open = sh_rtc_open, |
349 | .release = sh_rtc_release, | 523 | .release = sh_rtc_release, |
350 | .ioctl = sh_rtc_ioctl, | 524 | .ioctl = sh_rtc_ioctl, |
351 | .read_time = sh_rtc_read_time, | 525 | .read_time = sh_rtc_read_time, |
352 | .set_time = sh_rtc_set_time, | 526 | .set_time = sh_rtc_set_time, |
527 | .read_alarm = sh_rtc_read_alarm, | ||
528 | .set_alarm = sh_rtc_set_alarm, | ||
353 | .proc = sh_rtc_proc, | 529 | .proc = sh_rtc_proc, |
354 | }; | 530 | }; |
355 | 531 | ||
@@ -442,7 +618,7 @@ static int __devexit sh_rtc_remove(struct platform_device *pdev) | |||
442 | } | 618 | } |
443 | static struct platform_driver sh_rtc_platform_driver = { | 619 | static struct platform_driver sh_rtc_platform_driver = { |
444 | .driver = { | 620 | .driver = { |
445 | .name = "sh-rtc", | 621 | .name = DRV_NAME, |
446 | .owner = THIS_MODULE, | 622 | .owner = THIS_MODULE, |
447 | }, | 623 | }, |
448 | .probe = sh_rtc_probe, | 624 | .probe = sh_rtc_probe, |
@@ -463,5 +639,6 @@ module_init(sh_rtc_init); | |||
463 | module_exit(sh_rtc_exit); | 639 | module_exit(sh_rtc_exit); |
464 | 640 | ||
465 | MODULE_DESCRIPTION("SuperH on-chip RTC driver"); | 641 | MODULE_DESCRIPTION("SuperH on-chip RTC driver"); |
466 | MODULE_AUTHOR("Paul Mundt <lethal@linux-sh.org>"); | 642 | MODULE_VERSION(DRV_VERSION); |
643 | MODULE_AUTHOR("Paul Mundt <lethal@linux-sh.org>, Jamie Lenehan <lenehan@twibble.org>"); | ||
467 | MODULE_LICENSE("GPL"); | 644 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c index 9031b57f12dd..c53b69610a51 100644 --- a/drivers/serial/sh-sci.c +++ b/drivers/serial/sh-sci.c | |||
@@ -319,6 +319,28 @@ static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag) | |||
319 | 319 | ||
320 | sci_out(port, SCFCR, fcr_val); | 320 | sci_out(port, SCFCR, fcr_val); |
321 | } | 321 | } |
322 | #elif defined(CONFIG_CPU_SUBTYPE_SH7722) | ||
323 | static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag) | ||
324 | { | ||
325 | unsigned int fcr_val = 0; | ||
326 | |||
327 | if (cflag & CRTSCTS) { | ||
328 | fcr_val |= SCFCR_MCE; | ||
329 | |||
330 | ctrl_outw(0x0000, PORT_PSCR); | ||
331 | } else { | ||
332 | unsigned short data; | ||
333 | |||
334 | data = ctrl_inw(PORT_PSCR); | ||
335 | data &= 0x033f; | ||
336 | data |= 0x0400; | ||
337 | ctrl_outw(data, PORT_PSCR); | ||
338 | |||
339 | ctrl_outw(ctrl_inw(SCSPTR0) & 0x17, SCSPTR0); | ||
340 | } | ||
341 | |||
342 | sci_out(port, SCFCR, fcr_val); | ||
343 | } | ||
322 | #else | 344 | #else |
323 | /* For SH7750 */ | 345 | /* For SH7750 */ |
324 | static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag) | 346 | static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag) |
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h index e4557cc4f74b..77f7d6351ab1 100644 --- a/drivers/serial/sh-sci.h +++ b/drivers/serial/sh-sci.h | |||
@@ -90,6 +90,13 @@ | |||
90 | # define SCSPTR3 0xffe30010 /* 16 bit SCIF */ | 90 | # define SCSPTR3 0xffe30010 /* 16 bit SCIF */ |
91 | # define SCSCR_INIT(port) 0x32 /* TIE=0,RIE=0,TE=1,RE=1,REIE=0,CKE=1 */ | 91 | # define SCSCR_INIT(port) 0x32 /* TIE=0,RIE=0,TE=1,RE=1,REIE=0,CKE=1 */ |
92 | # define SCIF_ONLY | 92 | # define SCIF_ONLY |
93 | #elif defined(CONFIG_CPU_SUBTYPE_SH7722) | ||
94 | # define SCPDR0 0xA405013E /* 16 bit SCIF0 PSDR */ | ||
95 | # define SCSPTR0 SCPDR0 | ||
96 | # define SCIF_ORER 0x0001 /* overrun error bit */ | ||
97 | # define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | ||
98 | # define SCIF_ONLY | ||
99 | # define PORT_PSCR 0xA405011E | ||
93 | #elif defined(CONFIG_CPU_SUBTYPE_SH4_202) | 100 | #elif defined(CONFIG_CPU_SUBTYPE_SH4_202) |
94 | # define SCSPTR2 0xffe80020 /* 16 bit SCIF */ | 101 | # define SCSPTR2 0xffe80020 /* 16 bit SCIF */ |
95 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 102 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
@@ -495,6 +502,7 @@ static inline int sci_rxd_in(struct uart_port *port) | |||
495 | return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ | 502 | return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ |
496 | if (port->mapbase == 0xfe620000) | 503 | if (port->mapbase == 0xfe620000) |
497 | return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ | 504 | return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ |
505 | return 1; | ||
498 | } | 506 | } |
499 | #elif defined(CONFIG_CPU_SUBTYPE_SH7300) | 507 | #elif defined(CONFIG_CPU_SUBTYPE_SH7300) |
500 | static inline int sci_rxd_in(struct uart_port *port) | 508 | static inline int sci_rxd_in(struct uart_port *port) |
@@ -521,6 +529,13 @@ static inline int sci_rxd_in(struct uart_port *port) | |||
521 | return ctrl_inw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */ | 529 | return ctrl_inw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */ |
522 | return 1; | 530 | return 1; |
523 | } | 531 | } |
532 | #elif defined(CONFIG_CPU_SUBTYPE_SH7722) | ||
533 | static inline int sci_rxd_in(struct uart_port *port) | ||
534 | { | ||
535 | if (port->mapbase == 0xffe00000) | ||
536 | return ctrl_inb(SCPDR0) & 0x0001 ? 1 : 0; /* SCIF0 */ | ||
537 | return 1; | ||
538 | } | ||
524 | #elif defined(CONFIG_CPU_SUBTYPE_ST40STB1) | 539 | #elif defined(CONFIG_CPU_SUBTYPE_ST40STB1) |
525 | static inline int sci_rxd_in(struct uart_port *port) | 540 | static inline int sci_rxd_in(struct uart_port *port) |
526 | { | 541 | { |
@@ -550,6 +565,7 @@ static inline int sci_rxd_in(struct uart_port *port) | |||
550 | return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ | 565 | return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ |
551 | if (port->mapbase == 0xff925000) | 566 | if (port->mapbase == 0xff925000) |
552 | return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ | 567 | return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ |
568 | return 1; | ||
553 | } | 569 | } |
554 | #elif defined(CONFIG_CPU_SUBTYPE_SH7780) | 570 | #elif defined(CONFIG_CPU_SUBTYPE_SH7780) |
555 | static inline int sci_rxd_in(struct uart_port *port) | 571 | static inline int sci_rxd_in(struct uart_port *port) |
@@ -558,6 +574,7 @@ static inline int sci_rxd_in(struct uart_port *port) | |||
558 | return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */ | 574 | return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */ |
559 | if (port->mapbase == 0xffe10000) | 575 | if (port->mapbase == 0xffe10000) |
560 | return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ | 576 | return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ |
577 | return 1; | ||
561 | } | 578 | } |
562 | #elif defined(CONFIG_CPU_SUBTYPE_SH7206) | 579 | #elif defined(CONFIG_CPU_SUBTYPE_SH7206) |
563 | static inline int sci_rxd_in(struct uart_port *port) | 580 | static inline int sci_rxd_in(struct uart_port *port) |
@@ -570,6 +587,7 @@ static inline int sci_rxd_in(struct uart_port *port) | |||
570 | return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ | 587 | return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ |
571 | if (port->mapbase == 0xfffe9800) | 588 | if (port->mapbase == 0xfffe9800) |
572 | return ctrl_inw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */ | 589 | return ctrl_inw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */ |
590 | return 1; | ||
573 | } | 591 | } |
574 | #elif defined(CONFIG_CPU_SUBTYPE_SH7619) | 592 | #elif defined(CONFIG_CPU_SUBTYPE_SH7619) |
575 | static inline int sci_rxd_in(struct uart_port *port) | 593 | static inline int sci_rxd_in(struct uart_port *port) |
@@ -580,6 +598,7 @@ static inline int sci_rxd_in(struct uart_port *port) | |||
580 | return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ | 598 | return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ |
581 | if (port->mapbase == 0xf8420000) | 599 | if (port->mapbase == 0xf8420000) |
582 | return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ | 600 | return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ |
601 | return 1; | ||
583 | } | 602 | } |
584 | #endif | 603 | #endif |
585 | 604 | ||
diff --git a/drivers/video/aty/radeon_i2c.c b/drivers/video/aty/radeon_i2c.c index 869725a13c21..e7c5b219ad1b 100644 --- a/drivers/video/aty/radeon_i2c.c +++ b/drivers/video/aty/radeon_i2c.c | |||
@@ -120,19 +120,19 @@ void radeon_create_i2c_busses(struct radeonfb_info *rinfo) | |||
120 | void radeon_delete_i2c_busses(struct radeonfb_info *rinfo) | 120 | void radeon_delete_i2c_busses(struct radeonfb_info *rinfo) |
121 | { | 121 | { |
122 | if (rinfo->i2c[0].rinfo) | 122 | if (rinfo->i2c[0].rinfo) |
123 | i2c_bit_del_bus(&rinfo->i2c[0].adapter); | 123 | i2c_del_adapter(&rinfo->i2c[0].adapter); |
124 | rinfo->i2c[0].rinfo = NULL; | 124 | rinfo->i2c[0].rinfo = NULL; |
125 | 125 | ||
126 | if (rinfo->i2c[1].rinfo) | 126 | if (rinfo->i2c[1].rinfo) |
127 | i2c_bit_del_bus(&rinfo->i2c[1].adapter); | 127 | i2c_del_adapter(&rinfo->i2c[1].adapter); |
128 | rinfo->i2c[1].rinfo = NULL; | 128 | rinfo->i2c[1].rinfo = NULL; |
129 | 129 | ||
130 | if (rinfo->i2c[2].rinfo) | 130 | if (rinfo->i2c[2].rinfo) |
131 | i2c_bit_del_bus(&rinfo->i2c[2].adapter); | 131 | i2c_del_adapter(&rinfo->i2c[2].adapter); |
132 | rinfo->i2c[2].rinfo = NULL; | 132 | rinfo->i2c[2].rinfo = NULL; |
133 | 133 | ||
134 | if (rinfo->i2c[3].rinfo) | 134 | if (rinfo->i2c[3].rinfo) |
135 | i2c_bit_del_bus(&rinfo->i2c[3].adapter); | 135 | i2c_del_adapter(&rinfo->i2c[3].adapter); |
136 | rinfo->i2c[3].rinfo = NULL; | 136 | rinfo->i2c[3].rinfo = NULL; |
137 | } | 137 | } |
138 | 138 | ||
diff --git a/drivers/video/i810/i810-i2c.c b/drivers/video/i810/i810-i2c.c index b952e4504abe..961f4d404467 100644 --- a/drivers/video/i810/i810-i2c.c +++ b/drivers/video/i810/i810-i2c.c | |||
@@ -137,15 +137,15 @@ void i810_create_i2c_busses(struct i810fb_par *par) | |||
137 | void i810_delete_i2c_busses(struct i810fb_par *par) | 137 | void i810_delete_i2c_busses(struct i810fb_par *par) |
138 | { | 138 | { |
139 | if (par->chan[0].par) | 139 | if (par->chan[0].par) |
140 | i2c_bit_del_bus(&par->chan[0].adapter); | 140 | i2c_del_adapter(&par->chan[0].adapter); |
141 | par->chan[0].par = NULL; | 141 | par->chan[0].par = NULL; |
142 | 142 | ||
143 | if (par->chan[1].par) | 143 | if (par->chan[1].par) |
144 | i2c_bit_del_bus(&par->chan[1].adapter); | 144 | i2c_del_adapter(&par->chan[1].adapter); |
145 | par->chan[1].par = NULL; | 145 | par->chan[1].par = NULL; |
146 | 146 | ||
147 | if (par->chan[2].par) | 147 | if (par->chan[2].par) |
148 | i2c_bit_del_bus(&par->chan[2].adapter); | 148 | i2c_del_adapter(&par->chan[2].adapter); |
149 | par->chan[2].par = NULL; | 149 | par->chan[2].par = NULL; |
150 | } | 150 | } |
151 | 151 | ||
diff --git a/drivers/video/intelfb/intelfb_i2c.c b/drivers/video/intelfb/intelfb_i2c.c index 5686e2164e39..33bc41f50540 100644 --- a/drivers/video/intelfb/intelfb_i2c.c +++ b/drivers/video/intelfb/intelfb_i2c.c | |||
@@ -188,11 +188,11 @@ void intelfb_delete_i2c_busses(struct intelfb_info *dinfo) | |||
188 | 188 | ||
189 | for (i = 0; i < MAX_OUTPUTS; i++) { | 189 | for (i = 0; i < MAX_OUTPUTS; i++) { |
190 | if (dinfo->output[i].i2c_bus.dinfo) { | 190 | if (dinfo->output[i].i2c_bus.dinfo) { |
191 | i2c_bit_del_bus(&dinfo->output[i].i2c_bus.adapter); | 191 | i2c_del_adapter(&dinfo->output[i].i2c_bus.adapter); |
192 | dinfo->output[i].i2c_bus.dinfo = NULL; | 192 | dinfo->output[i].i2c_bus.dinfo = NULL; |
193 | } | 193 | } |
194 | if (dinfo->output[i].ddc_bus.dinfo) { | 194 | if (dinfo->output[i].ddc_bus.dinfo) { |
195 | i2c_bit_del_bus(&dinfo->output[i].ddc_bus.adapter); | 195 | i2c_del_adapter(&dinfo->output[i].ddc_bus.adapter); |
196 | dinfo->output[i].ddc_bus.dinfo = NULL; | 196 | dinfo->output[i].ddc_bus.dinfo = NULL; |
197 | } | 197 | } |
198 | } | 198 | } |
diff --git a/drivers/video/matrox/i2c-matroxfb.c b/drivers/video/matrox/i2c-matroxfb.c index 795c1a99a680..797b42305b0f 100644 --- a/drivers/video/matrox/i2c-matroxfb.c +++ b/drivers/video/matrox/i2c-matroxfb.c | |||
@@ -124,7 +124,7 @@ static int i2c_bus_reg(struct i2c_bit_adapter* b, struct matrox_fb_info* minfo, | |||
124 | 124 | ||
125 | static void i2c_bit_bus_del(struct i2c_bit_adapter* b) { | 125 | static void i2c_bit_bus_del(struct i2c_bit_adapter* b) { |
126 | if (b->initialized) { | 126 | if (b->initialized) { |
127 | i2c_bit_del_bus(&b->adapter); | 127 | i2c_del_adapter(&b->adapter); |
128 | b->initialized = 0; | 128 | b->initialized = 0; |
129 | } | 129 | } |
130 | } | 130 | } |
diff --git a/drivers/video/nvidia/nv_i2c.c b/drivers/video/nvidia/nv_i2c.c index 442e85328341..8454adf2d178 100644 --- a/drivers/video/nvidia/nv_i2c.c +++ b/drivers/video/nvidia/nv_i2c.c | |||
@@ -147,15 +147,15 @@ void nvidia_create_i2c_busses(struct nvidia_par *par) | |||
147 | void nvidia_delete_i2c_busses(struct nvidia_par *par) | 147 | void nvidia_delete_i2c_busses(struct nvidia_par *par) |
148 | { | 148 | { |
149 | if (par->chan[0].par) | 149 | if (par->chan[0].par) |
150 | i2c_bit_del_bus(&par->chan[0].adapter); | 150 | i2c_del_adapter(&par->chan[0].adapter); |
151 | par->chan[0].par = NULL; | 151 | par->chan[0].par = NULL; |
152 | 152 | ||
153 | if (par->chan[1].par) | 153 | if (par->chan[1].par) |
154 | i2c_bit_del_bus(&par->chan[1].adapter); | 154 | i2c_del_adapter(&par->chan[1].adapter); |
155 | par->chan[1].par = NULL; | 155 | par->chan[1].par = NULL; |
156 | 156 | ||
157 | if (par->chan[2].par) | 157 | if (par->chan[2].par) |
158 | i2c_bit_del_bus(&par->chan[2].adapter); | 158 | i2c_del_adapter(&par->chan[2].adapter); |
159 | par->chan[2].par = NULL; | 159 | par->chan[2].par = NULL; |
160 | 160 | ||
161 | } | 161 | } |
diff --git a/drivers/video/riva/rivafb-i2c.c b/drivers/video/riva/rivafb-i2c.c index c15b259af644..01b85e3b0ae1 100644 --- a/drivers/video/riva/rivafb-i2c.c +++ b/drivers/video/riva/rivafb-i2c.c | |||
@@ -144,15 +144,15 @@ void riva_create_i2c_busses(struct riva_par *par) | |||
144 | void riva_delete_i2c_busses(struct riva_par *par) | 144 | void riva_delete_i2c_busses(struct riva_par *par) |
145 | { | 145 | { |
146 | if (par->chan[0].par) | 146 | if (par->chan[0].par) |
147 | i2c_bit_del_bus(&par->chan[0].adapter); | 147 | i2c_del_adapter(&par->chan[0].adapter); |
148 | par->chan[0].par = NULL; | 148 | par->chan[0].par = NULL; |
149 | 149 | ||
150 | if (par->chan[1].par) | 150 | if (par->chan[1].par) |
151 | i2c_bit_del_bus(&par->chan[1].adapter); | 151 | i2c_del_adapter(&par->chan[1].adapter); |
152 | par->chan[1].par = NULL; | 152 | par->chan[1].par = NULL; |
153 | 153 | ||
154 | if (par->chan[2].par) | 154 | if (par->chan[2].par) |
155 | i2c_bit_del_bus(&par->chan[2].adapter); | 155 | i2c_del_adapter(&par->chan[2].adapter); |
156 | par->chan[2].par = NULL; | 156 | par->chan[2].par = NULL; |
157 | } | 157 | } |
158 | 158 | ||
diff --git a/drivers/video/savage/savagefb-i2c.c b/drivers/video/savage/savagefb-i2c.c index cef5bf591cdf..1411f3b6a009 100644 --- a/drivers/video/savage/savagefb-i2c.c +++ b/drivers/video/savage/savagefb-i2c.c | |||
@@ -208,7 +208,7 @@ void savagefb_delete_i2c_busses(struct fb_info *info) | |||
208 | struct savagefb_par *par = info->par; | 208 | struct savagefb_par *par = info->par; |
209 | 209 | ||
210 | if (par->chan.par) | 210 | if (par->chan.par) |
211 | i2c_bit_del_bus(&par->chan.adapter); | 211 | i2c_del_adapter(&par->chan.adapter); |
212 | 212 | ||
213 | par->chan.par = NULL; | 213 | par->chan.par = NULL; |
214 | } | 214 | } |
diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c index d11753c50bc1..357f1d551771 100644 --- a/fs/ocfs2/cluster/nodemanager.c +++ b/fs/ocfs2/cluster/nodemanager.c | |||
@@ -35,7 +35,7 @@ | |||
35 | /* for now we operate under the assertion that there can be only one | 35 | /* for now we operate under the assertion that there can be only one |
36 | * cluster active at a time. Changing this will require trickling | 36 | * cluster active at a time. Changing this will require trickling |
37 | * cluster references throughout where nodes are looked up */ | 37 | * cluster references throughout where nodes are looked up */ |
38 | static struct o2nm_cluster *o2nm_single_cluster = NULL; | 38 | struct o2nm_cluster *o2nm_single_cluster = NULL; |
39 | 39 | ||
40 | #define OCFS2_MAX_HB_CTL_PATH 256 | 40 | #define OCFS2_MAX_HB_CTL_PATH 256 |
41 | static char ocfs2_hb_ctl_path[OCFS2_MAX_HB_CTL_PATH] = "/sbin/ocfs2_hb_ctl"; | 41 | static char ocfs2_hb_ctl_path[OCFS2_MAX_HB_CTL_PATH] = "/sbin/ocfs2_hb_ctl"; |
@@ -97,17 +97,6 @@ const char *o2nm_get_hb_ctl_path(void) | |||
97 | } | 97 | } |
98 | EXPORT_SYMBOL_GPL(o2nm_get_hb_ctl_path); | 98 | EXPORT_SYMBOL_GPL(o2nm_get_hb_ctl_path); |
99 | 99 | ||
100 | struct o2nm_cluster { | ||
101 | struct config_group cl_group; | ||
102 | unsigned cl_has_local:1; | ||
103 | u8 cl_local_node; | ||
104 | rwlock_t cl_nodes_lock; | ||
105 | struct o2nm_node *cl_nodes[O2NM_MAX_NODES]; | ||
106 | struct rb_root cl_node_ip_tree; | ||
107 | /* this bitmap is part of a hack for disk bitmap.. will go eventually. - zab */ | ||
108 | unsigned long cl_nodes_bitmap[BITS_TO_LONGS(O2NM_MAX_NODES)]; | ||
109 | }; | ||
110 | |||
111 | struct o2nm_node *o2nm_get_node_by_num(u8 node_num) | 100 | struct o2nm_node *o2nm_get_node_by_num(u8 node_num) |
112 | { | 101 | { |
113 | struct o2nm_node *node = NULL; | 102 | struct o2nm_node *node = NULL; |
@@ -543,6 +532,179 @@ static struct o2nm_node_group *to_o2nm_node_group(struct config_group *group) | |||
543 | } | 532 | } |
544 | #endif | 533 | #endif |
545 | 534 | ||
535 | struct o2nm_cluster_attribute { | ||
536 | struct configfs_attribute attr; | ||
537 | ssize_t (*show)(struct o2nm_cluster *, char *); | ||
538 | ssize_t (*store)(struct o2nm_cluster *, const char *, size_t); | ||
539 | }; | ||
540 | |||
541 | static ssize_t o2nm_cluster_attr_write(const char *page, ssize_t count, | ||
542 | unsigned int *val) | ||
543 | { | ||
544 | unsigned long tmp; | ||
545 | char *p = (char *)page; | ||
546 | |||
547 | tmp = simple_strtoul(p, &p, 0); | ||
548 | if (!p || (*p && (*p != '\n'))) | ||
549 | return -EINVAL; | ||
550 | |||
551 | if (tmp == 0) | ||
552 | return -EINVAL; | ||
553 | if (tmp >= (u32)-1) | ||
554 | return -ERANGE; | ||
555 | |||
556 | *val = tmp; | ||
557 | |||
558 | return count; | ||
559 | } | ||
560 | |||
561 | static ssize_t o2nm_cluster_attr_idle_timeout_ms_read( | ||
562 | struct o2nm_cluster *cluster, char *page) | ||
563 | { | ||
564 | return sprintf(page, "%u\n", cluster->cl_idle_timeout_ms); | ||
565 | } | ||
566 | |||
567 | static ssize_t o2nm_cluster_attr_idle_timeout_ms_write( | ||
568 | struct o2nm_cluster *cluster, const char *page, size_t count) | ||
569 | { | ||
570 | ssize_t ret; | ||
571 | unsigned int val; | ||
572 | |||
573 | ret = o2nm_cluster_attr_write(page, count, &val); | ||
574 | |||
575 | if (ret > 0) { | ||
576 | if (cluster->cl_idle_timeout_ms != val | ||
577 | && o2net_num_connected_peers()) { | ||
578 | mlog(ML_NOTICE, | ||
579 | "o2net: cannot change idle timeout after " | ||
580 | "the first peer has agreed to it." | ||
581 | " %d connected peers\n", | ||
582 | o2net_num_connected_peers()); | ||
583 | ret = -EINVAL; | ||
584 | } else if (val <= cluster->cl_keepalive_delay_ms) { | ||
585 | mlog(ML_NOTICE, "o2net: idle timeout must be larger " | ||
586 | "than keepalive delay\n"); | ||
587 | ret = -EINVAL; | ||
588 | } else { | ||
589 | cluster->cl_idle_timeout_ms = val; | ||
590 | } | ||
591 | } | ||
592 | |||
593 | return ret; | ||
594 | } | ||
595 | |||
596 | static ssize_t o2nm_cluster_attr_keepalive_delay_ms_read( | ||
597 | struct o2nm_cluster *cluster, char *page) | ||
598 | { | ||
599 | return sprintf(page, "%u\n", cluster->cl_keepalive_delay_ms); | ||
600 | } | ||
601 | |||
602 | static ssize_t o2nm_cluster_attr_keepalive_delay_ms_write( | ||
603 | struct o2nm_cluster *cluster, const char *page, size_t count) | ||
604 | { | ||
605 | ssize_t ret; | ||
606 | unsigned int val; | ||
607 | |||
608 | ret = o2nm_cluster_attr_write(page, count, &val); | ||
609 | |||
610 | if (ret > 0) { | ||
611 | if (cluster->cl_keepalive_delay_ms != val | ||
612 | && o2net_num_connected_peers()) { | ||
613 | mlog(ML_NOTICE, | ||
614 | "o2net: cannot change keepalive delay after" | ||
615 | " the first peer has agreed to it." | ||
616 | " %d connected peers\n", | ||
617 | o2net_num_connected_peers()); | ||
618 | ret = -EINVAL; | ||
619 | } else if (val >= cluster->cl_idle_timeout_ms) { | ||
620 | mlog(ML_NOTICE, "o2net: keepalive delay must be " | ||
621 | "smaller than idle timeout\n"); | ||
622 | ret = -EINVAL; | ||
623 | } else { | ||
624 | cluster->cl_keepalive_delay_ms = val; | ||
625 | } | ||
626 | } | ||
627 | |||
628 | return ret; | ||
629 | } | ||
630 | |||
631 | static ssize_t o2nm_cluster_attr_reconnect_delay_ms_read( | ||
632 | struct o2nm_cluster *cluster, char *page) | ||
633 | { | ||
634 | return sprintf(page, "%u\n", cluster->cl_reconnect_delay_ms); | ||
635 | } | ||
636 | |||
637 | static ssize_t o2nm_cluster_attr_reconnect_delay_ms_write( | ||
638 | struct o2nm_cluster *cluster, const char *page, size_t count) | ||
639 | { | ||
640 | return o2nm_cluster_attr_write(page, count, | ||
641 | &cluster->cl_reconnect_delay_ms); | ||
642 | } | ||
643 | static struct o2nm_cluster_attribute o2nm_cluster_attr_idle_timeout_ms = { | ||
644 | .attr = { .ca_owner = THIS_MODULE, | ||
645 | .ca_name = "idle_timeout_ms", | ||
646 | .ca_mode = S_IRUGO | S_IWUSR }, | ||
647 | .show = o2nm_cluster_attr_idle_timeout_ms_read, | ||
648 | .store = o2nm_cluster_attr_idle_timeout_ms_write, | ||
649 | }; | ||
650 | |||
651 | static struct o2nm_cluster_attribute o2nm_cluster_attr_keepalive_delay_ms = { | ||
652 | .attr = { .ca_owner = THIS_MODULE, | ||
653 | .ca_name = "keepalive_delay_ms", | ||
654 | .ca_mode = S_IRUGO | S_IWUSR }, | ||
655 | .show = o2nm_cluster_attr_keepalive_delay_ms_read, | ||
656 | .store = o2nm_cluster_attr_keepalive_delay_ms_write, | ||
657 | }; | ||
658 | |||
659 | static struct o2nm_cluster_attribute o2nm_cluster_attr_reconnect_delay_ms = { | ||
660 | .attr = { .ca_owner = THIS_MODULE, | ||
661 | .ca_name = "reconnect_delay_ms", | ||
662 | .ca_mode = S_IRUGO | S_IWUSR }, | ||
663 | .show = o2nm_cluster_attr_reconnect_delay_ms_read, | ||
664 | .store = o2nm_cluster_attr_reconnect_delay_ms_write, | ||
665 | }; | ||
666 | |||
667 | static struct configfs_attribute *o2nm_cluster_attrs[] = { | ||
668 | &o2nm_cluster_attr_idle_timeout_ms.attr, | ||
669 | &o2nm_cluster_attr_keepalive_delay_ms.attr, | ||
670 | &o2nm_cluster_attr_reconnect_delay_ms.attr, | ||
671 | NULL, | ||
672 | }; | ||
673 | static ssize_t o2nm_cluster_show(struct config_item *item, | ||
674 | struct configfs_attribute *attr, | ||
675 | char *page) | ||
676 | { | ||
677 | struct o2nm_cluster *cluster = to_o2nm_cluster(item); | ||
678 | struct o2nm_cluster_attribute *o2nm_cluster_attr = | ||
679 | container_of(attr, struct o2nm_cluster_attribute, attr); | ||
680 | ssize_t ret = 0; | ||
681 | |||
682 | if (o2nm_cluster_attr->show) | ||
683 | ret = o2nm_cluster_attr->show(cluster, page); | ||
684 | return ret; | ||
685 | } | ||
686 | |||
687 | static ssize_t o2nm_cluster_store(struct config_item *item, | ||
688 | struct configfs_attribute *attr, | ||
689 | const char *page, size_t count) | ||
690 | { | ||
691 | struct o2nm_cluster *cluster = to_o2nm_cluster(item); | ||
692 | struct o2nm_cluster_attribute *o2nm_cluster_attr = | ||
693 | container_of(attr, struct o2nm_cluster_attribute, attr); | ||
694 | ssize_t ret; | ||
695 | |||
696 | if (o2nm_cluster_attr->store == NULL) { | ||
697 | ret = -EINVAL; | ||
698 | goto out; | ||
699 | } | ||
700 | |||
701 | ret = o2nm_cluster_attr->store(cluster, page, count); | ||
702 | if (ret < count) | ||
703 | goto out; | ||
704 | out: | ||
705 | return ret; | ||
706 | } | ||
707 | |||
546 | static struct config_item *o2nm_node_group_make_item(struct config_group *group, | 708 | static struct config_item *o2nm_node_group_make_item(struct config_group *group, |
547 | const char *name) | 709 | const char *name) |
548 | { | 710 | { |
@@ -624,10 +786,13 @@ static void o2nm_cluster_release(struct config_item *item) | |||
624 | 786 | ||
625 | static struct configfs_item_operations o2nm_cluster_item_ops = { | 787 | static struct configfs_item_operations o2nm_cluster_item_ops = { |
626 | .release = o2nm_cluster_release, | 788 | .release = o2nm_cluster_release, |
789 | .show_attribute = o2nm_cluster_show, | ||
790 | .store_attribute = o2nm_cluster_store, | ||
627 | }; | 791 | }; |
628 | 792 | ||
629 | static struct config_item_type o2nm_cluster_type = { | 793 | static struct config_item_type o2nm_cluster_type = { |
630 | .ct_item_ops = &o2nm_cluster_item_ops, | 794 | .ct_item_ops = &o2nm_cluster_item_ops, |
795 | .ct_attrs = o2nm_cluster_attrs, | ||
631 | .ct_owner = THIS_MODULE, | 796 | .ct_owner = THIS_MODULE, |
632 | }; | 797 | }; |
633 | 798 | ||
@@ -678,6 +843,9 @@ static struct config_group *o2nm_cluster_group_make_group(struct config_group *g | |||
678 | cluster->cl_group.default_groups[2] = NULL; | 843 | cluster->cl_group.default_groups[2] = NULL; |
679 | rwlock_init(&cluster->cl_nodes_lock); | 844 | rwlock_init(&cluster->cl_nodes_lock); |
680 | cluster->cl_node_ip_tree = RB_ROOT; | 845 | cluster->cl_node_ip_tree = RB_ROOT; |
846 | cluster->cl_reconnect_delay_ms = O2NET_RECONNECT_DELAY_MS_DEFAULT; | ||
847 | cluster->cl_idle_timeout_ms = O2NET_IDLE_TIMEOUT_MS_DEFAULT; | ||
848 | cluster->cl_keepalive_delay_ms = O2NET_KEEPALIVE_DELAY_MS_DEFAULT; | ||
681 | 849 | ||
682 | ret = &cluster->cl_group; | 850 | ret = &cluster->cl_group; |
683 | o2nm_single_cluster = cluster; | 851 | o2nm_single_cluster = cluster; |
diff --git a/fs/ocfs2/cluster/nodemanager.h b/fs/ocfs2/cluster/nodemanager.h index fce8033c310f..8fb23cacc2f5 100644 --- a/fs/ocfs2/cluster/nodemanager.h +++ b/fs/ocfs2/cluster/nodemanager.h | |||
@@ -53,6 +53,23 @@ struct o2nm_node { | |||
53 | unsigned long nd_set_attributes; | 53 | unsigned long nd_set_attributes; |
54 | }; | 54 | }; |
55 | 55 | ||
56 | struct o2nm_cluster { | ||
57 | struct config_group cl_group; | ||
58 | unsigned cl_has_local:1; | ||
59 | u8 cl_local_node; | ||
60 | rwlock_t cl_nodes_lock; | ||
61 | struct o2nm_node *cl_nodes[O2NM_MAX_NODES]; | ||
62 | struct rb_root cl_node_ip_tree; | ||
63 | unsigned int cl_idle_timeout_ms; | ||
64 | unsigned int cl_keepalive_delay_ms; | ||
65 | unsigned int cl_reconnect_delay_ms; | ||
66 | |||
67 | /* this bitmap is part of a hack for disk bitmap.. will go eventually. - zab */ | ||
68 | unsigned long cl_nodes_bitmap[BITS_TO_LONGS(O2NM_MAX_NODES)]; | ||
69 | }; | ||
70 | |||
71 | extern struct o2nm_cluster *o2nm_single_cluster; | ||
72 | |||
56 | u8 o2nm_this_node(void); | 73 | u8 o2nm_this_node(void); |
57 | 74 | ||
58 | int o2nm_configured_node_map(unsigned long *map, unsigned bytes); | 75 | int o2nm_configured_node_map(unsigned long *map, unsigned bytes); |
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index 9b3209dc0b16..457753df1ae7 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c | |||
@@ -147,6 +147,28 @@ static void o2net_listen_data_ready(struct sock *sk, int bytes); | |||
147 | static void o2net_sc_send_keep_req(struct work_struct *work); | 147 | static void o2net_sc_send_keep_req(struct work_struct *work); |
148 | static void o2net_idle_timer(unsigned long data); | 148 | static void o2net_idle_timer(unsigned long data); |
149 | static void o2net_sc_postpone_idle(struct o2net_sock_container *sc); | 149 | static void o2net_sc_postpone_idle(struct o2net_sock_container *sc); |
150 | static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc); | ||
151 | |||
152 | /* | ||
153 | * FIXME: These should use to_o2nm_cluster_from_node(), but we end up | ||
154 | * losing our parent link to the cluster during shutdown. This can be | ||
155 | * solved by adding a pre-removal callback to configfs, or passing | ||
156 | * around the cluster with the node. -jeffm | ||
157 | */ | ||
158 | static inline int o2net_reconnect_delay(struct o2nm_node *node) | ||
159 | { | ||
160 | return o2nm_single_cluster->cl_reconnect_delay_ms; | ||
161 | } | ||
162 | |||
163 | static inline int o2net_keepalive_delay(struct o2nm_node *node) | ||
164 | { | ||
165 | return o2nm_single_cluster->cl_keepalive_delay_ms; | ||
166 | } | ||
167 | |||
168 | static inline int o2net_idle_timeout(struct o2nm_node *node) | ||
169 | { | ||
170 | return o2nm_single_cluster->cl_idle_timeout_ms; | ||
171 | } | ||
150 | 172 | ||
151 | static inline int o2net_sys_err_to_errno(enum o2net_system_error err) | 173 | static inline int o2net_sys_err_to_errno(enum o2net_system_error err) |
152 | { | 174 | { |
@@ -271,6 +293,8 @@ static void sc_kref_release(struct kref *kref) | |||
271 | { | 293 | { |
272 | struct o2net_sock_container *sc = container_of(kref, | 294 | struct o2net_sock_container *sc = container_of(kref, |
273 | struct o2net_sock_container, sc_kref); | 295 | struct o2net_sock_container, sc_kref); |
296 | BUG_ON(timer_pending(&sc->sc_idle_timeout)); | ||
297 | |||
274 | sclog(sc, "releasing\n"); | 298 | sclog(sc, "releasing\n"); |
275 | 299 | ||
276 | if (sc->sc_sock) { | 300 | if (sc->sc_sock) { |
@@ -356,6 +380,13 @@ static void o2net_sc_cancel_delayed_work(struct o2net_sock_container *sc, | |||
356 | sc_put(sc); | 380 | sc_put(sc); |
357 | } | 381 | } |
358 | 382 | ||
383 | static atomic_t o2net_connected_peers = ATOMIC_INIT(0); | ||
384 | |||
385 | int o2net_num_connected_peers(void) | ||
386 | { | ||
387 | return atomic_read(&o2net_connected_peers); | ||
388 | } | ||
389 | |||
359 | static void o2net_set_nn_state(struct o2net_node *nn, | 390 | static void o2net_set_nn_state(struct o2net_node *nn, |
360 | struct o2net_sock_container *sc, | 391 | struct o2net_sock_container *sc, |
361 | unsigned valid, int err) | 392 | unsigned valid, int err) |
@@ -366,6 +397,11 @@ static void o2net_set_nn_state(struct o2net_node *nn, | |||
366 | 397 | ||
367 | assert_spin_locked(&nn->nn_lock); | 398 | assert_spin_locked(&nn->nn_lock); |
368 | 399 | ||
400 | if (old_sc && !sc) | ||
401 | atomic_dec(&o2net_connected_peers); | ||
402 | else if (!old_sc && sc) | ||
403 | atomic_inc(&o2net_connected_peers); | ||
404 | |||
369 | /* the node num comparison and single connect/accept path should stop | 405 | /* the node num comparison and single connect/accept path should stop |
370 | * an non-null sc from being overwritten with another */ | 406 | * an non-null sc from being overwritten with another */ |
371 | BUG_ON(sc && nn->nn_sc && nn->nn_sc != sc); | 407 | BUG_ON(sc && nn->nn_sc && nn->nn_sc != sc); |
@@ -424,9 +460,9 @@ static void o2net_set_nn_state(struct o2net_node *nn, | |||
424 | /* delay if we're withing a RECONNECT_DELAY of the | 460 | /* delay if we're withing a RECONNECT_DELAY of the |
425 | * last attempt */ | 461 | * last attempt */ |
426 | delay = (nn->nn_last_connect_attempt + | 462 | delay = (nn->nn_last_connect_attempt + |
427 | msecs_to_jiffies(O2NET_RECONNECT_DELAY_MS)) | 463 | msecs_to_jiffies(o2net_reconnect_delay(sc->sc_node))) |
428 | - jiffies; | 464 | - jiffies; |
429 | if (delay > msecs_to_jiffies(O2NET_RECONNECT_DELAY_MS)) | 465 | if (delay > msecs_to_jiffies(o2net_reconnect_delay(sc->sc_node))) |
430 | delay = 0; | 466 | delay = 0; |
431 | mlog(ML_CONN, "queueing conn attempt in %lu jiffies\n", delay); | 467 | mlog(ML_CONN, "queueing conn attempt in %lu jiffies\n", delay); |
432 | queue_delayed_work(o2net_wq, &nn->nn_connect_work, delay); | 468 | queue_delayed_work(o2net_wq, &nn->nn_connect_work, delay); |
@@ -1099,13 +1135,51 @@ static int o2net_check_handshake(struct o2net_sock_container *sc) | |||
1099 | return -1; | 1135 | return -1; |
1100 | } | 1136 | } |
1101 | 1137 | ||
1138 | /* | ||
1139 | * Ensure timeouts are consistent with other nodes, otherwise | ||
1140 | * we can end up with one node thinking that the other must be down, | ||
1141 | * but isn't. This can ultimately cause corruption. | ||
1142 | */ | ||
1143 | if (be32_to_cpu(hand->o2net_idle_timeout_ms) != | ||
1144 | o2net_idle_timeout(sc->sc_node)) { | ||
1145 | mlog(ML_NOTICE, SC_NODEF_FMT " uses a network idle timeout of " | ||
1146 | "%u ms, but we use %u ms locally. disconnecting\n", | ||
1147 | SC_NODEF_ARGS(sc), | ||
1148 | be32_to_cpu(hand->o2net_idle_timeout_ms), | ||
1149 | o2net_idle_timeout(sc->sc_node)); | ||
1150 | o2net_ensure_shutdown(nn, sc, -ENOTCONN); | ||
1151 | return -1; | ||
1152 | } | ||
1153 | |||
1154 | if (be32_to_cpu(hand->o2net_keepalive_delay_ms) != | ||
1155 | o2net_keepalive_delay(sc->sc_node)) { | ||
1156 | mlog(ML_NOTICE, SC_NODEF_FMT " uses a keepalive delay of " | ||
1157 | "%u ms, but we use %u ms locally. disconnecting\n", | ||
1158 | SC_NODEF_ARGS(sc), | ||
1159 | be32_to_cpu(hand->o2net_keepalive_delay_ms), | ||
1160 | o2net_keepalive_delay(sc->sc_node)); | ||
1161 | o2net_ensure_shutdown(nn, sc, -ENOTCONN); | ||
1162 | return -1; | ||
1163 | } | ||
1164 | |||
1165 | if (be32_to_cpu(hand->o2hb_heartbeat_timeout_ms) != | ||
1166 | O2HB_MAX_WRITE_TIMEOUT_MS) { | ||
1167 | mlog(ML_NOTICE, SC_NODEF_FMT " uses a heartbeat timeout of " | ||
1168 | "%u ms, but we use %u ms locally. disconnecting\n", | ||
1169 | SC_NODEF_ARGS(sc), | ||
1170 | be32_to_cpu(hand->o2hb_heartbeat_timeout_ms), | ||
1171 | O2HB_MAX_WRITE_TIMEOUT_MS); | ||
1172 | o2net_ensure_shutdown(nn, sc, -ENOTCONN); | ||
1173 | return -1; | ||
1174 | } | ||
1175 | |||
1102 | sc->sc_handshake_ok = 1; | 1176 | sc->sc_handshake_ok = 1; |
1103 | 1177 | ||
1104 | spin_lock(&nn->nn_lock); | 1178 | spin_lock(&nn->nn_lock); |
1105 | /* set valid and queue the idle timers only if it hasn't been | 1179 | /* set valid and queue the idle timers only if it hasn't been |
1106 | * shut down already */ | 1180 | * shut down already */ |
1107 | if (nn->nn_sc == sc) { | 1181 | if (nn->nn_sc == sc) { |
1108 | o2net_sc_postpone_idle(sc); | 1182 | o2net_sc_reset_idle_timer(sc); |
1109 | o2net_set_nn_state(nn, sc, 1, 0); | 1183 | o2net_set_nn_state(nn, sc, 1, 0); |
1110 | } | 1184 | } |
1111 | spin_unlock(&nn->nn_lock); | 1185 | spin_unlock(&nn->nn_lock); |
@@ -1131,6 +1205,23 @@ static int o2net_advance_rx(struct o2net_sock_container *sc) | |||
1131 | sclog(sc, "receiving\n"); | 1205 | sclog(sc, "receiving\n"); |
1132 | do_gettimeofday(&sc->sc_tv_advance_start); | 1206 | do_gettimeofday(&sc->sc_tv_advance_start); |
1133 | 1207 | ||
1208 | if (unlikely(sc->sc_handshake_ok == 0)) { | ||
1209 | if(sc->sc_page_off < sizeof(struct o2net_handshake)) { | ||
1210 | data = page_address(sc->sc_page) + sc->sc_page_off; | ||
1211 | datalen = sizeof(struct o2net_handshake) - sc->sc_page_off; | ||
1212 | ret = o2net_recv_tcp_msg(sc->sc_sock, data, datalen); | ||
1213 | if (ret > 0) | ||
1214 | sc->sc_page_off += ret; | ||
1215 | } | ||
1216 | |||
1217 | if (sc->sc_page_off == sizeof(struct o2net_handshake)) { | ||
1218 | o2net_check_handshake(sc); | ||
1219 | if (unlikely(sc->sc_handshake_ok == 0)) | ||
1220 | ret = -EPROTO; | ||
1221 | } | ||
1222 | goto out; | ||
1223 | } | ||
1224 | |||
1134 | /* do we need more header? */ | 1225 | /* do we need more header? */ |
1135 | if (sc->sc_page_off < sizeof(struct o2net_msg)) { | 1226 | if (sc->sc_page_off < sizeof(struct o2net_msg)) { |
1136 | data = page_address(sc->sc_page) + sc->sc_page_off; | 1227 | data = page_address(sc->sc_page) + sc->sc_page_off; |
@@ -1138,15 +1229,6 @@ static int o2net_advance_rx(struct o2net_sock_container *sc) | |||
1138 | ret = o2net_recv_tcp_msg(sc->sc_sock, data, datalen); | 1229 | ret = o2net_recv_tcp_msg(sc->sc_sock, data, datalen); |
1139 | if (ret > 0) { | 1230 | if (ret > 0) { |
1140 | sc->sc_page_off += ret; | 1231 | sc->sc_page_off += ret; |
1141 | |||
1142 | /* this working relies on the handshake being | ||
1143 | * smaller than the normal message header */ | ||
1144 | if (sc->sc_page_off >= sizeof(struct o2net_handshake)&& | ||
1145 | !sc->sc_handshake_ok && o2net_check_handshake(sc)) { | ||
1146 | ret = -EPROTO; | ||
1147 | goto out; | ||
1148 | } | ||
1149 | |||
1150 | /* only swab incoming here.. we can | 1232 | /* only swab incoming here.. we can |
1151 | * only get here once as we cross from | 1233 | * only get here once as we cross from |
1152 | * being under to over */ | 1234 | * being under to over */ |
@@ -1248,6 +1330,18 @@ static int o2net_set_nodelay(struct socket *sock) | |||
1248 | return ret; | 1330 | return ret; |
1249 | } | 1331 | } |
1250 | 1332 | ||
1333 | static void o2net_initialize_handshake(void) | ||
1334 | { | ||
1335 | o2net_hand->o2hb_heartbeat_timeout_ms = cpu_to_be32( | ||
1336 | O2HB_MAX_WRITE_TIMEOUT_MS); | ||
1337 | o2net_hand->o2net_idle_timeout_ms = cpu_to_be32( | ||
1338 | o2net_idle_timeout(NULL)); | ||
1339 | o2net_hand->o2net_keepalive_delay_ms = cpu_to_be32( | ||
1340 | o2net_keepalive_delay(NULL)); | ||
1341 | o2net_hand->o2net_reconnect_delay_ms = cpu_to_be32( | ||
1342 | o2net_reconnect_delay(NULL)); | ||
1343 | } | ||
1344 | |||
1251 | /* ------------------------------------------------------------ */ | 1345 | /* ------------------------------------------------------------ */ |
1252 | 1346 | ||
1253 | /* called when a connect completes and after a sock is accepted. the | 1347 | /* called when a connect completes and after a sock is accepted. the |
@@ -1262,6 +1356,7 @@ static void o2net_sc_connect_completed(struct work_struct *work) | |||
1262 | (unsigned long long)O2NET_PROTOCOL_VERSION, | 1356 | (unsigned long long)O2NET_PROTOCOL_VERSION, |
1263 | (unsigned long long)be64_to_cpu(o2net_hand->connector_id)); | 1357 | (unsigned long long)be64_to_cpu(o2net_hand->connector_id)); |
1264 | 1358 | ||
1359 | o2net_initialize_handshake(); | ||
1265 | o2net_sendpage(sc, o2net_hand, sizeof(*o2net_hand)); | 1360 | o2net_sendpage(sc, o2net_hand, sizeof(*o2net_hand)); |
1266 | sc_put(sc); | 1361 | sc_put(sc); |
1267 | } | 1362 | } |
@@ -1287,8 +1382,10 @@ static void o2net_idle_timer(unsigned long data) | |||
1287 | 1382 | ||
1288 | do_gettimeofday(&now); | 1383 | do_gettimeofday(&now); |
1289 | 1384 | ||
1290 | printk(KERN_INFO "o2net: connection to " SC_NODEF_FMT " has been idle for 10 " | 1385 | printk(KERN_INFO "o2net: connection to " SC_NODEF_FMT " has been idle for %u.%u " |
1291 | "seconds, shutting it down.\n", SC_NODEF_ARGS(sc)); | 1386 | "seconds, shutting it down.\n", SC_NODEF_ARGS(sc), |
1387 | o2net_idle_timeout(sc->sc_node) / 1000, | ||
1388 | o2net_idle_timeout(sc->sc_node) % 1000); | ||
1292 | mlog(ML_NOTICE, "here are some times that might help debug the " | 1389 | mlog(ML_NOTICE, "here are some times that might help debug the " |
1293 | "situation: (tmr %ld.%ld now %ld.%ld dr %ld.%ld adv " | 1390 | "situation: (tmr %ld.%ld now %ld.%ld dr %ld.%ld adv " |
1294 | "%ld.%ld:%ld.%ld func (%08x:%u) %ld.%ld:%ld.%ld)\n", | 1391 | "%ld.%ld:%ld.%ld func (%08x:%u) %ld.%ld:%ld.%ld)\n", |
@@ -1306,14 +1403,21 @@ static void o2net_idle_timer(unsigned long data) | |||
1306 | o2net_sc_queue_work(sc, &sc->sc_shutdown_work); | 1403 | o2net_sc_queue_work(sc, &sc->sc_shutdown_work); |
1307 | } | 1404 | } |
1308 | 1405 | ||
1309 | static void o2net_sc_postpone_idle(struct o2net_sock_container *sc) | 1406 | static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc) |
1310 | { | 1407 | { |
1311 | o2net_sc_cancel_delayed_work(sc, &sc->sc_keepalive_work); | 1408 | o2net_sc_cancel_delayed_work(sc, &sc->sc_keepalive_work); |
1312 | o2net_sc_queue_delayed_work(sc, &sc->sc_keepalive_work, | 1409 | o2net_sc_queue_delayed_work(sc, &sc->sc_keepalive_work, |
1313 | O2NET_KEEPALIVE_DELAY_SECS * HZ); | 1410 | msecs_to_jiffies(o2net_keepalive_delay(sc->sc_node))); |
1314 | do_gettimeofday(&sc->sc_tv_timer); | 1411 | do_gettimeofday(&sc->sc_tv_timer); |
1315 | mod_timer(&sc->sc_idle_timeout, | 1412 | mod_timer(&sc->sc_idle_timeout, |
1316 | jiffies + (O2NET_IDLE_TIMEOUT_SECS * HZ)); | 1413 | jiffies + msecs_to_jiffies(o2net_idle_timeout(sc->sc_node))); |
1414 | } | ||
1415 | |||
1416 | static void o2net_sc_postpone_idle(struct o2net_sock_container *sc) | ||
1417 | { | ||
1418 | /* Only push out an existing timer */ | ||
1419 | if (timer_pending(&sc->sc_idle_timeout)) | ||
1420 | o2net_sc_reset_idle_timer(sc); | ||
1317 | } | 1421 | } |
1318 | 1422 | ||
1319 | /* this work func is kicked whenever a path sets the nn state which doesn't | 1423 | /* this work func is kicked whenever a path sets the nn state which doesn't |
@@ -1435,9 +1539,12 @@ static void o2net_connect_expired(struct work_struct *work) | |||
1435 | 1539 | ||
1436 | spin_lock(&nn->nn_lock); | 1540 | spin_lock(&nn->nn_lock); |
1437 | if (!nn->nn_sc_valid) { | 1541 | if (!nn->nn_sc_valid) { |
1542 | struct o2nm_node *node = nn->nn_sc->sc_node; | ||
1438 | mlog(ML_ERROR, "no connection established with node %u after " | 1543 | mlog(ML_ERROR, "no connection established with node %u after " |
1439 | "%u seconds, giving up and returning errors.\n", | 1544 | "%u.%u seconds, giving up and returning errors.\n", |
1440 | o2net_num_from_nn(nn), O2NET_IDLE_TIMEOUT_SECS); | 1545 | o2net_num_from_nn(nn), |
1546 | o2net_idle_timeout(node) / 1000, | ||
1547 | o2net_idle_timeout(node) % 1000); | ||
1441 | 1548 | ||
1442 | o2net_set_nn_state(nn, NULL, 0, -ENOTCONN); | 1549 | o2net_set_nn_state(nn, NULL, 0, -ENOTCONN); |
1443 | } | 1550 | } |
@@ -1478,6 +1585,8 @@ static void o2net_hb_node_down_cb(struct o2nm_node *node, int node_num, | |||
1478 | 1585 | ||
1479 | if (node_num != o2nm_this_node()) | 1586 | if (node_num != o2nm_this_node()) |
1480 | o2net_disconnect_node(node); | 1587 | o2net_disconnect_node(node); |
1588 | |||
1589 | BUG_ON(atomic_read(&o2net_connected_peers) < 0); | ||
1481 | } | 1590 | } |
1482 | 1591 | ||
1483 | static void o2net_hb_node_up_cb(struct o2nm_node *node, int node_num, | 1592 | static void o2net_hb_node_up_cb(struct o2nm_node *node, int node_num, |
@@ -1489,14 +1598,14 @@ static void o2net_hb_node_up_cb(struct o2nm_node *node, int node_num, | |||
1489 | 1598 | ||
1490 | /* ensure an immediate connect attempt */ | 1599 | /* ensure an immediate connect attempt */ |
1491 | nn->nn_last_connect_attempt = jiffies - | 1600 | nn->nn_last_connect_attempt = jiffies - |
1492 | (msecs_to_jiffies(O2NET_RECONNECT_DELAY_MS) + 1); | 1601 | (msecs_to_jiffies(o2net_reconnect_delay(node)) + 1); |
1493 | 1602 | ||
1494 | if (node_num != o2nm_this_node()) { | 1603 | if (node_num != o2nm_this_node()) { |
1495 | /* heartbeat doesn't work unless a local node number is | 1604 | /* heartbeat doesn't work unless a local node number is |
1496 | * configured and doing so brings up the o2net_wq, so we can | 1605 | * configured and doing so brings up the o2net_wq, so we can |
1497 | * use it.. */ | 1606 | * use it.. */ |
1498 | queue_delayed_work(o2net_wq, &nn->nn_connect_expired, | 1607 | queue_delayed_work(o2net_wq, &nn->nn_connect_expired, |
1499 | O2NET_IDLE_TIMEOUT_SECS * HZ); | 1608 | msecs_to_jiffies(o2net_idle_timeout(node))); |
1500 | 1609 | ||
1501 | /* believe it or not, accept and node hearbeating testing | 1610 | /* believe it or not, accept and node hearbeating testing |
1502 | * can succeed for this node before we got here.. so | 1611 | * can succeed for this node before we got here.. so |
@@ -1641,6 +1750,7 @@ static int o2net_accept_one(struct socket *sock) | |||
1641 | o2net_register_callbacks(sc->sc_sock->sk, sc); | 1750 | o2net_register_callbacks(sc->sc_sock->sk, sc); |
1642 | o2net_sc_queue_work(sc, &sc->sc_rx_work); | 1751 | o2net_sc_queue_work(sc, &sc->sc_rx_work); |
1643 | 1752 | ||
1753 | o2net_initialize_handshake(); | ||
1644 | o2net_sendpage(sc, o2net_hand, sizeof(*o2net_hand)); | 1754 | o2net_sendpage(sc, o2net_hand, sizeof(*o2net_hand)); |
1645 | 1755 | ||
1646 | out: | 1756 | out: |
diff --git a/fs/ocfs2/cluster/tcp.h b/fs/ocfs2/cluster/tcp.h index 616ff2b8434a..21a4e43df836 100644 --- a/fs/ocfs2/cluster/tcp.h +++ b/fs/ocfs2/cluster/tcp.h | |||
@@ -54,6 +54,13 @@ typedef int (o2net_msg_handler_func)(struct o2net_msg *msg, u32 len, void *data) | |||
54 | 54 | ||
55 | #define O2NET_MAX_PAYLOAD_BYTES (4096 - sizeof(struct o2net_msg)) | 55 | #define O2NET_MAX_PAYLOAD_BYTES (4096 - sizeof(struct o2net_msg)) |
56 | 56 | ||
57 | /* same as hb delay, we're waiting for another node to recognize our hb */ | ||
58 | #define O2NET_RECONNECT_DELAY_MS_DEFAULT 2000 | ||
59 | |||
60 | #define O2NET_KEEPALIVE_DELAY_MS_DEFAULT 5000 | ||
61 | #define O2NET_IDLE_TIMEOUT_MS_DEFAULT 10000 | ||
62 | |||
63 | |||
57 | /* TODO: figure this out.... */ | 64 | /* TODO: figure this out.... */ |
58 | static inline int o2net_link_down(int err, struct socket *sock) | 65 | static inline int o2net_link_down(int err, struct socket *sock) |
59 | { | 66 | { |
@@ -101,6 +108,7 @@ void o2net_unregister_hb_callbacks(void); | |||
101 | int o2net_start_listening(struct o2nm_node *node); | 108 | int o2net_start_listening(struct o2nm_node *node); |
102 | void o2net_stop_listening(struct o2nm_node *node); | 109 | void o2net_stop_listening(struct o2nm_node *node); |
103 | void o2net_disconnect_node(struct o2nm_node *node); | 110 | void o2net_disconnect_node(struct o2nm_node *node); |
111 | int o2net_num_connected_peers(void); | ||
104 | 112 | ||
105 | int o2net_init(void); | 113 | int o2net_init(void); |
106 | void o2net_exit(void); | 114 | void o2net_exit(void); |
diff --git a/fs/ocfs2/cluster/tcp_internal.h b/fs/ocfs2/cluster/tcp_internal.h index daebbd3a2c8c..b700dc9624d1 100644 --- a/fs/ocfs2/cluster/tcp_internal.h +++ b/fs/ocfs2/cluster/tcp_internal.h | |||
@@ -27,23 +27,20 @@ | |||
27 | #define O2NET_MSG_KEEP_REQ_MAGIC ((u16)0xfa57) | 27 | #define O2NET_MSG_KEEP_REQ_MAGIC ((u16)0xfa57) |
28 | #define O2NET_MSG_KEEP_RESP_MAGIC ((u16)0xfa58) | 28 | #define O2NET_MSG_KEEP_RESP_MAGIC ((u16)0xfa58) |
29 | 29 | ||
30 | /* same as hb delay, we're waiting for another node to recognize our hb */ | ||
31 | #define O2NET_RECONNECT_DELAY_MS O2HB_REGION_TIMEOUT_MS | ||
32 | |||
33 | /* we're delaying our quorum decision so that heartbeat will have timed | 30 | /* we're delaying our quorum decision so that heartbeat will have timed |
34 | * out truly dead nodes by the time we come around to making decisions | 31 | * out truly dead nodes by the time we come around to making decisions |
35 | * on their number */ | 32 | * on their number */ |
36 | #define O2NET_QUORUM_DELAY_MS ((o2hb_dead_threshold + 2) * O2HB_REGION_TIMEOUT_MS) | 33 | #define O2NET_QUORUM_DELAY_MS ((o2hb_dead_threshold + 2) * O2HB_REGION_TIMEOUT_MS) |
37 | 34 | ||
38 | #define O2NET_KEEPALIVE_DELAY_SECS 5 | ||
39 | #define O2NET_IDLE_TIMEOUT_SECS 10 | ||
40 | |||
41 | /* | 35 | /* |
42 | * This version number represents quite a lot, unfortunately. It not | 36 | * This version number represents quite a lot, unfortunately. It not |
43 | * only represents the raw network message protocol on the wire but also | 37 | * only represents the raw network message protocol on the wire but also |
44 | * locking semantics of the file system using the protocol. It should | 38 | * locking semantics of the file system using the protocol. It should |
45 | * be somewhere else, I'm sure, but right now it isn't. | 39 | * be somewhere else, I'm sure, but right now it isn't. |
46 | * | 40 | * |
41 | * New in version 5: | ||
42 | * - Network timeout checking protocol | ||
43 | * | ||
47 | * New in version 4: | 44 | * New in version 4: |
48 | * - Remove i_generation from lock names for better stat performance. | 45 | * - Remove i_generation from lock names for better stat performance. |
49 | * | 46 | * |
@@ -54,10 +51,14 @@ | |||
54 | * - full 64 bit i_size in the metadata lock lvbs | 51 | * - full 64 bit i_size in the metadata lock lvbs |
55 | * - introduction of "rw" lock and pushing meta/data locking down | 52 | * - introduction of "rw" lock and pushing meta/data locking down |
56 | */ | 53 | */ |
57 | #define O2NET_PROTOCOL_VERSION 4ULL | 54 | #define O2NET_PROTOCOL_VERSION 5ULL |
58 | struct o2net_handshake { | 55 | struct o2net_handshake { |
59 | __be64 protocol_version; | 56 | __be64 protocol_version; |
60 | __be64 connector_id; | 57 | __be64 connector_id; |
58 | __be32 o2hb_heartbeat_timeout_ms; | ||
59 | __be32 o2net_idle_timeout_ms; | ||
60 | __be32 o2net_keepalive_delay_ms; | ||
61 | __be32 o2net_reconnect_delay_ms; | ||
61 | }; | 62 | }; |
62 | 63 | ||
63 | struct o2net_node { | 64 | struct o2net_node { |
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index 69fba16efbd1..e6220137bf69 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c | |||
@@ -770,7 +770,7 @@ static int ocfs2_lock_create(struct ocfs2_super *osb, | |||
770 | int dlm_flags) | 770 | int dlm_flags) |
771 | { | 771 | { |
772 | int ret = 0; | 772 | int ret = 0; |
773 | enum dlm_status status; | 773 | enum dlm_status status = DLM_NORMAL; |
774 | unsigned long flags; | 774 | unsigned long flags; |
775 | 775 | ||
776 | mlog_entry_void(); | 776 | mlog_entry_void(); |
@@ -1138,6 +1138,7 @@ int ocfs2_rw_lock(struct inode *inode, int write) | |||
1138 | { | 1138 | { |
1139 | int status, level; | 1139 | int status, level; |
1140 | struct ocfs2_lock_res *lockres; | 1140 | struct ocfs2_lock_res *lockres; |
1141 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | ||
1141 | 1142 | ||
1142 | BUG_ON(!inode); | 1143 | BUG_ON(!inode); |
1143 | 1144 | ||
@@ -1147,6 +1148,9 @@ int ocfs2_rw_lock(struct inode *inode, int write) | |||
1147 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | 1148 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
1148 | write ? "EXMODE" : "PRMODE"); | 1149 | write ? "EXMODE" : "PRMODE"); |
1149 | 1150 | ||
1151 | if (ocfs2_mount_local(osb)) | ||
1152 | return 0; | ||
1153 | |||
1150 | lockres = &OCFS2_I(inode)->ip_rw_lockres; | 1154 | lockres = &OCFS2_I(inode)->ip_rw_lockres; |
1151 | 1155 | ||
1152 | level = write ? LKM_EXMODE : LKM_PRMODE; | 1156 | level = write ? LKM_EXMODE : LKM_PRMODE; |
@@ -1164,6 +1168,7 @@ void ocfs2_rw_unlock(struct inode *inode, int write) | |||
1164 | { | 1168 | { |
1165 | int level = write ? LKM_EXMODE : LKM_PRMODE; | 1169 | int level = write ? LKM_EXMODE : LKM_PRMODE; |
1166 | struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_rw_lockres; | 1170 | struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_rw_lockres; |
1171 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | ||
1167 | 1172 | ||
1168 | mlog_entry_void(); | 1173 | mlog_entry_void(); |
1169 | 1174 | ||
@@ -1171,7 +1176,8 @@ void ocfs2_rw_unlock(struct inode *inode, int write) | |||
1171 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | 1176 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
1172 | write ? "EXMODE" : "PRMODE"); | 1177 | write ? "EXMODE" : "PRMODE"); |
1173 | 1178 | ||
1174 | ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level); | 1179 | if (!ocfs2_mount_local(osb)) |
1180 | ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level); | ||
1175 | 1181 | ||
1176 | mlog_exit_void(); | 1182 | mlog_exit_void(); |
1177 | } | 1183 | } |
@@ -1182,6 +1188,7 @@ int ocfs2_data_lock_full(struct inode *inode, | |||
1182 | { | 1188 | { |
1183 | int status = 0, level; | 1189 | int status = 0, level; |
1184 | struct ocfs2_lock_res *lockres; | 1190 | struct ocfs2_lock_res *lockres; |
1191 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | ||
1185 | 1192 | ||
1186 | BUG_ON(!inode); | 1193 | BUG_ON(!inode); |
1187 | 1194 | ||
@@ -1201,6 +1208,9 @@ int ocfs2_data_lock_full(struct inode *inode, | |||
1201 | goto out; | 1208 | goto out; |
1202 | } | 1209 | } |
1203 | 1210 | ||
1211 | if (ocfs2_mount_local(osb)) | ||
1212 | goto out; | ||
1213 | |||
1204 | lockres = &OCFS2_I(inode)->ip_data_lockres; | 1214 | lockres = &OCFS2_I(inode)->ip_data_lockres; |
1205 | 1215 | ||
1206 | level = write ? LKM_EXMODE : LKM_PRMODE; | 1216 | level = write ? LKM_EXMODE : LKM_PRMODE; |
@@ -1269,6 +1279,7 @@ void ocfs2_data_unlock(struct inode *inode, | |||
1269 | { | 1279 | { |
1270 | int level = write ? LKM_EXMODE : LKM_PRMODE; | 1280 | int level = write ? LKM_EXMODE : LKM_PRMODE; |
1271 | struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_data_lockres; | 1281 | struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_data_lockres; |
1282 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | ||
1272 | 1283 | ||
1273 | mlog_entry_void(); | 1284 | mlog_entry_void(); |
1274 | 1285 | ||
@@ -1276,7 +1287,8 @@ void ocfs2_data_unlock(struct inode *inode, | |||
1276 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | 1287 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
1277 | write ? "EXMODE" : "PRMODE"); | 1288 | write ? "EXMODE" : "PRMODE"); |
1278 | 1289 | ||
1279 | if (!ocfs2_is_hard_readonly(OCFS2_SB(inode->i_sb))) | 1290 | if (!ocfs2_is_hard_readonly(OCFS2_SB(inode->i_sb)) && |
1291 | !ocfs2_mount_local(osb)) | ||
1280 | ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level); | 1292 | ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level); |
1281 | 1293 | ||
1282 | mlog_exit_void(); | 1294 | mlog_exit_void(); |
@@ -1467,8 +1479,9 @@ static int ocfs2_meta_lock_update(struct inode *inode, | |||
1467 | { | 1479 | { |
1468 | int status = 0; | 1480 | int status = 0; |
1469 | struct ocfs2_inode_info *oi = OCFS2_I(inode); | 1481 | struct ocfs2_inode_info *oi = OCFS2_I(inode); |
1470 | struct ocfs2_lock_res *lockres; | 1482 | struct ocfs2_lock_res *lockres = NULL; |
1471 | struct ocfs2_dinode *fe; | 1483 | struct ocfs2_dinode *fe; |
1484 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | ||
1472 | 1485 | ||
1473 | mlog_entry_void(); | 1486 | mlog_entry_void(); |
1474 | 1487 | ||
@@ -1483,10 +1496,12 @@ static int ocfs2_meta_lock_update(struct inode *inode, | |||
1483 | } | 1496 | } |
1484 | spin_unlock(&oi->ip_lock); | 1497 | spin_unlock(&oi->ip_lock); |
1485 | 1498 | ||
1486 | lockres = &oi->ip_meta_lockres; | 1499 | if (!ocfs2_mount_local(osb)) { |
1500 | lockres = &oi->ip_meta_lockres; | ||
1487 | 1501 | ||
1488 | if (!ocfs2_should_refresh_lock_res(lockres)) | 1502 | if (!ocfs2_should_refresh_lock_res(lockres)) |
1489 | goto bail; | 1503 | goto bail; |
1504 | } | ||
1490 | 1505 | ||
1491 | /* This will discard any caching information we might have had | 1506 | /* This will discard any caching information we might have had |
1492 | * for the inode metadata. */ | 1507 | * for the inode metadata. */ |
@@ -1496,7 +1511,7 @@ static int ocfs2_meta_lock_update(struct inode *inode, | |||
1496 | * map (directories, bitmap files, etc) */ | 1511 | * map (directories, bitmap files, etc) */ |
1497 | ocfs2_extent_map_trunc(inode, 0); | 1512 | ocfs2_extent_map_trunc(inode, 0); |
1498 | 1513 | ||
1499 | if (ocfs2_meta_lvb_is_trustable(inode, lockres)) { | 1514 | if (lockres && ocfs2_meta_lvb_is_trustable(inode, lockres)) { |
1500 | mlog(0, "Trusting LVB on inode %llu\n", | 1515 | mlog(0, "Trusting LVB on inode %llu\n", |
1501 | (unsigned long long)oi->ip_blkno); | 1516 | (unsigned long long)oi->ip_blkno); |
1502 | ocfs2_refresh_inode_from_lvb(inode); | 1517 | ocfs2_refresh_inode_from_lvb(inode); |
@@ -1543,7 +1558,8 @@ static int ocfs2_meta_lock_update(struct inode *inode, | |||
1543 | 1558 | ||
1544 | status = 0; | 1559 | status = 0; |
1545 | bail_refresh: | 1560 | bail_refresh: |
1546 | ocfs2_complete_lock_res_refresh(lockres, status); | 1561 | if (lockres) |
1562 | ocfs2_complete_lock_res_refresh(lockres, status); | ||
1547 | bail: | 1563 | bail: |
1548 | mlog_exit(status); | 1564 | mlog_exit(status); |
1549 | return status; | 1565 | return status; |
@@ -1585,7 +1601,7 @@ int ocfs2_meta_lock_full(struct inode *inode, | |||
1585 | int arg_flags) | 1601 | int arg_flags) |
1586 | { | 1602 | { |
1587 | int status, level, dlm_flags, acquired; | 1603 | int status, level, dlm_flags, acquired; |
1588 | struct ocfs2_lock_res *lockres; | 1604 | struct ocfs2_lock_res *lockres = NULL; |
1589 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 1605 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
1590 | struct buffer_head *local_bh = NULL; | 1606 | struct buffer_head *local_bh = NULL; |
1591 | 1607 | ||
@@ -1607,6 +1623,9 @@ int ocfs2_meta_lock_full(struct inode *inode, | |||
1607 | goto bail; | 1623 | goto bail; |
1608 | } | 1624 | } |
1609 | 1625 | ||
1626 | if (ocfs2_mount_local(osb)) | ||
1627 | goto local; | ||
1628 | |||
1610 | if (!(arg_flags & OCFS2_META_LOCK_RECOVERY)) | 1629 | if (!(arg_flags & OCFS2_META_LOCK_RECOVERY)) |
1611 | wait_event(osb->recovery_event, | 1630 | wait_event(osb->recovery_event, |
1612 | ocfs2_node_map_is_empty(osb, &osb->recovery_map)); | 1631 | ocfs2_node_map_is_empty(osb, &osb->recovery_map)); |
@@ -1636,6 +1655,7 @@ int ocfs2_meta_lock_full(struct inode *inode, | |||
1636 | wait_event(osb->recovery_event, | 1655 | wait_event(osb->recovery_event, |
1637 | ocfs2_node_map_is_empty(osb, &osb->recovery_map)); | 1656 | ocfs2_node_map_is_empty(osb, &osb->recovery_map)); |
1638 | 1657 | ||
1658 | local: | ||
1639 | /* | 1659 | /* |
1640 | * We only see this flag if we're being called from | 1660 | * We only see this flag if we're being called from |
1641 | * ocfs2_read_locked_inode(). It means we're locking an inode | 1661 | * ocfs2_read_locked_inode(). It means we're locking an inode |
@@ -1644,7 +1664,8 @@ int ocfs2_meta_lock_full(struct inode *inode, | |||
1644 | */ | 1664 | */ |
1645 | if (inode->i_state & I_NEW) { | 1665 | if (inode->i_state & I_NEW) { |
1646 | status = 0; | 1666 | status = 0; |
1647 | ocfs2_complete_lock_res_refresh(lockres, 0); | 1667 | if (lockres) |
1668 | ocfs2_complete_lock_res_refresh(lockres, 0); | ||
1648 | goto bail; | 1669 | goto bail; |
1649 | } | 1670 | } |
1650 | 1671 | ||
@@ -1767,6 +1788,7 @@ void ocfs2_meta_unlock(struct inode *inode, | |||
1767 | { | 1788 | { |
1768 | int level = ex ? LKM_EXMODE : LKM_PRMODE; | 1789 | int level = ex ? LKM_EXMODE : LKM_PRMODE; |
1769 | struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_meta_lockres; | 1790 | struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_meta_lockres; |
1791 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | ||
1770 | 1792 | ||
1771 | mlog_entry_void(); | 1793 | mlog_entry_void(); |
1772 | 1794 | ||
@@ -1774,7 +1796,8 @@ void ocfs2_meta_unlock(struct inode *inode, | |||
1774 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | 1796 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
1775 | ex ? "EXMODE" : "PRMODE"); | 1797 | ex ? "EXMODE" : "PRMODE"); |
1776 | 1798 | ||
1777 | if (!ocfs2_is_hard_readonly(OCFS2_SB(inode->i_sb))) | 1799 | if (!ocfs2_is_hard_readonly(OCFS2_SB(inode->i_sb)) && |
1800 | !ocfs2_mount_local(osb)) | ||
1778 | ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level); | 1801 | ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level); |
1779 | 1802 | ||
1780 | mlog_exit_void(); | 1803 | mlog_exit_void(); |
@@ -1783,7 +1806,7 @@ void ocfs2_meta_unlock(struct inode *inode, | |||
1783 | int ocfs2_super_lock(struct ocfs2_super *osb, | 1806 | int ocfs2_super_lock(struct ocfs2_super *osb, |
1784 | int ex) | 1807 | int ex) |
1785 | { | 1808 | { |
1786 | int status; | 1809 | int status = 0; |
1787 | int level = ex ? LKM_EXMODE : LKM_PRMODE; | 1810 | int level = ex ? LKM_EXMODE : LKM_PRMODE; |
1788 | struct ocfs2_lock_res *lockres = &osb->osb_super_lockres; | 1811 | struct ocfs2_lock_res *lockres = &osb->osb_super_lockres; |
1789 | struct buffer_head *bh; | 1812 | struct buffer_head *bh; |
@@ -1794,6 +1817,9 @@ int ocfs2_super_lock(struct ocfs2_super *osb, | |||
1794 | if (ocfs2_is_hard_readonly(osb)) | 1817 | if (ocfs2_is_hard_readonly(osb)) |
1795 | return -EROFS; | 1818 | return -EROFS; |
1796 | 1819 | ||
1820 | if (ocfs2_mount_local(osb)) | ||
1821 | goto bail; | ||
1822 | |||
1797 | status = ocfs2_cluster_lock(osb, lockres, level, 0, 0); | 1823 | status = ocfs2_cluster_lock(osb, lockres, level, 0, 0); |
1798 | if (status < 0) { | 1824 | if (status < 0) { |
1799 | mlog_errno(status); | 1825 | mlog_errno(status); |
@@ -1832,7 +1858,8 @@ void ocfs2_super_unlock(struct ocfs2_super *osb, | |||
1832 | int level = ex ? LKM_EXMODE : LKM_PRMODE; | 1858 | int level = ex ? LKM_EXMODE : LKM_PRMODE; |
1833 | struct ocfs2_lock_res *lockres = &osb->osb_super_lockres; | 1859 | struct ocfs2_lock_res *lockres = &osb->osb_super_lockres; |
1834 | 1860 | ||
1835 | ocfs2_cluster_unlock(osb, lockres, level); | 1861 | if (!ocfs2_mount_local(osb)) |
1862 | ocfs2_cluster_unlock(osb, lockres, level); | ||
1836 | } | 1863 | } |
1837 | 1864 | ||
1838 | int ocfs2_rename_lock(struct ocfs2_super *osb) | 1865 | int ocfs2_rename_lock(struct ocfs2_super *osb) |
@@ -1843,6 +1870,9 @@ int ocfs2_rename_lock(struct ocfs2_super *osb) | |||
1843 | if (ocfs2_is_hard_readonly(osb)) | 1870 | if (ocfs2_is_hard_readonly(osb)) |
1844 | return -EROFS; | 1871 | return -EROFS; |
1845 | 1872 | ||
1873 | if (ocfs2_mount_local(osb)) | ||
1874 | return 0; | ||
1875 | |||
1846 | status = ocfs2_cluster_lock(osb, lockres, LKM_EXMODE, 0, 0); | 1876 | status = ocfs2_cluster_lock(osb, lockres, LKM_EXMODE, 0, 0); |
1847 | if (status < 0) | 1877 | if (status < 0) |
1848 | mlog_errno(status); | 1878 | mlog_errno(status); |
@@ -1854,7 +1884,8 @@ void ocfs2_rename_unlock(struct ocfs2_super *osb) | |||
1854 | { | 1884 | { |
1855 | struct ocfs2_lock_res *lockres = &osb->osb_rename_lockres; | 1885 | struct ocfs2_lock_res *lockres = &osb->osb_rename_lockres; |
1856 | 1886 | ||
1857 | ocfs2_cluster_unlock(osb, lockres, LKM_EXMODE); | 1887 | if (!ocfs2_mount_local(osb)) |
1888 | ocfs2_cluster_unlock(osb, lockres, LKM_EXMODE); | ||
1858 | } | 1889 | } |
1859 | 1890 | ||
1860 | int ocfs2_dentry_lock(struct dentry *dentry, int ex) | 1891 | int ocfs2_dentry_lock(struct dentry *dentry, int ex) |
@@ -1869,6 +1900,9 @@ int ocfs2_dentry_lock(struct dentry *dentry, int ex) | |||
1869 | if (ocfs2_is_hard_readonly(osb)) | 1900 | if (ocfs2_is_hard_readonly(osb)) |
1870 | return -EROFS; | 1901 | return -EROFS; |
1871 | 1902 | ||
1903 | if (ocfs2_mount_local(osb)) | ||
1904 | return 0; | ||
1905 | |||
1872 | ret = ocfs2_cluster_lock(osb, &dl->dl_lockres, level, 0, 0); | 1906 | ret = ocfs2_cluster_lock(osb, &dl->dl_lockres, level, 0, 0); |
1873 | if (ret < 0) | 1907 | if (ret < 0) |
1874 | mlog_errno(ret); | 1908 | mlog_errno(ret); |
@@ -1882,7 +1916,8 @@ void ocfs2_dentry_unlock(struct dentry *dentry, int ex) | |||
1882 | struct ocfs2_dentry_lock *dl = dentry->d_fsdata; | 1916 | struct ocfs2_dentry_lock *dl = dentry->d_fsdata; |
1883 | struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb); | 1917 | struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb); |
1884 | 1918 | ||
1885 | ocfs2_cluster_unlock(osb, &dl->dl_lockres, level); | 1919 | if (!ocfs2_mount_local(osb)) |
1920 | ocfs2_cluster_unlock(osb, &dl->dl_lockres, level); | ||
1886 | } | 1921 | } |
1887 | 1922 | ||
1888 | /* Reference counting of the dlm debug structure. We want this because | 1923 | /* Reference counting of the dlm debug structure. We want this because |
@@ -2145,12 +2180,15 @@ static void ocfs2_dlm_shutdown_debug(struct ocfs2_super *osb) | |||
2145 | 2180 | ||
2146 | int ocfs2_dlm_init(struct ocfs2_super *osb) | 2181 | int ocfs2_dlm_init(struct ocfs2_super *osb) |
2147 | { | 2182 | { |
2148 | int status; | 2183 | int status = 0; |
2149 | u32 dlm_key; | 2184 | u32 dlm_key; |
2150 | struct dlm_ctxt *dlm; | 2185 | struct dlm_ctxt *dlm = NULL; |
2151 | 2186 | ||
2152 | mlog_entry_void(); | 2187 | mlog_entry_void(); |
2153 | 2188 | ||
2189 | if (ocfs2_mount_local(osb)) | ||
2190 | goto local; | ||
2191 | |||
2154 | status = ocfs2_dlm_init_debug(osb); | 2192 | status = ocfs2_dlm_init_debug(osb); |
2155 | if (status < 0) { | 2193 | if (status < 0) { |
2156 | mlog_errno(status); | 2194 | mlog_errno(status); |
@@ -2178,11 +2216,12 @@ int ocfs2_dlm_init(struct ocfs2_super *osb) | |||
2178 | goto bail; | 2216 | goto bail; |
2179 | } | 2217 | } |
2180 | 2218 | ||
2219 | dlm_register_eviction_cb(dlm, &osb->osb_eviction_cb); | ||
2220 | |||
2221 | local: | ||
2181 | ocfs2_super_lock_res_init(&osb->osb_super_lockres, osb); | 2222 | ocfs2_super_lock_res_init(&osb->osb_super_lockres, osb); |
2182 | ocfs2_rename_lock_res_init(&osb->osb_rename_lockres, osb); | 2223 | ocfs2_rename_lock_res_init(&osb->osb_rename_lockres, osb); |
2183 | 2224 | ||
2184 | dlm_register_eviction_cb(dlm, &osb->osb_eviction_cb); | ||
2185 | |||
2186 | osb->dlm = dlm; | 2225 | osb->dlm = dlm; |
2187 | 2226 | ||
2188 | status = 0; | 2227 | status = 0; |
diff --git a/fs/ocfs2/heartbeat.c b/fs/ocfs2/heartbeat.c index cbfd45a97a63..8fc52d6d0ce7 100644 --- a/fs/ocfs2/heartbeat.c +++ b/fs/ocfs2/heartbeat.c | |||
@@ -154,6 +154,9 @@ int ocfs2_register_hb_callbacks(struct ocfs2_super *osb) | |||
154 | { | 154 | { |
155 | int status; | 155 | int status; |
156 | 156 | ||
157 | if (ocfs2_mount_local(osb)) | ||
158 | return 0; | ||
159 | |||
157 | status = o2hb_register_callback(&osb->osb_hb_down); | 160 | status = o2hb_register_callback(&osb->osb_hb_down); |
158 | if (status < 0) { | 161 | if (status < 0) { |
159 | mlog_errno(status); | 162 | mlog_errno(status); |
@@ -172,6 +175,9 @@ void ocfs2_clear_hb_callbacks(struct ocfs2_super *osb) | |||
172 | { | 175 | { |
173 | int status; | 176 | int status; |
174 | 177 | ||
178 | if (ocfs2_mount_local(osb)) | ||
179 | return; | ||
180 | |||
175 | status = o2hb_unregister_callback(&osb->osb_hb_down); | 181 | status = o2hb_unregister_callback(&osb->osb_hb_down); |
176 | if (status < 0) | 182 | if (status < 0) |
177 | mlog_errno(status); | 183 | mlog_errno(status); |
@@ -186,6 +192,9 @@ void ocfs2_stop_heartbeat(struct ocfs2_super *osb) | |||
186 | int ret; | 192 | int ret; |
187 | char *argv[5], *envp[3]; | 193 | char *argv[5], *envp[3]; |
188 | 194 | ||
195 | if (ocfs2_mount_local(osb)) | ||
196 | return; | ||
197 | |||
189 | if (!osb->uuid_str) { | 198 | if (!osb->uuid_str) { |
190 | /* This can happen if we don't get far enough in mount... */ | 199 | /* This can happen if we don't get far enough in mount... */ |
191 | mlog(0, "No UUID with which to stop heartbeat!\n\n"); | 200 | mlog(0, "No UUID with which to stop heartbeat!\n\n"); |
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 42e361f3054f..e4d91493d7d7 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c | |||
@@ -423,7 +423,8 @@ static int ocfs2_read_locked_inode(struct inode *inode, | |||
423 | * cluster lock before trusting anything anyway. | 423 | * cluster lock before trusting anything anyway. |
424 | */ | 424 | */ |
425 | can_lock = !(args->fi_flags & OCFS2_FI_FLAG_SYSFILE) | 425 | can_lock = !(args->fi_flags & OCFS2_FI_FLAG_SYSFILE) |
426 | && !(args->fi_flags & OCFS2_FI_FLAG_NOLOCK); | 426 | && !(args->fi_flags & OCFS2_FI_FLAG_NOLOCK) |
427 | && !ocfs2_mount_local(osb); | ||
427 | 428 | ||
428 | /* | 429 | /* |
429 | * To maintain backwards compatibility with older versions of | 430 | * To maintain backwards compatibility with older versions of |
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index 1d7f4ab1e5ed..825cb0ae1b4c 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c | |||
@@ -144,8 +144,10 @@ handle_t *ocfs2_start_trans(struct ocfs2_super *osb, int max_buffs) | |||
144 | ocfs2_abort(osb->sb, "Detected aborted journal"); | 144 | ocfs2_abort(osb->sb, "Detected aborted journal"); |
145 | handle = ERR_PTR(-EROFS); | 145 | handle = ERR_PTR(-EROFS); |
146 | } | 146 | } |
147 | } else | 147 | } else { |
148 | atomic_inc(&(osb->journal->j_num_trans)); | 148 | if (!ocfs2_mount_local(osb)) |
149 | atomic_inc(&(osb->journal->j_num_trans)); | ||
150 | } | ||
149 | 151 | ||
150 | return handle; | 152 | return handle; |
151 | } | 153 | } |
@@ -507,9 +509,23 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb) | |||
507 | 509 | ||
508 | BUG_ON(atomic_read(&(osb->journal->j_num_trans)) != 0); | 510 | BUG_ON(atomic_read(&(osb->journal->j_num_trans)) != 0); |
509 | 511 | ||
510 | status = ocfs2_journal_toggle_dirty(osb, 0); | 512 | if (ocfs2_mount_local(osb)) { |
511 | if (status < 0) | 513 | journal_lock_updates(journal->j_journal); |
512 | mlog_errno(status); | 514 | status = journal_flush(journal->j_journal); |
515 | journal_unlock_updates(journal->j_journal); | ||
516 | if (status < 0) | ||
517 | mlog_errno(status); | ||
518 | } | ||
519 | |||
520 | if (status == 0) { | ||
521 | /* | ||
522 | * Do not toggle if flush was unsuccessful otherwise | ||
523 | * will leave dirty metadata in a "clean" journal | ||
524 | */ | ||
525 | status = ocfs2_journal_toggle_dirty(osb, 0); | ||
526 | if (status < 0) | ||
527 | mlog_errno(status); | ||
528 | } | ||
513 | 529 | ||
514 | /* Shutdown the kernel journal system */ | 530 | /* Shutdown the kernel journal system */ |
515 | journal_destroy(journal->j_journal); | 531 | journal_destroy(journal->j_journal); |
@@ -549,7 +565,7 @@ static void ocfs2_clear_journal_error(struct super_block *sb, | |||
549 | } | 565 | } |
550 | } | 566 | } |
551 | 567 | ||
552 | int ocfs2_journal_load(struct ocfs2_journal *journal) | 568 | int ocfs2_journal_load(struct ocfs2_journal *journal, int local) |
553 | { | 569 | { |
554 | int status = 0; | 570 | int status = 0; |
555 | struct ocfs2_super *osb; | 571 | struct ocfs2_super *osb; |
@@ -576,14 +592,18 @@ int ocfs2_journal_load(struct ocfs2_journal *journal) | |||
576 | } | 592 | } |
577 | 593 | ||
578 | /* Launch the commit thread */ | 594 | /* Launch the commit thread */ |
579 | osb->commit_task = kthread_run(ocfs2_commit_thread, osb, "ocfs2cmt"); | 595 | if (!local) { |
580 | if (IS_ERR(osb->commit_task)) { | 596 | osb->commit_task = kthread_run(ocfs2_commit_thread, osb, |
581 | status = PTR_ERR(osb->commit_task); | 597 | "ocfs2cmt"); |
598 | if (IS_ERR(osb->commit_task)) { | ||
599 | status = PTR_ERR(osb->commit_task); | ||
600 | osb->commit_task = NULL; | ||
601 | mlog(ML_ERROR, "unable to launch ocfs2commit thread, " | ||
602 | "error=%d", status); | ||
603 | goto done; | ||
604 | } | ||
605 | } else | ||
582 | osb->commit_task = NULL; | 606 | osb->commit_task = NULL; |
583 | mlog(ML_ERROR, "unable to launch ocfs2commit thread, error=%d", | ||
584 | status); | ||
585 | goto done; | ||
586 | } | ||
587 | 607 | ||
588 | done: | 608 | done: |
589 | mlog_exit(status); | 609 | mlog_exit(status); |
diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h index 899112ad8136..e1216364d191 100644 --- a/fs/ocfs2/journal.h +++ b/fs/ocfs2/journal.h | |||
@@ -157,7 +157,7 @@ int ocfs2_journal_init(struct ocfs2_journal *journal, | |||
157 | void ocfs2_journal_shutdown(struct ocfs2_super *osb); | 157 | void ocfs2_journal_shutdown(struct ocfs2_super *osb); |
158 | int ocfs2_journal_wipe(struct ocfs2_journal *journal, | 158 | int ocfs2_journal_wipe(struct ocfs2_journal *journal, |
159 | int full); | 159 | int full); |
160 | int ocfs2_journal_load(struct ocfs2_journal *journal); | 160 | int ocfs2_journal_load(struct ocfs2_journal *journal, int local); |
161 | int ocfs2_check_journals_nolocks(struct ocfs2_super *osb); | 161 | int ocfs2_check_journals_nolocks(struct ocfs2_super *osb); |
162 | void ocfs2_recovery_thread(struct ocfs2_super *osb, | 162 | void ocfs2_recovery_thread(struct ocfs2_super *osb, |
163 | int node_num); | 163 | int node_num); |
@@ -174,6 +174,9 @@ static inline void ocfs2_checkpoint_inode(struct inode *inode) | |||
174 | { | 174 | { |
175 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 175 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
176 | 176 | ||
177 | if (ocfs2_mount_local(osb)) | ||
178 | return; | ||
179 | |||
177 | if (!ocfs2_inode_fully_checkpointed(inode)) { | 180 | if (!ocfs2_inode_fully_checkpointed(inode)) { |
178 | /* WARNING: This only kicks off a single | 181 | /* WARNING: This only kicks off a single |
179 | * checkpoint. If someone races you and adds more | 182 | * checkpoint. If someone races you and adds more |
diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c index 69f85ae392dc..51b020447683 100644 --- a/fs/ocfs2/mmap.c +++ b/fs/ocfs2/mmap.c | |||
@@ -83,10 +83,12 @@ static struct vm_operations_struct ocfs2_file_vm_ops = { | |||
83 | int ocfs2_mmap(struct file *file, struct vm_area_struct *vma) | 83 | int ocfs2_mmap(struct file *file, struct vm_area_struct *vma) |
84 | { | 84 | { |
85 | int ret = 0, lock_level = 0; | 85 | int ret = 0, lock_level = 0; |
86 | struct ocfs2_super *osb = OCFS2_SB(file->f_dentry->d_inode->i_sb); | ||
86 | 87 | ||
87 | /* We don't want to support shared writable mappings yet. */ | 88 | /* We don't want to support shared writable mappings yet. */ |
88 | if (((vma->vm_flags & VM_SHARED) || (vma->vm_flags & VM_MAYSHARE)) | 89 | if (!ocfs2_mount_local(osb) && |
89 | && ((vma->vm_flags & VM_WRITE) || (vma->vm_flags & VM_MAYWRITE))) { | 90 | ((vma->vm_flags & VM_SHARED) || (vma->vm_flags & VM_MAYSHARE)) && |
91 | ((vma->vm_flags & VM_WRITE) || (vma->vm_flags & VM_MAYWRITE))) { | ||
90 | mlog(0, "disallow shared writable mmaps %lx\n", vma->vm_flags); | 92 | mlog(0, "disallow shared writable mmaps %lx\n", vma->vm_flags); |
91 | /* This is -EINVAL because generic_file_readonly_mmap | 93 | /* This is -EINVAL because generic_file_readonly_mmap |
92 | * returns it in a similar situation. */ | 94 | * returns it in a similar situation. */ |
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index 21db45ddf144..9637039c2633 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -587,9 +587,11 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb, | |||
587 | } | 587 | } |
588 | 588 | ||
589 | ocfs2_inode_set_new(osb, inode); | 589 | ocfs2_inode_set_new(osb, inode); |
590 | status = ocfs2_create_new_inode_locks(inode); | 590 | if (!ocfs2_mount_local(osb)) { |
591 | if (status < 0) | 591 | status = ocfs2_create_new_inode_locks(inode); |
592 | mlog_errno(status); | 592 | if (status < 0) |
593 | mlog_errno(status); | ||
594 | } | ||
593 | 595 | ||
594 | status = 0; /* error in ocfs2_create_new_inode_locks is not | 596 | status = 0; /* error in ocfs2_create_new_inode_locks is not |
595 | * critical */ | 597 | * critical */ |
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h index b767fd7da6eb..db8e77cd35d3 100644 --- a/fs/ocfs2/ocfs2.h +++ b/fs/ocfs2/ocfs2.h | |||
@@ -349,6 +349,11 @@ static inline int ocfs2_is_soft_readonly(struct ocfs2_super *osb) | |||
349 | return ret; | 349 | return ret; |
350 | } | 350 | } |
351 | 351 | ||
352 | static inline int ocfs2_mount_local(struct ocfs2_super *osb) | ||
353 | { | ||
354 | return (osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT); | ||
355 | } | ||
356 | |||
352 | #define OCFS2_IS_VALID_DINODE(ptr) \ | 357 | #define OCFS2_IS_VALID_DINODE(ptr) \ |
353 | (!strcmp((ptr)->i_signature, OCFS2_INODE_SIGNATURE)) | 358 | (!strcmp((ptr)->i_signature, OCFS2_INODE_SIGNATURE)) |
354 | 359 | ||
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h index 3330a5dc6be2..b5c68567077e 100644 --- a/fs/ocfs2/ocfs2_fs.h +++ b/fs/ocfs2/ocfs2_fs.h | |||
@@ -86,7 +86,7 @@ | |||
86 | OCFS2_SB(sb)->s_feature_incompat &= ~(mask) | 86 | OCFS2_SB(sb)->s_feature_incompat &= ~(mask) |
87 | 87 | ||
88 | #define OCFS2_FEATURE_COMPAT_SUPP 0 | 88 | #define OCFS2_FEATURE_COMPAT_SUPP 0 |
89 | #define OCFS2_FEATURE_INCOMPAT_SUPP 0 | 89 | #define OCFS2_FEATURE_INCOMPAT_SUPP OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT |
90 | #define OCFS2_FEATURE_RO_COMPAT_SUPP 0 | 90 | #define OCFS2_FEATURE_RO_COMPAT_SUPP 0 |
91 | 91 | ||
92 | /* | 92 | /* |
@@ -96,6 +96,18 @@ | |||
96 | */ | 96 | */ |
97 | #define OCFS2_FEATURE_INCOMPAT_HEARTBEAT_DEV 0x0002 | 97 | #define OCFS2_FEATURE_INCOMPAT_HEARTBEAT_DEV 0x0002 |
98 | 98 | ||
99 | /* | ||
100 | * tunefs sets this incompat flag before starting the resize and clears it | ||
101 | * at the end. This flag protects users from inadvertently mounting the fs | ||
102 | * after an aborted run without fsck-ing. | ||
103 | */ | ||
104 | #define OCFS2_FEATURE_INCOMPAT_RESIZE_INPROG 0x0004 | ||
105 | |||
106 | /* Used to denote a non-clustered volume */ | ||
107 | #define OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT 0x0008 | ||
108 | |||
109 | /* Support for sparse allocation in b-trees */ | ||
110 | #define OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC 0x0010 | ||
99 | 111 | ||
100 | /* | 112 | /* |
101 | * Flags on ocfs2_dinode.i_flags | 113 | * Flags on ocfs2_dinode.i_flags |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 4bf39540e652..a6d2f8cc165b 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -508,6 +508,27 @@ bail: | |||
508 | return status; | 508 | return status; |
509 | } | 509 | } |
510 | 510 | ||
511 | static int ocfs2_verify_heartbeat(struct ocfs2_super *osb) | ||
512 | { | ||
513 | if (ocfs2_mount_local(osb)) { | ||
514 | if (osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL) { | ||
515 | mlog(ML_ERROR, "Cannot heartbeat on a locally " | ||
516 | "mounted device.\n"); | ||
517 | return -EINVAL; | ||
518 | } | ||
519 | } | ||
520 | |||
521 | if (!(osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL)) { | ||
522 | if (!ocfs2_mount_local(osb) && !ocfs2_is_hard_readonly(osb)) { | ||
523 | mlog(ML_ERROR, "Heartbeat has to be started to mount " | ||
524 | "a read-write clustered device.\n"); | ||
525 | return -EINVAL; | ||
526 | } | ||
527 | } | ||
528 | |||
529 | return 0; | ||
530 | } | ||
531 | |||
511 | static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | 532 | static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) |
512 | { | 533 | { |
513 | struct dentry *root; | 534 | struct dentry *root; |
@@ -516,16 +537,24 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | |||
516 | struct inode *inode = NULL; | 537 | struct inode *inode = NULL; |
517 | struct ocfs2_super *osb = NULL; | 538 | struct ocfs2_super *osb = NULL; |
518 | struct buffer_head *bh = NULL; | 539 | struct buffer_head *bh = NULL; |
540 | char nodestr[8]; | ||
519 | 541 | ||
520 | mlog_entry("%p, %p, %i", sb, data, silent); | 542 | mlog_entry("%p, %p, %i", sb, data, silent); |
521 | 543 | ||
522 | /* for now we only have one cluster/node, make sure we see it | 544 | if (!ocfs2_parse_options(sb, data, &parsed_opt, 0)) { |
523 | * in the heartbeat universe */ | ||
524 | if (!o2hb_check_local_node_heartbeating()) { | ||
525 | status = -EINVAL; | 545 | status = -EINVAL; |
526 | goto read_super_error; | 546 | goto read_super_error; |
527 | } | 547 | } |
528 | 548 | ||
549 | /* for now we only have one cluster/node, make sure we see it | ||
550 | * in the heartbeat universe */ | ||
551 | if (parsed_opt & OCFS2_MOUNT_HB_LOCAL) { | ||
552 | if (!o2hb_check_local_node_heartbeating()) { | ||
553 | status = -EINVAL; | ||
554 | goto read_super_error; | ||
555 | } | ||
556 | } | ||
557 | |||
529 | /* probe for superblock */ | 558 | /* probe for superblock */ |
530 | status = ocfs2_sb_probe(sb, &bh, §or_size); | 559 | status = ocfs2_sb_probe(sb, &bh, §or_size); |
531 | if (status < 0) { | 560 | if (status < 0) { |
@@ -541,11 +570,6 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | |||
541 | } | 570 | } |
542 | brelse(bh); | 571 | brelse(bh); |
543 | bh = NULL; | 572 | bh = NULL; |
544 | |||
545 | if (!ocfs2_parse_options(sb, data, &parsed_opt, 0)) { | ||
546 | status = -EINVAL; | ||
547 | goto read_super_error; | ||
548 | } | ||
549 | osb->s_mount_opt = parsed_opt; | 573 | osb->s_mount_opt = parsed_opt; |
550 | 574 | ||
551 | sb->s_magic = OCFS2_SUPER_MAGIC; | 575 | sb->s_magic = OCFS2_SUPER_MAGIC; |
@@ -588,21 +612,16 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | |||
588 | } | 612 | } |
589 | 613 | ||
590 | if (!ocfs2_is_hard_readonly(osb)) { | 614 | if (!ocfs2_is_hard_readonly(osb)) { |
591 | /* If this isn't a hard readonly mount, then we need | ||
592 | * to make sure that heartbeat is in a valid state, | ||
593 | * and that we mark ourselves soft readonly is -oro | ||
594 | * was specified. */ | ||
595 | if (!(osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL)) { | ||
596 | mlog(ML_ERROR, "No heartbeat for device (%s)\n", | ||
597 | sb->s_id); | ||
598 | status = -EINVAL; | ||
599 | goto read_super_error; | ||
600 | } | ||
601 | |||
602 | if (sb->s_flags & MS_RDONLY) | 615 | if (sb->s_flags & MS_RDONLY) |
603 | ocfs2_set_ro_flag(osb, 0); | 616 | ocfs2_set_ro_flag(osb, 0); |
604 | } | 617 | } |
605 | 618 | ||
619 | status = ocfs2_verify_heartbeat(osb); | ||
620 | if (status < 0) { | ||
621 | mlog_errno(status); | ||
622 | goto read_super_error; | ||
623 | } | ||
624 | |||
606 | osb->osb_debug_root = debugfs_create_dir(osb->uuid_str, | 625 | osb->osb_debug_root = debugfs_create_dir(osb->uuid_str, |
607 | ocfs2_debugfs_root); | 626 | ocfs2_debugfs_root); |
608 | if (!osb->osb_debug_root) { | 627 | if (!osb->osb_debug_root) { |
@@ -635,9 +654,14 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | |||
635 | 654 | ||
636 | ocfs2_complete_mount_recovery(osb); | 655 | ocfs2_complete_mount_recovery(osb); |
637 | 656 | ||
638 | printk(KERN_INFO "ocfs2: Mounting device (%s) on (node %d, slot %d) " | 657 | if (ocfs2_mount_local(osb)) |
658 | snprintf(nodestr, sizeof(nodestr), "local"); | ||
659 | else | ||
660 | snprintf(nodestr, sizeof(nodestr), "%d", osb->node_num); | ||
661 | |||
662 | printk(KERN_INFO "ocfs2: Mounting device (%s) on (node %s, slot %d) " | ||
639 | "with %s data mode.\n", | 663 | "with %s data mode.\n", |
640 | osb->dev_str, osb->node_num, osb->slot_num, | 664 | osb->dev_str, nodestr, osb->slot_num, |
641 | osb->s_mount_opt & OCFS2_MOUNT_DATA_WRITEBACK ? "writeback" : | 665 | osb->s_mount_opt & OCFS2_MOUNT_DATA_WRITEBACK ? "writeback" : |
642 | "ordered"); | 666 | "ordered"); |
643 | 667 | ||
@@ -999,7 +1023,11 @@ static int ocfs2_fill_local_node_info(struct ocfs2_super *osb) | |||
999 | 1023 | ||
1000 | /* XXX hold a ref on the node while mounte? easy enough, if | 1024 | /* XXX hold a ref on the node while mounte? easy enough, if |
1001 | * desirable. */ | 1025 | * desirable. */ |
1002 | osb->node_num = o2nm_this_node(); | 1026 | if (ocfs2_mount_local(osb)) |
1027 | osb->node_num = 0; | ||
1028 | else | ||
1029 | osb->node_num = o2nm_this_node(); | ||
1030 | |||
1003 | if (osb->node_num == O2NM_MAX_NODES) { | 1031 | if (osb->node_num == O2NM_MAX_NODES) { |
1004 | mlog(ML_ERROR, "could not find this host's node number\n"); | 1032 | mlog(ML_ERROR, "could not find this host's node number\n"); |
1005 | status = -ENOENT; | 1033 | status = -ENOENT; |
@@ -1084,6 +1112,9 @@ static int ocfs2_mount_volume(struct super_block *sb) | |||
1084 | goto leave; | 1112 | goto leave; |
1085 | } | 1113 | } |
1086 | 1114 | ||
1115 | if (ocfs2_mount_local(osb)) | ||
1116 | goto leave; | ||
1117 | |||
1087 | /* This should be sent *after* we recovered our journal as it | 1118 | /* This should be sent *after* we recovered our journal as it |
1088 | * will cause other nodes to unmark us as needing | 1119 | * will cause other nodes to unmark us as needing |
1089 | * recovery. However, we need to send it *before* dropping the | 1120 | * recovery. However, we need to send it *before* dropping the |
@@ -1114,6 +1145,7 @@ static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err) | |||
1114 | { | 1145 | { |
1115 | int tmp; | 1146 | int tmp; |
1116 | struct ocfs2_super *osb = NULL; | 1147 | struct ocfs2_super *osb = NULL; |
1148 | char nodestr[8]; | ||
1117 | 1149 | ||
1118 | mlog_entry("(0x%p)\n", sb); | 1150 | mlog_entry("(0x%p)\n", sb); |
1119 | 1151 | ||
@@ -1177,8 +1209,13 @@ static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err) | |||
1177 | 1209 | ||
1178 | atomic_set(&osb->vol_state, VOLUME_DISMOUNTED); | 1210 | atomic_set(&osb->vol_state, VOLUME_DISMOUNTED); |
1179 | 1211 | ||
1180 | printk(KERN_INFO "ocfs2: Unmounting device (%s) on (node %d)\n", | 1212 | if (ocfs2_mount_local(osb)) |
1181 | osb->dev_str, osb->node_num); | 1213 | snprintf(nodestr, sizeof(nodestr), "local"); |
1214 | else | ||
1215 | snprintf(nodestr, sizeof(nodestr), "%d", osb->node_num); | ||
1216 | |||
1217 | printk(KERN_INFO "ocfs2: Unmounting device (%s) on (node %s)\n", | ||
1218 | osb->dev_str, nodestr); | ||
1182 | 1219 | ||
1183 | ocfs2_delete_osb(osb); | 1220 | ocfs2_delete_osb(osb); |
1184 | kfree(osb); | 1221 | kfree(osb); |
@@ -1536,6 +1573,7 @@ static int ocfs2_check_volume(struct ocfs2_super *osb) | |||
1536 | { | 1573 | { |
1537 | int status = 0; | 1574 | int status = 0; |
1538 | int dirty; | 1575 | int dirty; |
1576 | int local; | ||
1539 | struct ocfs2_dinode *local_alloc = NULL; /* only used if we | 1577 | struct ocfs2_dinode *local_alloc = NULL; /* only used if we |
1540 | * recover | 1578 | * recover |
1541 | * ourselves. */ | 1579 | * ourselves. */ |
@@ -1563,8 +1601,10 @@ static int ocfs2_check_volume(struct ocfs2_super *osb) | |||
1563 | "recovering volume.\n"); | 1601 | "recovering volume.\n"); |
1564 | } | 1602 | } |
1565 | 1603 | ||
1604 | local = ocfs2_mount_local(osb); | ||
1605 | |||
1566 | /* will play back anything left in the journal. */ | 1606 | /* will play back anything left in the journal. */ |
1567 | ocfs2_journal_load(osb->journal); | 1607 | ocfs2_journal_load(osb->journal, local); |
1568 | 1608 | ||
1569 | if (dirty) { | 1609 | if (dirty) { |
1570 | /* recover my local alloc if we didn't unmount cleanly. */ | 1610 | /* recover my local alloc if we didn't unmount cleanly. */ |
diff --git a/fs/ocfs2/vote.c b/fs/ocfs2/vote.c index 5b4dca79990b..0315a8b61ed6 100644 --- a/fs/ocfs2/vote.c +++ b/fs/ocfs2/vote.c | |||
@@ -1000,6 +1000,9 @@ int ocfs2_register_net_handlers(struct ocfs2_super *osb) | |||
1000 | { | 1000 | { |
1001 | int status = 0; | 1001 | int status = 0; |
1002 | 1002 | ||
1003 | if (ocfs2_mount_local(osb)) | ||
1004 | return 0; | ||
1005 | |||
1003 | status = o2net_register_handler(OCFS2_MESSAGE_TYPE_RESPONSE, | 1006 | status = o2net_register_handler(OCFS2_MESSAGE_TYPE_RESPONSE, |
1004 | osb->net_key, | 1007 | osb->net_key, |
1005 | sizeof(struct ocfs2_response_msg), | 1008 | sizeof(struct ocfs2_response_msg), |
diff --git a/include/asm-arm/arch-pnx4008/i2c.h b/include/asm-arm/arch-pnx4008/i2c.h new file mode 100644 index 000000000000..92e8d65006f7 --- /dev/null +++ b/include/asm-arm/arch-pnx4008/i2c.h | |||
@@ -0,0 +1,67 @@ | |||
1 | /* | ||
2 | * PNX4008-specific tweaks for I2C IP3204 block | ||
3 | * | ||
4 | * Author: Vitaly Wool <vwool@ru.mvista.com> | ||
5 | * | ||
6 | * 2005 (c) MontaVista Software, Inc. This file is licensed under | ||
7 | * the terms of the GNU General Public License version 2. This program | ||
8 | * is licensed "as is" without any warranty of any kind, whether express | ||
9 | * or implied. | ||
10 | */ | ||
11 | |||
12 | #ifndef __ASM_ARCH_I2C_H__ | ||
13 | #define __ASM_ARCH_I2C_H__ | ||
14 | |||
15 | #include <linux/pm.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | |||
18 | enum { | ||
19 | mstatus_tdi = 0x00000001, | ||
20 | mstatus_afi = 0x00000002, | ||
21 | mstatus_nai = 0x00000004, | ||
22 | mstatus_drmi = 0x00000008, | ||
23 | mstatus_active = 0x00000020, | ||
24 | mstatus_scl = 0x00000040, | ||
25 | mstatus_sda = 0x00000080, | ||
26 | mstatus_rff = 0x00000100, | ||
27 | mstatus_rfe = 0x00000200, | ||
28 | mstatus_tff = 0x00000400, | ||
29 | mstatus_tfe = 0x00000800, | ||
30 | }; | ||
31 | |||
32 | enum { | ||
33 | mcntrl_tdie = 0x00000001, | ||
34 | mcntrl_afie = 0x00000002, | ||
35 | mcntrl_naie = 0x00000004, | ||
36 | mcntrl_drmie = 0x00000008, | ||
37 | mcntrl_daie = 0x00000020, | ||
38 | mcntrl_rffie = 0x00000040, | ||
39 | mcntrl_tffie = 0x00000080, | ||
40 | mcntrl_reset = 0x00000100, | ||
41 | mcntrl_cdbmode = 0x00000400, | ||
42 | }; | ||
43 | |||
44 | enum { | ||
45 | rw_bit = 1 << 0, | ||
46 | start_bit = 1 << 8, | ||
47 | stop_bit = 1 << 9, | ||
48 | }; | ||
49 | |||
50 | #define I2C_REG_RX(a) ((a)->ioaddr) /* Rx FIFO reg (RO) */ | ||
51 | #define I2C_REG_TX(a) ((a)->ioaddr) /* Tx FIFO reg (WO) */ | ||
52 | #define I2C_REG_STS(a) ((a)->ioaddr + 0x04) /* Status reg (RO) */ | ||
53 | #define I2C_REG_CTL(a) ((a)->ioaddr + 0x08) /* Ctl reg */ | ||
54 | #define I2C_REG_CKL(a) ((a)->ioaddr + 0x0c) /* Clock divider low */ | ||
55 | #define I2C_REG_CKH(a) ((a)->ioaddr + 0x10) /* Clock divider high */ | ||
56 | #define I2C_REG_ADR(a) ((a)->ioaddr + 0x14) /* I2C address */ | ||
57 | #define I2C_REG_RFL(a) ((a)->ioaddr + 0x18) /* Rx FIFO level (RO) */ | ||
58 | #define I2C_REG_TFL(a) ((a)->ioaddr + 0x1c) /* Tx FIFO level (RO) */ | ||
59 | #define I2C_REG_RXB(a) ((a)->ioaddr + 0x20) /* Num of bytes Rx-ed (RO) */ | ||
60 | #define I2C_REG_TXB(a) ((a)->ioaddr + 0x24) /* Num of bytes Tx-ed (RO) */ | ||
61 | #define I2C_REG_TXS(a) ((a)->ioaddr + 0x28) /* Tx slave FIFO (RO) */ | ||
62 | #define I2C_REG_STFL(a) ((a)->ioaddr + 0x2c) /* Tx slave FIFO level (RO) */ | ||
63 | |||
64 | #define HCLK_MHZ 13 | ||
65 | #define I2C_CHIP_NAME "PNX4008-I2C" | ||
66 | |||
67 | #endif /* __ASM_ARCH_I2C_H___ */ | ||
diff --git a/include/asm-i386/msr.h b/include/asm-i386/msr.h index 5679d4993072..609a3899475c 100644 --- a/include/asm-i386/msr.h +++ b/include/asm-i386/msr.h | |||
@@ -100,6 +100,8 @@ static inline void wrmsrl (unsigned long msr, unsigned long long val) | |||
100 | 100 | ||
101 | #define MSR_P6_PERFCTR0 0xc1 | 101 | #define MSR_P6_PERFCTR0 0xc1 |
102 | #define MSR_P6_PERFCTR1 0xc2 | 102 | #define MSR_P6_PERFCTR1 0xc2 |
103 | #define MSR_FSB_FREQ 0xcd | ||
104 | |||
103 | 105 | ||
104 | #define MSR_IA32_BBL_CR_CTL 0x119 | 106 | #define MSR_IA32_BBL_CR_CTL 0x119 |
105 | 107 | ||
@@ -130,6 +132,9 @@ static inline void wrmsrl (unsigned long msr, unsigned long long val) | |||
130 | #define MSR_IA32_PERF_STATUS 0x198 | 132 | #define MSR_IA32_PERF_STATUS 0x198 |
131 | #define MSR_IA32_PERF_CTL 0x199 | 133 | #define MSR_IA32_PERF_CTL 0x199 |
132 | 134 | ||
135 | #define MSR_IA32_MPERF 0xE7 | ||
136 | #define MSR_IA32_APERF 0xE8 | ||
137 | |||
133 | #define MSR_IA32_THERM_CONTROL 0x19a | 138 | #define MSR_IA32_THERM_CONTROL 0x19a |
134 | #define MSR_IA32_THERM_INTERRUPT 0x19b | 139 | #define MSR_IA32_THERM_INTERRUPT 0x19b |
135 | #define MSR_IA32_THERM_STATUS 0x19c | 140 | #define MSR_IA32_THERM_STATUS 0x19c |
diff --git a/include/asm-sh/atomic-irq.h b/include/asm-sh/atomic-irq.h new file mode 100644 index 000000000000..74f7943cff6f --- /dev/null +++ b/include/asm-sh/atomic-irq.h | |||
@@ -0,0 +1,71 @@ | |||
1 | #ifndef __ASM_SH_ATOMIC_IRQ_H | ||
2 | #define __ASM_SH_ATOMIC_IRQ_H | ||
3 | |||
4 | /* | ||
5 | * To get proper branch prediction for the main line, we must branch | ||
6 | * forward to code at the end of this object's .text section, then | ||
7 | * branch back to restart the operation. | ||
8 | */ | ||
9 | static inline void atomic_add(int i, atomic_t *v) | ||
10 | { | ||
11 | unsigned long flags; | ||
12 | |||
13 | local_irq_save(flags); | ||
14 | *(long *)v += i; | ||
15 | local_irq_restore(flags); | ||
16 | } | ||
17 | |||
18 | static inline void atomic_sub(int i, atomic_t *v) | ||
19 | { | ||
20 | unsigned long flags; | ||
21 | |||
22 | local_irq_save(flags); | ||
23 | *(long *)v -= i; | ||
24 | local_irq_restore(flags); | ||
25 | } | ||
26 | |||
27 | static inline int atomic_add_return(int i, atomic_t *v) | ||
28 | { | ||
29 | unsigned long temp, flags; | ||
30 | |||
31 | local_irq_save(flags); | ||
32 | temp = *(long *)v; | ||
33 | temp += i; | ||
34 | *(long *)v = temp; | ||
35 | local_irq_restore(flags); | ||
36 | |||
37 | return temp; | ||
38 | } | ||
39 | |||
40 | static inline int atomic_sub_return(int i, atomic_t *v) | ||
41 | { | ||
42 | unsigned long temp, flags; | ||
43 | |||
44 | local_irq_save(flags); | ||
45 | temp = *(long *)v; | ||
46 | temp -= i; | ||
47 | *(long *)v = temp; | ||
48 | local_irq_restore(flags); | ||
49 | |||
50 | return temp; | ||
51 | } | ||
52 | |||
53 | static inline void atomic_clear_mask(unsigned int mask, atomic_t *v) | ||
54 | { | ||
55 | unsigned long flags; | ||
56 | |||
57 | local_irq_save(flags); | ||
58 | *(long *)v &= ~mask; | ||
59 | local_irq_restore(flags); | ||
60 | } | ||
61 | |||
62 | static inline void atomic_set_mask(unsigned int mask, atomic_t *v) | ||
63 | { | ||
64 | unsigned long flags; | ||
65 | |||
66 | local_irq_save(flags); | ||
67 | *(long *)v |= mask; | ||
68 | local_irq_restore(flags); | ||
69 | } | ||
70 | |||
71 | #endif /* __ASM_SH_ATOMIC_IRQ_H */ | ||
diff --git a/include/asm-sh/atomic-llsc.h b/include/asm-sh/atomic-llsc.h new file mode 100644 index 000000000000..4b00b78e3f4f --- /dev/null +++ b/include/asm-sh/atomic-llsc.h | |||
@@ -0,0 +1,107 @@ | |||
1 | #ifndef __ASM_SH_ATOMIC_LLSC_H | ||
2 | #define __ASM_SH_ATOMIC_LLSC_H | ||
3 | |||
4 | /* | ||
5 | * To get proper branch prediction for the main line, we must branch | ||
6 | * forward to code at the end of this object's .text section, then | ||
7 | * branch back to restart the operation. | ||
8 | */ | ||
9 | static inline void atomic_add(int i, atomic_t *v) | ||
10 | { | ||
11 | unsigned long tmp; | ||
12 | |||
13 | __asm__ __volatile__ ( | ||
14 | "1: movli.l @%2, %0 ! atomic_add \n" | ||
15 | " add %1, %0 \n" | ||
16 | " movco.l %0, @%2 \n" | ||
17 | " bf 1b \n" | ||
18 | : "=&z" (tmp) | ||
19 | : "r" (i), "r" (&v->counter) | ||
20 | : "t"); | ||
21 | } | ||
22 | |||
23 | static inline void atomic_sub(int i, atomic_t *v) | ||
24 | { | ||
25 | unsigned long tmp; | ||
26 | |||
27 | __asm__ __volatile__ ( | ||
28 | "1: movli.l @%2, %0 ! atomic_sub \n" | ||
29 | " sub %1, %0 \n" | ||
30 | " movco.l %0, @%2 \n" | ||
31 | " bf 1b \n" | ||
32 | : "=&z" (tmp) | ||
33 | : "r" (i), "r" (&v->counter) | ||
34 | : "t"); | ||
35 | } | ||
36 | |||
37 | /* | ||
38 | * SH-4A note: | ||
39 | * | ||
40 | * We basically get atomic_xxx_return() for free compared with | ||
41 | * atomic_xxx(). movli.l/movco.l require r0 due to the instruction | ||
42 | * encoding, so the retval is automatically set without having to | ||
43 | * do any special work. | ||
44 | */ | ||
45 | static inline int atomic_add_return(int i, atomic_t *v) | ||
46 | { | ||
47 | unsigned long temp; | ||
48 | |||
49 | __asm__ __volatile__ ( | ||
50 | "1: movli.l @%2, %0 ! atomic_add_return \n" | ||
51 | " add %1, %0 \n" | ||
52 | " movco.l %0, @%2 \n" | ||
53 | " bf 1b \n" | ||
54 | " synco \n" | ||
55 | : "=&z" (temp) | ||
56 | : "r" (i), "r" (&v->counter) | ||
57 | : "t"); | ||
58 | |||
59 | return temp; | ||
60 | } | ||
61 | |||
62 | static inline int atomic_sub_return(int i, atomic_t *v) | ||
63 | { | ||
64 | unsigned long temp; | ||
65 | |||
66 | __asm__ __volatile__ ( | ||
67 | "1: movli.l @%2, %0 ! atomic_sub_return \n" | ||
68 | " sub %1, %0 \n" | ||
69 | " movco.l %0, @%2 \n" | ||
70 | " bf 1b \n" | ||
71 | " synco \n" | ||
72 | : "=&z" (temp) | ||
73 | : "r" (i), "r" (&v->counter) | ||
74 | : "t"); | ||
75 | |||
76 | return temp; | ||
77 | } | ||
78 | |||
79 | static inline void atomic_clear_mask(unsigned int mask, atomic_t *v) | ||
80 | { | ||
81 | unsigned long tmp; | ||
82 | |||
83 | __asm__ __volatile__ ( | ||
84 | "1: movli.l @%2, %0 ! atomic_clear_mask \n" | ||
85 | " and %1, %0 \n" | ||
86 | " movco.l %0, @%2 \n" | ||
87 | " bf 1b \n" | ||
88 | : "=&z" (tmp) | ||
89 | : "r" (~mask), "r" (&v->counter) | ||
90 | : "t"); | ||
91 | } | ||
92 | |||
93 | static inline void atomic_set_mask(unsigned int mask, atomic_t *v) | ||
94 | { | ||
95 | unsigned long tmp; | ||
96 | |||
97 | __asm__ __volatile__ ( | ||
98 | "1: movli.l @%2, %0 ! atomic_set_mask \n" | ||
99 | " or %1, %0 \n" | ||
100 | " movco.l %0, @%2 \n" | ||
101 | " bf 1b \n" | ||
102 | : "=&z" (tmp) | ||
103 | : "r" (mask), "r" (&v->counter) | ||
104 | : "t"); | ||
105 | } | ||
106 | |||
107 | #endif /* __ASM_SH_ATOMIC_LLSC_H */ | ||
diff --git a/include/asm-sh/atomic.h b/include/asm-sh/atomic.h index 28305c3cbddf..e12570b9339d 100644 --- a/include/asm-sh/atomic.h +++ b/include/asm-sh/atomic.h | |||
@@ -17,119 +17,14 @@ typedef struct { volatile int counter; } atomic_t; | |||
17 | #include <linux/compiler.h> | 17 | #include <linux/compiler.h> |
18 | #include <asm/system.h> | 18 | #include <asm/system.h> |
19 | 19 | ||
20 | /* | ||
21 | * To get proper branch prediction for the main line, we must branch | ||
22 | * forward to code at the end of this object's .text section, then | ||
23 | * branch back to restart the operation. | ||
24 | */ | ||
25 | static inline void atomic_add(int i, atomic_t *v) | ||
26 | { | ||
27 | #ifdef CONFIG_CPU_SH4A | 20 | #ifdef CONFIG_CPU_SH4A |
28 | unsigned long tmp; | 21 | #include <asm/atomic-llsc.h> |
29 | |||
30 | __asm__ __volatile__ ( | ||
31 | "1: movli.l @%2, %0 ! atomic_add \n" | ||
32 | " add %1, %0 \n" | ||
33 | " movco.l %0, @%2 \n" | ||
34 | " bf 1b \n" | ||
35 | : "=&z" (tmp) | ||
36 | : "r" (i), "r" (&v->counter) | ||
37 | : "t"); | ||
38 | #else | 22 | #else |
39 | unsigned long flags; | 23 | #include <asm/atomic-irq.h> |
40 | |||
41 | local_irq_save(flags); | ||
42 | *(long *)v += i; | ||
43 | local_irq_restore(flags); | ||
44 | #endif | ||
45 | } | ||
46 | |||
47 | static inline void atomic_sub(int i, atomic_t *v) | ||
48 | { | ||
49 | #ifdef CONFIG_CPU_SH4A | ||
50 | unsigned long tmp; | ||
51 | |||
52 | __asm__ __volatile__ ( | ||
53 | "1: movli.l @%2, %0 ! atomic_sub \n" | ||
54 | " sub %1, %0 \n" | ||
55 | " movco.l %0, @%2 \n" | ||
56 | " bf 1b \n" | ||
57 | : "=&z" (tmp) | ||
58 | : "r" (i), "r" (&v->counter) | ||
59 | : "t"); | ||
60 | #else | ||
61 | unsigned long flags; | ||
62 | |||
63 | local_irq_save(flags); | ||
64 | *(long *)v -= i; | ||
65 | local_irq_restore(flags); | ||
66 | #endif | 24 | #endif |
67 | } | ||
68 | |||
69 | /* | ||
70 | * SH-4A note: | ||
71 | * | ||
72 | * We basically get atomic_xxx_return() for free compared with | ||
73 | * atomic_xxx(). movli.l/movco.l require r0 due to the instruction | ||
74 | * encoding, so the retval is automatically set without having to | ||
75 | * do any special work. | ||
76 | */ | ||
77 | static inline int atomic_add_return(int i, atomic_t *v) | ||
78 | { | ||
79 | unsigned long temp; | ||
80 | |||
81 | #ifdef CONFIG_CPU_SH4A | ||
82 | __asm__ __volatile__ ( | ||
83 | "1: movli.l @%2, %0 ! atomic_add_return \n" | ||
84 | " add %1, %0 \n" | ||
85 | " movco.l %0, @%2 \n" | ||
86 | " bf 1b \n" | ||
87 | " synco \n" | ||
88 | : "=&z" (temp) | ||
89 | : "r" (i), "r" (&v->counter) | ||
90 | : "t"); | ||
91 | #else | ||
92 | unsigned long flags; | ||
93 | |||
94 | local_irq_save(flags); | ||
95 | temp = *(long *)v; | ||
96 | temp += i; | ||
97 | *(long *)v = temp; | ||
98 | local_irq_restore(flags); | ||
99 | #endif | ||
100 | |||
101 | return temp; | ||
102 | } | ||
103 | 25 | ||
104 | #define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0) | 26 | #define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0) |
105 | 27 | ||
106 | static inline int atomic_sub_return(int i, atomic_t *v) | ||
107 | { | ||
108 | unsigned long temp; | ||
109 | |||
110 | #ifdef CONFIG_CPU_SH4A | ||
111 | __asm__ __volatile__ ( | ||
112 | "1: movli.l @%2, %0 ! atomic_sub_return \n" | ||
113 | " sub %1, %0 \n" | ||
114 | " movco.l %0, @%2 \n" | ||
115 | " bf 1b \n" | ||
116 | " synco \n" | ||
117 | : "=&z" (temp) | ||
118 | : "r" (i), "r" (&v->counter) | ||
119 | : "t"); | ||
120 | #else | ||
121 | unsigned long flags; | ||
122 | |||
123 | local_irq_save(flags); | ||
124 | temp = *(long *)v; | ||
125 | temp -= i; | ||
126 | *(long *)v = temp; | ||
127 | local_irq_restore(flags); | ||
128 | #endif | ||
129 | |||
130 | return temp; | ||
131 | } | ||
132 | |||
133 | #define atomic_dec_return(v) atomic_sub_return(1,(v)) | 28 | #define atomic_dec_return(v) atomic_sub_return(1,(v)) |
134 | #define atomic_inc_return(v) atomic_add_return(1,(v)) | 29 | #define atomic_inc_return(v) atomic_add_return(1,(v)) |
135 | 30 | ||
@@ -180,50 +75,6 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u) | |||
180 | } | 75 | } |
181 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) | 76 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) |
182 | 77 | ||
183 | static inline void atomic_clear_mask(unsigned int mask, atomic_t *v) | ||
184 | { | ||
185 | #ifdef CONFIG_CPU_SH4A | ||
186 | unsigned long tmp; | ||
187 | |||
188 | __asm__ __volatile__ ( | ||
189 | "1: movli.l @%2, %0 ! atomic_clear_mask \n" | ||
190 | " and %1, %0 \n" | ||
191 | " movco.l %0, @%2 \n" | ||
192 | " bf 1b \n" | ||
193 | : "=&z" (tmp) | ||
194 | : "r" (~mask), "r" (&v->counter) | ||
195 | : "t"); | ||
196 | #else | ||
197 | unsigned long flags; | ||
198 | |||
199 | local_irq_save(flags); | ||
200 | *(long *)v &= ~mask; | ||
201 | local_irq_restore(flags); | ||
202 | #endif | ||
203 | } | ||
204 | |||
205 | static inline void atomic_set_mask(unsigned int mask, atomic_t *v) | ||
206 | { | ||
207 | #ifdef CONFIG_CPU_SH4A | ||
208 | unsigned long tmp; | ||
209 | |||
210 | __asm__ __volatile__ ( | ||
211 | "1: movli.l @%2, %0 ! atomic_set_mask \n" | ||
212 | " or %1, %0 \n" | ||
213 | " movco.l %0, @%2 \n" | ||
214 | " bf 1b \n" | ||
215 | : "=&z" (tmp) | ||
216 | : "r" (mask), "r" (&v->counter) | ||
217 | : "t"); | ||
218 | #else | ||
219 | unsigned long flags; | ||
220 | |||
221 | local_irq_save(flags); | ||
222 | *(long *)v |= mask; | ||
223 | local_irq_restore(flags); | ||
224 | #endif | ||
225 | } | ||
226 | |||
227 | /* Atomic operations are already serializing on SH */ | 78 | /* Atomic operations are already serializing on SH */ |
228 | #define smp_mb__before_atomic_dec() barrier() | 79 | #define smp_mb__before_atomic_dec() barrier() |
229 | #define smp_mb__after_atomic_dec() barrier() | 80 | #define smp_mb__after_atomic_dec() barrier() |
diff --git a/include/asm-sh/bug.h b/include/asm-sh/bug.h index 1b4fc52a59e8..2f89dd06d0cd 100644 --- a/include/asm-sh/bug.h +++ b/include/asm-sh/bug.h | |||
@@ -1,19 +1,54 @@ | |||
1 | #ifndef __ASM_SH_BUG_H | 1 | #ifndef __ASM_SH_BUG_H |
2 | #define __ASM_SH_BUG_H | 2 | #define __ASM_SH_BUG_H |
3 | 3 | ||
4 | |||
5 | #ifdef CONFIG_BUG | 4 | #ifdef CONFIG_BUG |
6 | /* | 5 | |
7 | * Tell the user there is some problem. | 6 | struct bug_frame { |
8 | */ | 7 | unsigned short opcode; |
9 | #define BUG() do { \ | 8 | unsigned short line; |
10 | printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ | 9 | const char *file; |
11 | *(volatile int *)0 = 0; \ | 10 | const char *func; |
11 | }; | ||
12 | |||
13 | struct pt_regs; | ||
14 | |||
15 | extern void handle_BUG(struct pt_regs *); | ||
16 | |||
17 | #define TRAPA_BUG_OPCODE 0xc33e /* trapa #0x3e */ | ||
18 | |||
19 | #ifdef CONFIG_DEBUG_BUGVERBOSE | ||
20 | |||
21 | #define BUG() \ | ||
22 | do { \ | ||
23 | __asm__ __volatile__ ( \ | ||
24 | ".align 2\n\t" \ | ||
25 | ".short %O0\n\t" \ | ||
26 | ".short %O1\n\t" \ | ||
27 | ".long %O2\n\t" \ | ||
28 | ".long %O3\n\t" \ | ||
29 | : \ | ||
30 | : "n" (TRAPA_BUG_OPCODE), \ | ||
31 | "i" (__LINE__), "X" (__FILE__), \ | ||
32 | "X" (__FUNCTION__)); \ | ||
33 | } while (0) | ||
34 | |||
35 | #else | ||
36 | |||
37 | #define BUG() \ | ||
38 | do { \ | ||
39 | __asm__ __volatile__ ( \ | ||
40 | ".align 2\n\t" \ | ||
41 | ".short %O0\n\t" \ | ||
42 | : \ | ||
43 | : "n" (TRAPA_BUG_OPCODE)); \ | ||
12 | } while (0) | 44 | } while (0) |
13 | 45 | ||
46 | #endif /* CONFIG_DEBUG_BUGVERBOSE */ | ||
47 | |||
14 | #define HAVE_ARCH_BUG | 48 | #define HAVE_ARCH_BUG |
15 | #endif | 49 | |
50 | #endif /* CONFIG_BUG */ | ||
16 | 51 | ||
17 | #include <asm-generic/bug.h> | 52 | #include <asm-generic/bug.h> |
18 | 53 | ||
19 | #endif | 54 | #endif /* __ASM_SH_BUG_H */ |
diff --git a/include/asm-sh/bugs.h b/include/asm-sh/bugs.h index 795047da5e17..a294997a8412 100644 --- a/include/asm-sh/bugs.h +++ b/include/asm-sh/bugs.h | |||
@@ -16,9 +16,8 @@ | |||
16 | 16 | ||
17 | static void __init check_bugs(void) | 17 | static void __init check_bugs(void) |
18 | { | 18 | { |
19 | extern char *get_cpu_subtype(void); | ||
20 | extern unsigned long loops_per_jiffy; | 19 | extern unsigned long loops_per_jiffy; |
21 | char *p= &init_utsname()->machine[2]; /* "sh" */ | 20 | char *p = &init_utsname()->machine[2]; /* "sh" */ |
22 | 21 | ||
23 | cpu_data->loops_per_jiffy = loops_per_jiffy; | 22 | cpu_data->loops_per_jiffy = loops_per_jiffy; |
24 | 23 | ||
@@ -40,6 +39,15 @@ static void __init check_bugs(void) | |||
40 | *p++ = '4'; | 39 | *p++ = '4'; |
41 | *p++ = 'a'; | 40 | *p++ = 'a'; |
42 | break; | 41 | break; |
42 | case CPU_SH73180 ... CPU_SH7722: | ||
43 | *p++ = '4'; | ||
44 | *p++ = 'a'; | ||
45 | *p++ = 'l'; | ||
46 | *p++ = '-'; | ||
47 | *p++ = 'd'; | ||
48 | *p++ = 's'; | ||
49 | *p++ = 'p'; | ||
50 | break; | ||
43 | default: | 51 | default: |
44 | *p++ = '?'; | 52 | *p++ = '?'; |
45 | *p++ = '!'; | 53 | *p++ = '!'; |
diff --git a/include/asm-sh/checksum.h b/include/asm-sh/checksum.h index d44344c88e73..4bc8357e8892 100644 --- a/include/asm-sh/checksum.h +++ b/include/asm-sh/checksum.h | |||
@@ -34,25 +34,26 @@ asmlinkage __wsum csum_partial(const void *buff, int len, __wsum sum); | |||
34 | */ | 34 | */ |
35 | 35 | ||
36 | asmlinkage __wsum csum_partial_copy_generic(const void *src, void *dst, | 36 | asmlinkage __wsum csum_partial_copy_generic(const void *src, void *dst, |
37 | int len, __wsum sum, int *src_err_ptr, int *dst_err_ptr); | 37 | int len, __wsum sum, |
38 | int *src_err_ptr, int *dst_err_ptr); | ||
38 | 39 | ||
39 | /* | 40 | /* |
40 | * Note: when you get a NULL pointer exception here this means someone | 41 | * Note: when you get a NULL pointer exception here this means someone |
41 | * passed in an incorrect kernel address to one of these functions. | 42 | * passed in an incorrect kernel address to one of these functions. |
42 | * | 43 | * |
43 | * If you use these functions directly please don't forget the | 44 | * If you use these functions directly please don't forget the |
44 | * access_ok(). | 45 | * access_ok(). |
45 | */ | 46 | */ |
46 | static __inline__ | 47 | static inline |
47 | __wsum csum_partial_copy_nocheck(const void *src, void *dst, | 48 | __wsum csum_partial_copy_nocheck(const void *src, void *dst, |
48 | int len, __wsum sum) | 49 | int len, __wsum sum) |
49 | { | 50 | { |
50 | return csum_partial_copy_generic ( src, dst, len, sum, NULL, NULL); | 51 | return csum_partial_copy_generic(src, dst, len, sum, NULL, NULL); |
51 | } | 52 | } |
52 | 53 | ||
53 | static __inline__ | 54 | static inline |
54 | __wsum csum_partial_copy_from_user(const void __user *src, void *dst, | 55 | __wsum csum_partial_copy_from_user(const void __user *src, void *dst, |
55 | int len, __wsum sum, int *err_ptr) | 56 | int len, __wsum sum, int *err_ptr) |
56 | { | 57 | { |
57 | return csum_partial_copy_generic((__force const void *)src, dst, | 58 | return csum_partial_copy_generic((__force const void *)src, dst, |
58 | len, sum, err_ptr, NULL); | 59 | len, sum, err_ptr, NULL); |
@@ -62,7 +63,7 @@ __wsum csum_partial_copy_from_user(const void __user *src, void *dst, | |||
62 | * Fold a partial checksum | 63 | * Fold a partial checksum |
63 | */ | 64 | */ |
64 | 65 | ||
65 | static __inline__ __sum16 csum_fold(__wsum sum) | 66 | static inline __sum16 csum_fold(__wsum sum) |
66 | { | 67 | { |
67 | unsigned int __dummy; | 68 | unsigned int __dummy; |
68 | __asm__("swap.w %0, %1\n\t" | 69 | __asm__("swap.w %0, %1\n\t" |
@@ -85,7 +86,7 @@ static __inline__ __sum16 csum_fold(__wsum sum) | |||
85 | * i386 version by Jorge Cwik <jorge@laser.satlink.net>, adapted | 86 | * i386 version by Jorge Cwik <jorge@laser.satlink.net>, adapted |
86 | * for linux by * Arnt Gulbrandsen. | 87 | * for linux by * Arnt Gulbrandsen. |
87 | */ | 88 | */ |
88 | static __inline__ __sum16 ip_fast_csum(const void *iph, unsigned int ihl) | 89 | static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl) |
89 | { | 90 | { |
90 | unsigned int sum, __dummy0, __dummy1; | 91 | unsigned int sum, __dummy0, __dummy1; |
91 | 92 | ||
@@ -113,10 +114,10 @@ static __inline__ __sum16 ip_fast_csum(const void *iph, unsigned int ihl) | |||
113 | return csum_fold(sum); | 114 | return csum_fold(sum); |
114 | } | 115 | } |
115 | 116 | ||
116 | static __inline__ __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, | 117 | static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, |
117 | unsigned short len, | 118 | unsigned short len, |
118 | unsigned short proto, | 119 | unsigned short proto, |
119 | __wsum sum) | 120 | __wsum sum) |
120 | { | 121 | { |
121 | #ifdef __LITTLE_ENDIAN__ | 122 | #ifdef __LITTLE_ENDIAN__ |
122 | unsigned long len_proto = (proto + len) << 8; | 123 | unsigned long len_proto = (proto + len) << 8; |
@@ -132,6 +133,7 @@ static __inline__ __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, | |||
132 | : "=r" (sum), "=r" (len_proto) | 133 | : "=r" (sum), "=r" (len_proto) |
133 | : "r" (daddr), "r" (saddr), "1" (len_proto), "0" (sum) | 134 | : "r" (daddr), "r" (saddr), "1" (len_proto), "0" (sum) |
134 | : "t"); | 135 | : "t"); |
136 | |||
135 | return sum; | 137 | return sum; |
136 | } | 138 | } |
137 | 139 | ||
@@ -139,30 +141,28 @@ static __inline__ __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, | |||
139 | * computes the checksum of the TCP/UDP pseudo-header | 141 | * computes the checksum of the TCP/UDP pseudo-header |
140 | * returns a 16-bit checksum, already complemented | 142 | * returns a 16-bit checksum, already complemented |
141 | */ | 143 | */ |
142 | static __inline__ __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, | 144 | static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, |
143 | unsigned short len, | 145 | unsigned short len, |
144 | unsigned short proto, | 146 | unsigned short proto, |
145 | __wsum sum) | 147 | __wsum sum) |
146 | { | 148 | { |
147 | return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); | 149 | return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); |
148 | } | 150 | } |
149 | 151 | ||
150 | /* | 152 | /* |
151 | * this routine is used for miscellaneous IP-like checksums, mainly | 153 | * this routine is used for miscellaneous IP-like checksums, mainly |
152 | * in icmp.c | 154 | * in icmp.c |
153 | */ | 155 | */ |
154 | 156 | static inline __sum16 ip_compute_csum(const void *buff, int len) | |
155 | static __inline__ __sum16 ip_compute_csum(const void *buff, int len) | ||
156 | { | 157 | { |
157 | return csum_fold (csum_partial(buff, len, 0)); | 158 | return csum_fold(csum_partial(buff, len, 0)); |
158 | } | 159 | } |
159 | 160 | ||
160 | #define _HAVE_ARCH_IPV6_CSUM | 161 | #define _HAVE_ARCH_IPV6_CSUM |
161 | #ifdef CONFIG_IPV6 | 162 | static inline __sum16 csum_ipv6_magic(const struct in6_addr *saddr, |
162 | static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr, | 163 | const struct in6_addr *daddr, |
163 | const struct in6_addr *daddr, | 164 | __u32 len, unsigned short proto, |
164 | __u32 len, unsigned short proto, | 165 | __wsum sum) |
165 | __wsum sum) | ||
166 | { | 166 | { |
167 | unsigned int __dummy; | 167 | unsigned int __dummy; |
168 | __asm__("clrt\n\t" | 168 | __asm__("clrt\n\t" |
@@ -187,22 +187,21 @@ static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr, | |||
187 | "movt %1\n\t" | 187 | "movt %1\n\t" |
188 | "add %1, %0\n" | 188 | "add %1, %0\n" |
189 | : "=r" (sum), "=&r" (__dummy) | 189 | : "=r" (sum), "=&r" (__dummy) |
190 | : "r" (saddr), "r" (daddr), | 190 | : "r" (saddr), "r" (daddr), |
191 | "r" (htonl(len)), "r" (htonl(proto)), "0" (sum) | 191 | "r" (htonl(len)), "r" (htonl(proto)), "0" (sum) |
192 | : "t"); | 192 | : "t"); |
193 | 193 | ||
194 | return csum_fold(sum); | 194 | return csum_fold(sum); |
195 | } | 195 | } |
196 | #endif | ||
197 | 196 | ||
198 | /* | 197 | /* |
199 | * Copy and checksum to user | 198 | * Copy and checksum to user |
200 | */ | 199 | */ |
201 | #define HAVE_CSUM_COPY_USER | 200 | #define HAVE_CSUM_COPY_USER |
202 | static __inline__ __wsum csum_and_copy_to_user (const void *src, | 201 | static inline __wsum csum_and_copy_to_user(const void *src, |
203 | void __user *dst, | 202 | void __user *dst, |
204 | int len, __wsum sum, | 203 | int len, __wsum sum, |
205 | int *err_ptr) | 204 | int *err_ptr) |
206 | { | 205 | { |
207 | if (access_ok(VERIFY_WRITE, dst, len)) | 206 | if (access_ok(VERIFY_WRITE, dst, len)) |
208 | return csum_partial_copy_generic((__force const void *)src, | 207 | return csum_partial_copy_generic((__force const void *)src, |
diff --git a/include/asm-sh/cpu-sh4/cache.h b/include/asm-sh/cpu-sh4/cache.h index 6e9c7e6ee8e4..f92b20a0983d 100644 --- a/include/asm-sh/cpu-sh4/cache.h +++ b/include/asm-sh/cpu-sh4/cache.h | |||
@@ -22,7 +22,7 @@ | |||
22 | #define CCR_CACHE_ICE 0x0100 /* Instruction Cache Enable */ | 22 | #define CCR_CACHE_ICE 0x0100 /* Instruction Cache Enable */ |
23 | #define CCR_CACHE_ICI 0x0800 /* IC Invalidate */ | 23 | #define CCR_CACHE_ICI 0x0800 /* IC Invalidate */ |
24 | #define CCR_CACHE_IIX 0x8000 /* IC Index Enable */ | 24 | #define CCR_CACHE_IIX 0x8000 /* IC Index Enable */ |
25 | #ifndef CONFIG_CPU_SUBTYPE_SH7780 | 25 | #ifndef CONFIG_CPU_SH4A |
26 | #define CCR_CACHE_EMODE 0x80000000 /* EMODE Enable */ | 26 | #define CCR_CACHE_EMODE 0x80000000 /* EMODE Enable */ |
27 | #endif | 27 | #endif |
28 | 28 | ||
diff --git a/include/asm-sh/cpu-sh4/freq.h b/include/asm-sh/cpu-sh4/freq.h index ef2b9b1ae41f..602d061ca2dc 100644 --- a/include/asm-sh/cpu-sh4/freq.h +++ b/include/asm-sh/cpu-sh4/freq.h | |||
@@ -10,7 +10,7 @@ | |||
10 | #ifndef __ASM_CPU_SH4_FREQ_H | 10 | #ifndef __ASM_CPU_SH4_FREQ_H |
11 | #define __ASM_CPU_SH4_FREQ_H | 11 | #define __ASM_CPU_SH4_FREQ_H |
12 | 12 | ||
13 | #if defined(CONFIG_CPU_SUBTYPE_SH73180) | 13 | #if defined(CONFIG_CPU_SUBTYPE_SH73180) || defined(CONFIG_CPU_SUBTYPE_SH7722) |
14 | #define FRQCR 0xa4150000 | 14 | #define FRQCR 0xa4150000 |
15 | #elif defined(CONFIG_CPU_SUBTYPE_SH7780) | 15 | #elif defined(CONFIG_CPU_SUBTYPE_SH7780) |
16 | #define FRQCR 0xffc80000 | 16 | #define FRQCR 0xffc80000 |
diff --git a/include/asm-sh/dma-mapping.h b/include/asm-sh/dma-mapping.h index 37ab0c131a4d..8d0867b98e05 100644 --- a/include/asm-sh/dma-mapping.h +++ b/include/asm-sh/dma-mapping.h | |||
@@ -67,7 +67,7 @@ static inline dma_addr_t dma_map_single(struct device *dev, | |||
67 | if (dev->bus == &pci_bus_type) | 67 | if (dev->bus == &pci_bus_type) |
68 | return virt_to_bus(ptr); | 68 | return virt_to_bus(ptr); |
69 | #endif | 69 | #endif |
70 | dma_cache_sync(ptr, size, dir); | 70 | dma_cache_sync(dev, ptr, size, dir); |
71 | 71 | ||
72 | return virt_to_bus(ptr); | 72 | return virt_to_bus(ptr); |
73 | } | 73 | } |
@@ -81,7 +81,7 @@ static inline int dma_map_sg(struct device *dev, struct scatterlist *sg, | |||
81 | 81 | ||
82 | for (i = 0; i < nents; i++) { | 82 | for (i = 0; i < nents; i++) { |
83 | #if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT) | 83 | #if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT) |
84 | dma_cache_sync(page_address(sg[i].page) + sg[i].offset, | 84 | dma_cache_sync(dev, page_address(sg[i].page) + sg[i].offset, |
85 | sg[i].length, dir); | 85 | sg[i].length, dir); |
86 | #endif | 86 | #endif |
87 | sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset; | 87 | sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset; |
@@ -112,7 +112,7 @@ static inline void dma_sync_single(struct device *dev, dma_addr_t dma_handle, | |||
112 | if (dev->bus == &pci_bus_type) | 112 | if (dev->bus == &pci_bus_type) |
113 | return; | 113 | return; |
114 | #endif | 114 | #endif |
115 | dma_cache_sync(bus_to_virt(dma_handle), size, dir); | 115 | dma_cache_sync(dev, bus_to_virt(dma_handle), size, dir); |
116 | } | 116 | } |
117 | 117 | ||
118 | static inline void dma_sync_single_range(struct device *dev, | 118 | static inline void dma_sync_single_range(struct device *dev, |
@@ -124,7 +124,7 @@ static inline void dma_sync_single_range(struct device *dev, | |||
124 | if (dev->bus == &pci_bus_type) | 124 | if (dev->bus == &pci_bus_type) |
125 | return; | 125 | return; |
126 | #endif | 126 | #endif |
127 | dma_cache_sync(bus_to_virt(dma_handle) + offset, size, dir); | 127 | dma_cache_sync(dev, bus_to_virt(dma_handle) + offset, size, dir); |
128 | } | 128 | } |
129 | 129 | ||
130 | static inline void dma_sync_sg(struct device *dev, struct scatterlist *sg, | 130 | static inline void dma_sync_sg(struct device *dev, struct scatterlist *sg, |
@@ -134,7 +134,7 @@ static inline void dma_sync_sg(struct device *dev, struct scatterlist *sg, | |||
134 | 134 | ||
135 | for (i = 0; i < nelems; i++) { | 135 | for (i = 0; i < nelems; i++) { |
136 | #if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT) | 136 | #if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT) |
137 | dma_cache_sync(page_address(sg[i].page) + sg[i].offset, | 137 | dma_cache_sync(dev, page_address(sg[i].page) + sg[i].offset, |
138 | sg[i].length, dir); | 138 | sg[i].length, dir); |
139 | #endif | 139 | #endif |
140 | sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset; | 140 | sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset; |
diff --git a/include/asm-sh/irq.h b/include/asm-sh/irq.h index fd576088e47e..bff965ef4b95 100644 --- a/include/asm-sh/irq.h +++ b/include/asm-sh/irq.h | |||
@@ -37,7 +37,8 @@ | |||
37 | # define ONCHIP_NR_IRQS 144 | 37 | # define ONCHIP_NR_IRQS 144 |
38 | #elif defined(CONFIG_CPU_SUBTYPE_SH7300) || \ | 38 | #elif defined(CONFIG_CPU_SUBTYPE_SH7300) || \ |
39 | defined(CONFIG_CPU_SUBTYPE_SH73180) || \ | 39 | defined(CONFIG_CPU_SUBTYPE_SH73180) || \ |
40 | defined(CONFIG_CPU_SUBTYPE_SH7343) | 40 | defined(CONFIG_CPU_SUBTYPE_SH7343) || \ |
41 | defined(CONFIG_CPU_SUBTYPE_SH7722) | ||
41 | # define ONCHIP_NR_IRQS 109 | 42 | # define ONCHIP_NR_IRQS 109 |
42 | #elif defined(CONFIG_CPU_SUBTYPE_SH7780) | 43 | #elif defined(CONFIG_CPU_SUBTYPE_SH7780) |
43 | # define ONCHIP_NR_IRQS 111 | 44 | # define ONCHIP_NR_IRQS 111 |
@@ -79,6 +80,8 @@ | |||
79 | # define OFFCHIP_NR_IRQS 16 | 80 | # define OFFCHIP_NR_IRQS 16 |
80 | #elif defined(CONFIG_SH_7343_SOLUTION_ENGINE) | 81 | #elif defined(CONFIG_SH_7343_SOLUTION_ENGINE) |
81 | # define OFFCHIP_NR_IRQS 12 | 82 | # define OFFCHIP_NR_IRQS 12 |
83 | #elif defined(CONFIG_SH_7722_SOLUTION_ENGINE) | ||
84 | # define OFFCHIP_NR_IRQS 14 | ||
82 | #elif defined(CONFIG_SH_UNKNOWN) | 85 | #elif defined(CONFIG_SH_UNKNOWN) |
83 | # define OFFCHIP_NR_IRQS 16 /* Must also be last */ | 86 | # define OFFCHIP_NR_IRQS 16 /* Must also be last */ |
84 | #else | 87 | #else |
diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h index c84901dbd8e5..036ca2843866 100644 --- a/include/asm-sh/pgtable.h +++ b/include/asm-sh/pgtable.h | |||
@@ -508,16 +508,50 @@ struct vm_area_struct; | |||
508 | extern void update_mmu_cache(struct vm_area_struct * vma, | 508 | extern void update_mmu_cache(struct vm_area_struct * vma, |
509 | unsigned long address, pte_t pte); | 509 | unsigned long address, pte_t pte); |
510 | 510 | ||
511 | /* Encode and de-code a swap entry */ | ||
512 | /* | 511 | /* |
512 | * Encode and de-code a swap entry | ||
513 | * | ||
514 | * Constraints: | ||
515 | * _PAGE_FILE at bit 0 | ||
516 | * _PAGE_PRESENT at bit 8 | ||
517 | * _PAGE_PROTNONE at bit 9 | ||
518 | * | ||
519 | * For the normal case, we encode the swap type into bits 0:7 and the | ||
520 | * swap offset into bits 10:30. For the 64-bit PTE case, we keep the | ||
521 | * preserved bits in the low 32-bits and use the upper 32 as the swap | ||
522 | * offset (along with a 5-bit type), following the same approach as x86 | ||
523 | * PAE. This keeps the logic quite simple, and allows for a full 32 | ||
524 | * PTE_FILE_MAX_BITS, as opposed to the 29-bits we're constrained with | ||
525 | * in the pte_low case. | ||
526 | * | ||
527 | * As is evident by the Alpha code, if we ever get a 64-bit unsigned | ||
528 | * long (swp_entry_t) to match up with the 64-bit PTEs, this all becomes | ||
529 | * much cleaner.. | ||
530 | * | ||
513 | * NOTE: We should set ZEROs at the position of _PAGE_PRESENT | 531 | * NOTE: We should set ZEROs at the position of _PAGE_PRESENT |
514 | * and _PAGE_PROTNONE bits | 532 | * and _PAGE_PROTNONE bits |
515 | */ | 533 | */ |
516 | #define __swp_type(x) ((x).val & 0xff) | 534 | #ifdef CONFIG_X2TLB |
517 | #define __swp_offset(x) ((x).val >> 10) | 535 | #define __swp_type(x) ((x).val & 0x1f) |
518 | #define __swp_entry(type, offset) ((swp_entry_t) { (type) | ((offset) << 10) }) | 536 | #define __swp_offset(x) ((x).val >> 5) |
519 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) >> 1 }) | 537 | #define __swp_entry(type, offset) ((swp_entry_t){ (type) | (offset) << 5}) |
520 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val << 1 }) | 538 | #define __pte_to_swp_entry(pte) ((swp_entry_t){ (pte).pte_high }) |
539 | #define __swp_entry_to_pte(x) ((pte_t){ 0, (x).val }) | ||
540 | |||
541 | /* | ||
542 | * Encode and decode a nonlinear file mapping entry | ||
543 | */ | ||
544 | #define pte_to_pgoff(pte) ((pte).pte_high) | ||
545 | #define pgoff_to_pte(off) ((pte_t) { _PAGE_FILE, (off) }) | ||
546 | |||
547 | #define PTE_FILE_MAX_BITS 32 | ||
548 | #else | ||
549 | #define __swp_type(x) ((x).val & 0xff) | ||
550 | #define __swp_offset(x) ((x).val >> 10) | ||
551 | #define __swp_entry(type, offset) ((swp_entry_t){(type) | (offset) <<10}) | ||
552 | |||
553 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) >> 1 }) | ||
554 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val << 1 }) | ||
521 | 555 | ||
522 | /* | 556 | /* |
523 | * Encode and decode a nonlinear file mapping entry | 557 | * Encode and decode a nonlinear file mapping entry |
@@ -525,6 +559,7 @@ extern void update_mmu_cache(struct vm_area_struct * vma, | |||
525 | #define PTE_FILE_MAX_BITS 29 | 559 | #define PTE_FILE_MAX_BITS 29 |
526 | #define pte_to_pgoff(pte) (pte_val(pte) >> 1) | 560 | #define pte_to_pgoff(pte) (pte_val(pte) >> 1) |
527 | #define pgoff_to_pte(off) ((pte_t) { ((off) << 1) | _PAGE_FILE }) | 561 | #define pgoff_to_pte(off) ((pte_t) { ((off) << 1) | _PAGE_FILE }) |
562 | #endif | ||
528 | 563 | ||
529 | typedef pte_t *pte_addr_t; | 564 | typedef pte_t *pte_addr_t; |
530 | 565 | ||
diff --git a/include/asm-sh/processor.h b/include/asm-sh/processor.h index 6f1dd7ca1b1d..e29f2abb92de 100644 --- a/include/asm-sh/processor.h +++ b/include/asm-sh/processor.h | |||
@@ -27,6 +27,8 @@ | |||
27 | #define CCN_CVR 0xff000040 | 27 | #define CCN_CVR 0xff000040 |
28 | #define CCN_PRR 0xff000044 | 28 | #define CCN_PRR 0xff000044 |
29 | 29 | ||
30 | const char *get_cpu_subtype(void); | ||
31 | |||
30 | /* | 32 | /* |
31 | * CPU type and hardware bug flags. Kept separately for each CPU. | 33 | * CPU type and hardware bug flags. Kept separately for each CPU. |
32 | * | 34 | * |
@@ -52,8 +54,10 @@ enum cpu_type { | |||
52 | CPU_SH7760, CPU_ST40RA, CPU_ST40GX1, CPU_SH4_202, CPU_SH4_501, | 54 | CPU_SH7760, CPU_ST40RA, CPU_ST40GX1, CPU_SH4_202, CPU_SH4_501, |
53 | 55 | ||
54 | /* SH-4A types */ | 56 | /* SH-4A types */ |
55 | CPU_SH73180, CPU_SH7343, CPU_SH7770, CPU_SH7780, CPU_SH7781, | 57 | CPU_SH7770, CPU_SH7780, CPU_SH7781, CPU_SH7785, |
56 | CPU_SH7785, | 58 | |
59 | /* SH4AL-DSP types */ | ||
60 | CPU_SH73180, CPU_SH7343, CPU_SH7722, | ||
57 | 61 | ||
58 | /* Unknown subtype */ | 62 | /* Unknown subtype */ |
59 | CPU_SH_NONE | 63 | CPU_SH_NONE |
diff --git a/include/asm-sh/push-switch.h b/include/asm-sh/push-switch.h index dfc6bad567f0..4903f9e52dd8 100644 --- a/include/asm-sh/push-switch.h +++ b/include/asm-sh/push-switch.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/timer.h> | 4 | #include <linux/timer.h> |
5 | #include <linux/interrupt.h> | 5 | #include <linux/interrupt.h> |
6 | #include <linux/workqueue.h> | 6 | #include <linux/workqueue.h> |
7 | #include <linux/platform_device.h> | ||
7 | 8 | ||
8 | struct push_switch { | 9 | struct push_switch { |
9 | /* switch state */ | 10 | /* switch state */ |
@@ -12,6 +13,8 @@ struct push_switch { | |||
12 | struct timer_list debounce; | 13 | struct timer_list debounce; |
13 | /* workqueue */ | 14 | /* workqueue */ |
14 | struct work_struct work; | 15 | struct work_struct work; |
16 | /* platform device, for workqueue handler */ | ||
17 | struct platform_device *pdev; | ||
15 | }; | 18 | }; |
16 | 19 | ||
17 | struct push_switch_platform_info { | 20 | struct push_switch_platform_info { |
diff --git a/include/asm-x86_64/msr.h b/include/asm-x86_64/msr.h index 952783d35c7b..3227bc93d69b 100644 --- a/include/asm-x86_64/msr.h +++ b/include/asm-x86_64/msr.h | |||
@@ -189,6 +189,7 @@ static inline unsigned int cpuid_edx(unsigned int op) | |||
189 | 189 | ||
190 | #define MSR_IA32_PERFCTR0 0xc1 | 190 | #define MSR_IA32_PERFCTR0 0xc1 |
191 | #define MSR_IA32_PERFCTR1 0xc2 | 191 | #define MSR_IA32_PERFCTR1 0xc2 |
192 | #define MSR_FSB_FREQ 0xcd | ||
192 | 193 | ||
193 | #define MSR_MTRRcap 0x0fe | 194 | #define MSR_MTRRcap 0x0fe |
194 | #define MSR_IA32_BBL_CR_CTL 0x119 | 195 | #define MSR_IA32_BBL_CR_CTL 0x119 |
@@ -311,6 +312,9 @@ static inline unsigned int cpuid_edx(unsigned int op) | |||
311 | #define MSR_IA32_PERF_STATUS 0x198 | 312 | #define MSR_IA32_PERF_STATUS 0x198 |
312 | #define MSR_IA32_PERF_CTL 0x199 | 313 | #define MSR_IA32_PERF_CTL 0x199 |
313 | 314 | ||
315 | #define MSR_IA32_MPERF 0xE7 | ||
316 | #define MSR_IA32_APERF 0xE8 | ||
317 | |||
314 | #define MSR_IA32_THERM_CONTROL 0x19a | 318 | #define MSR_IA32_THERM_CONTROL 0x19a |
315 | #define MSR_IA32_THERM_INTERRUPT 0x19b | 319 | #define MSR_IA32_THERM_INTERRUPT 0x19b |
316 | #define MSR_IA32_THERM_STATUS 0x19c | 320 | #define MSR_IA32_THERM_STATUS 0x19c |
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 4ea39fee99c7..7f008f6bfdc3 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
@@ -172,6 +172,8 @@ extern int __cpufreq_driver_target(struct cpufreq_policy *policy, | |||
172 | unsigned int relation); | 172 | unsigned int relation); |
173 | 173 | ||
174 | 174 | ||
175 | extern int cpufreq_driver_getavg(struct cpufreq_policy *policy); | ||
176 | |||
175 | int cpufreq_register_governor(struct cpufreq_governor *governor); | 177 | int cpufreq_register_governor(struct cpufreq_governor *governor); |
176 | void cpufreq_unregister_governor(struct cpufreq_governor *governor); | 178 | void cpufreq_unregister_governor(struct cpufreq_governor *governor); |
177 | 179 | ||
@@ -204,6 +206,7 @@ struct cpufreq_driver { | |||
204 | unsigned int (*get) (unsigned int cpu); | 206 | unsigned int (*get) (unsigned int cpu); |
205 | 207 | ||
206 | /* optional */ | 208 | /* optional */ |
209 | unsigned int (*getavg) (unsigned int cpu); | ||
207 | int (*exit) (struct cpufreq_policy *policy); | 210 | int (*exit) (struct cpufreq_policy *policy); |
208 | int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg); | 211 | int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg); |
209 | int (*resume) (struct cpufreq_policy *policy); | 212 | int (*resume) (struct cpufreq_policy *policy); |
diff --git a/include/linux/i2c-algo-bit.h b/include/linux/i2c-algo-bit.h index c8f8df25c7e0..937da70cb4c4 100644 --- a/include/linux/i2c-algo-bit.h +++ b/include/linux/i2c-algo-bit.h | |||
@@ -26,9 +26,9 @@ | |||
26 | 26 | ||
27 | /* --- Defines for bit-adapters --------------------------------------- */ | 27 | /* --- Defines for bit-adapters --------------------------------------- */ |
28 | /* | 28 | /* |
29 | * This struct contains the hw-dependent functions of bit-style adapters to | 29 | * This struct contains the hw-dependent functions of bit-style adapters to |
30 | * manipulate the line states, and to init any hw-specific features. This is | 30 | * manipulate the line states, and to init any hw-specific features. This is |
31 | * only used if you have more than one hw-type of adapter running. | 31 | * only used if you have more than one hw-type of adapter running. |
32 | */ | 32 | */ |
33 | struct i2c_algo_bit_data { | 33 | struct i2c_algo_bit_data { |
34 | void *data; /* private data for lowlevel routines */ | 34 | void *data; /* private data for lowlevel routines */ |
@@ -44,6 +44,5 @@ struct i2c_algo_bit_data { | |||
44 | }; | 44 | }; |
45 | 45 | ||
46 | int i2c_bit_add_bus(struct i2c_adapter *); | 46 | int i2c_bit_add_bus(struct i2c_adapter *); |
47 | int i2c_bit_del_bus(struct i2c_adapter *); | ||
48 | 47 | ||
49 | #endif /* _LINUX_I2C_ALGO_BIT_H */ | 48 | #endif /* _LINUX_I2C_ALGO_BIT_H */ |
diff --git a/include/linux/i2c-algo-ite.h b/include/linux/i2c-algo-ite.h deleted file mode 100644 index 0073fe96c76e..000000000000 --- a/include/linux/i2c-algo-ite.h +++ /dev/null | |||
@@ -1,72 +0,0 @@ | |||
1 | /* ------------------------------------------------------------------------- */ | ||
2 | /* i2c-algo-ite.h i2c driver algorithms for ITE IIC adapters */ | ||
3 | /* ------------------------------------------------------------------------- */ | ||
4 | /* Copyright (C) 1995-97 Simon G. Vogl | ||
5 | 1998-99 Hans Berglund | ||
6 | |||
7 | This program is free software; you can redistribute it and/or modify | ||
8 | it under the terms of the GNU General Public License as published by | ||
9 | the Free Software Foundation; either version 2 of the License, or | ||
10 | (at your option) any later version. | ||
11 | |||
12 | This program is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | GNU General Public License for more details. | ||
16 | |||
17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program; if not, write to the Free Software | ||
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | ||
20 | /* ------------------------------------------------------------------------- */ | ||
21 | |||
22 | /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even | ||
23 | Frodo Looijaard <frodol@dds.nl> */ | ||
24 | |||
25 | /* Modifications by MontaVista Software, 2001 | ||
26 | Changes made to support the ITE IIC peripheral */ | ||
27 | |||
28 | |||
29 | #ifndef I2C_ALGO_ITE_H | ||
30 | #define I2C_ALGO_ITE_H 1 | ||
31 | |||
32 | #include <linux/types.h> | ||
33 | |||
34 | /* Example of a sequential read request: | ||
35 | struct i2c_iic_msg s_msg; | ||
36 | |||
37 | s_msg.addr=device_address; | ||
38 | s_msg.len=length; | ||
39 | s_msg.buf=buffer; | ||
40 | s_msg.waddr=word_address; | ||
41 | ioctl(file,I2C_SREAD, &s_msg); | ||
42 | */ | ||
43 | #define I2C_SREAD 0x780 /* SREAD ioctl command */ | ||
44 | |||
45 | struct i2c_iic_msg { | ||
46 | __u16 addr; /* device address */ | ||
47 | __u16 waddr; /* word address */ | ||
48 | short len; /* msg length */ | ||
49 | char *buf; /* pointer to msg data */ | ||
50 | }; | ||
51 | |||
52 | #ifdef __KERNEL__ | ||
53 | struct i2c_adapter; | ||
54 | |||
55 | struct i2c_algo_iic_data { | ||
56 | void *data; /* private data for lolevel routines */ | ||
57 | void (*setiic) (void *data, int ctl, int val); | ||
58 | int (*getiic) (void *data, int ctl); | ||
59 | int (*getown) (void *data); | ||
60 | int (*getclock) (void *data); | ||
61 | void (*waitforpin) (void); | ||
62 | |||
63 | /* local settings */ | ||
64 | int udelay; | ||
65 | int mdelay; | ||
66 | int timeout; | ||
67 | }; | ||
68 | |||
69 | int i2c_iic_add_bus(struct i2c_adapter *); | ||
70 | int i2c_iic_del_bus(struct i2c_adapter *); | ||
71 | #endif /* __KERNEL__ */ | ||
72 | #endif /* I2C_ALGO_ITE_H */ | ||
diff --git a/include/linux/i2c-algo-pca.h b/include/linux/i2c-algo-pca.h index 226693e0d88b..fce47c051bb1 100644 --- a/include/linux/i2c-algo-pca.h +++ b/include/linux/i2c-algo-pca.h | |||
@@ -10,6 +10,5 @@ struct i2c_algo_pca_data { | |||
10 | }; | 10 | }; |
11 | 11 | ||
12 | int i2c_pca_add_bus(struct i2c_adapter *); | 12 | int i2c_pca_add_bus(struct i2c_adapter *); |
13 | int i2c_pca_del_bus(struct i2c_adapter *); | ||
14 | 13 | ||
15 | #endif /* _LINUX_I2C_ALGO_PCA_H */ | 14 | #endif /* _LINUX_I2C_ALGO_PCA_H */ |
diff --git a/include/linux/i2c-algo-pcf.h b/include/linux/i2c-algo-pcf.h index 9908f3fc4839..994eb86f882c 100644 --- a/include/linux/i2c-algo-pcf.h +++ b/include/linux/i2c-algo-pcf.h | |||
@@ -31,7 +31,7 @@ struct i2c_algo_pcf_data { | |||
31 | int (*getpcf) (void *data, int ctl); | 31 | int (*getpcf) (void *data, int ctl); |
32 | int (*getown) (void *data); | 32 | int (*getown) (void *data); |
33 | int (*getclock) (void *data); | 33 | int (*getclock) (void *data); |
34 | void (*waitforpin) (void); | 34 | void (*waitforpin) (void); |
35 | 35 | ||
36 | /* local settings */ | 36 | /* local settings */ |
37 | int udelay; | 37 | int udelay; |
@@ -39,6 +39,5 @@ struct i2c_algo_pcf_data { | |||
39 | }; | 39 | }; |
40 | 40 | ||
41 | int i2c_pcf_add_bus(struct i2c_adapter *); | 41 | int i2c_pcf_add_bus(struct i2c_adapter *); |
42 | int i2c_pcf_del_bus(struct i2c_adapter *); | ||
43 | 42 | ||
44 | #endif /* _LINUX_I2C_ALGO_PCF_H */ | 43 | #endif /* _LINUX_I2C_ALGO_PCF_H */ |
diff --git a/include/linux/i2c-algo-sgi.h b/include/linux/i2c-algo-sgi.h index 4a0113d64064..3b7715024e69 100644 --- a/include/linux/i2c-algo-sgi.h +++ b/include/linux/i2c-algo-sgi.h | |||
@@ -22,6 +22,5 @@ struct i2c_algo_sgi_data { | |||
22 | }; | 22 | }; |
23 | 23 | ||
24 | int i2c_sgi_add_bus(struct i2c_adapter *); | 24 | int i2c_sgi_add_bus(struct i2c_adapter *); |
25 | int i2c_sgi_del_bus(struct i2c_adapter *); | ||
26 | 25 | ||
27 | #endif /* I2C_ALGO_SGI_H */ | 26 | #endif /* I2C_ALGO_SGI_H */ |
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h index 0f4cf34b6fa2..7ae3c3326643 100644 --- a/include/linux/i2c-id.h +++ b/include/linux/i2c-id.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* ------------------------------------------------------------------------- */ | 1 | /* ------------------------------------------------------------------------- */ |
2 | /* */ | 2 | /* */ |
3 | /* i2c-id.h - identifier values for i2c drivers and adapters */ | 3 | /* i2c-id.h - identifier values for i2c drivers and adapters */ |
4 | /* */ | 4 | /* */ |
5 | /* ------------------------------------------------------------------------- */ | 5 | /* ------------------------------------------------------------------------- */ |
6 | /* Copyright (C) 1995-1999 Simon G. Vogl | 6 | /* Copyright (C) 1995-1999 Simon G. Vogl |
7 | 7 | ||
@@ -40,10 +40,10 @@ | |||
40 | #define I2C_DRIVERID_SAA7120 11 /* video encoder */ | 40 | #define I2C_DRIVERID_SAA7120 11 /* video encoder */ |
41 | #define I2C_DRIVERID_SAA7121 12 /* video encoder */ | 41 | #define I2C_DRIVERID_SAA7121 12 /* video encoder */ |
42 | #define I2C_DRIVERID_SAA7185B 13 /* video encoder */ | 42 | #define I2C_DRIVERID_SAA7185B 13 /* video encoder */ |
43 | #define I2C_DRIVERID_CH7003 14 /* digital pc to tv encoder */ | 43 | #define I2C_DRIVERID_CH7003 14 /* digital pc to tv encoder */ |
44 | #define I2C_DRIVERID_PCF8574A 15 /* i2c expander - 8 bit in/out */ | 44 | #define I2C_DRIVERID_PCF8574A 15 /* i2c expander - 8 bit in/out */ |
45 | #define I2C_DRIVERID_PCF8582C 16 /* eeprom */ | 45 | #define I2C_DRIVERID_PCF8582C 16 /* eeprom */ |
46 | #define I2C_DRIVERID_AT24Cxx 17 /* eeprom 1/2/4/8/16 K */ | 46 | #define I2C_DRIVERID_AT24Cxx 17 /* eeprom 1/2/4/8/16 K */ |
47 | #define I2C_DRIVERID_TEA6300 18 /* audio mixer */ | 47 | #define I2C_DRIVERID_TEA6300 18 /* audio mixer */ |
48 | #define I2C_DRIVERID_BT829 19 /* pc to tv encoder */ | 48 | #define I2C_DRIVERID_BT829 19 /* pc to tv encoder */ |
49 | #define I2C_DRIVERID_TDA9850 20 /* audio mixer */ | 49 | #define I2C_DRIVERID_TDA9850 20 /* audio mixer */ |
@@ -82,9 +82,8 @@ | |||
82 | #define I2C_DRIVERID_STM41T00 52 /* real time clock */ | 82 | #define I2C_DRIVERID_STM41T00 52 /* real time clock */ |
83 | #define I2C_DRIVERID_UDA1342 53 /* UDA1342 audio codec */ | 83 | #define I2C_DRIVERID_UDA1342 53 /* UDA1342 audio codec */ |
84 | #define I2C_DRIVERID_ADV7170 54 /* video encoder */ | 84 | #define I2C_DRIVERID_ADV7170 54 /* video encoder */ |
85 | #define I2C_DRIVERID_RADEON 55 /* I2C bus on Radeon boards */ | ||
86 | #define I2C_DRIVERID_MAX1617 56 /* temp sensor */ | 85 | #define I2C_DRIVERID_MAX1617 56 /* temp sensor */ |
87 | #define I2C_DRIVERID_SAA7191 57 /* video encoder */ | 86 | #define I2C_DRIVERID_SAA7191 57 /* video decoder */ |
88 | #define I2C_DRIVERID_INDYCAM 58 /* SGI IndyCam */ | 87 | #define I2C_DRIVERID_INDYCAM 58 /* SGI IndyCam */ |
89 | #define I2C_DRIVERID_BT832 59 /* CMOS camera video processor */ | 88 | #define I2C_DRIVERID_BT832 59 /* CMOS camera video processor */ |
90 | #define I2C_DRIVERID_TDA9887 60 /* TDA988x IF-PLL demodulator */ | 89 | #define I2C_DRIVERID_TDA9887 60 /* TDA988x IF-PLL demodulator */ |
@@ -132,7 +131,6 @@ | |||
132 | #define I2C_DRIVERID_ADM1021 1008 | 131 | #define I2C_DRIVERID_ADM1021 1008 |
133 | #define I2C_DRIVERID_ADM9240 1009 | 132 | #define I2C_DRIVERID_ADM9240 1009 |
134 | #define I2C_DRIVERID_LTC1710 1010 | 133 | #define I2C_DRIVERID_LTC1710 1010 |
135 | #define I2C_DRIVERID_ICSPLL 1012 | ||
136 | #define I2C_DRIVERID_BT869 1013 | 134 | #define I2C_DRIVERID_BT869 1013 |
137 | #define I2C_DRIVERID_MAXILIFE 1014 | 135 | #define I2C_DRIVERID_MAXILIFE 1014 |
138 | #define I2C_DRIVERID_MATORB 1015 | 136 | #define I2C_DRIVERID_MATORB 1015 |
@@ -165,7 +163,7 @@ | |||
165 | * ---- Adapter types ---------------------------------------------------- | 163 | * ---- Adapter types ---------------------------------------------------- |
166 | */ | 164 | */ |
167 | 165 | ||
168 | /* --- Bit algorithm adapters */ | 166 | /* --- Bit algorithm adapters */ |
169 | #define I2C_HW_B_LP 0x010000 /* Parallel port Philips style */ | 167 | #define I2C_HW_B_LP 0x010000 /* Parallel port Philips style */ |
170 | #define I2C_HW_B_SER 0x010002 /* Serial line interface */ | 168 | #define I2C_HW_B_SER 0x010002 /* Serial line interface */ |
171 | #define I2C_HW_B_BT848 0x010005 /* BT848 video boards */ | 169 | #define I2C_HW_B_BT848 0x010005 /* BT848 video boards */ |
@@ -213,9 +211,6 @@ | |||
213 | /* --- MPC8xx PowerPC adapters */ | 211 | /* --- MPC8xx PowerPC adapters */ |
214 | #define I2C_HW_MPC8XX_EPON 0x110000 /* Eponymous MPC8xx I2C adapter */ | 212 | #define I2C_HW_MPC8XX_EPON 0x110000 /* Eponymous MPC8xx I2C adapter */ |
215 | 213 | ||
216 | /* --- ITE based algorithms */ | ||
217 | #define I2C_HW_I_IIC 0x080000 /* controller on the ITE */ | ||
218 | |||
219 | /* --- PowerPC on-chip adapters */ | 214 | /* --- PowerPC on-chip adapters */ |
220 | #define I2C_HW_OCP 0x120000 /* IBM on-chip I2C adapter */ | 215 | #define I2C_HW_OCP 0x120000 /* IBM on-chip I2C adapter */ |
221 | 216 | ||
diff --git a/include/linux/i2c-pnx.h b/include/linux/i2c-pnx.h new file mode 100644 index 000000000000..e6e9c814da61 --- /dev/null +++ b/include/linux/i2c-pnx.h | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * Header file for I2C support on PNX010x/4008. | ||
3 | * | ||
4 | * Author: Dennis Kovalev <dkovalev@ru.mvista.com> | ||
5 | * | ||
6 | * 2004-2006 (c) MontaVista Software, Inc. This file is licensed under | ||
7 | * the terms of the GNU General Public License version 2. This program | ||
8 | * is licensed "as is" without any warranty of any kind, whether express | ||
9 | * or implied. | ||
10 | */ | ||
11 | |||
12 | #ifndef __I2C_PNX_H__ | ||
13 | #define __I2C_PNX_H__ | ||
14 | |||
15 | #include <asm/arch/i2c.h> | ||
16 | |||
17 | struct i2c_pnx_mif { | ||
18 | int ret; /* Return value */ | ||
19 | int mode; /* Interface mode */ | ||
20 | struct completion complete; /* I/O completion */ | ||
21 | struct timer_list timer; /* Timeout */ | ||
22 | char * buf; /* Data buffer */ | ||
23 | int len; /* Length of data buffer */ | ||
24 | }; | ||
25 | |||
26 | struct i2c_pnx_algo_data { | ||
27 | u32 base; | ||
28 | u32 ioaddr; | ||
29 | int irq; | ||
30 | struct i2c_pnx_mif mif; | ||
31 | int last; | ||
32 | }; | ||
33 | |||
34 | struct i2c_pnx_data { | ||
35 | int (*suspend) (struct platform_device *pdev, pm_message_t state); | ||
36 | int (*resume) (struct platform_device *pdev); | ||
37 | u32 (*calculate_input_freq) (struct platform_device *pdev); | ||
38 | int (*set_clock_run) (struct platform_device *pdev); | ||
39 | int (*set_clock_stop) (struct platform_device *pdev); | ||
40 | struct i2c_adapter *adapter; | ||
41 | }; | ||
42 | |||
43 | #endif /* __I2C_PNX_H__ */ | ||
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 9b5d04768c2c..71e50d3e492f 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* ------------------------------------------------------------------------- */ | 1 | /* ------------------------------------------------------------------------- */ |
2 | /* */ | 2 | /* */ |
3 | /* i2c.h - definitions for the i2c-bus interface */ | 3 | /* i2c.h - definitions for the i2c-bus interface */ |
4 | /* */ | 4 | /* */ |
5 | /* ------------------------------------------------------------------------- */ | 5 | /* ------------------------------------------------------------------------- */ |
6 | /* Copyright (C) 1995-2000 Simon G. Vogl | 6 | /* Copyright (C) 1995-2000 Simon G. Vogl |
7 | 7 | ||
@@ -27,7 +27,7 @@ | |||
27 | #define _LINUX_I2C_H | 27 | #define _LINUX_I2C_H |
28 | 28 | ||
29 | #include <linux/types.h> | 29 | #include <linux/types.h> |
30 | #ifdef __KERNEL__ | 30 | #ifdef __KERNEL__ |
31 | #include <linux/module.h> | 31 | #include <linux/module.h> |
32 | #include <linux/i2c-id.h> | 32 | #include <linux/i2c-id.h> |
33 | #include <linux/mod_devicetable.h> | 33 | #include <linux/mod_devicetable.h> |
@@ -53,8 +53,8 @@ union i2c_smbus_data; | |||
53 | 53 | ||
54 | /* | 54 | /* |
55 | * The master routines are the ones normally used to transmit data to devices | 55 | * The master routines are the ones normally used to transmit data to devices |
56 | * on a bus (or read from them). Apart from two basic transfer functions to | 56 | * on a bus (or read from them). Apart from two basic transfer functions to |
57 | * transmit one message at a time, a more complex version can be used to | 57 | * transmit one message at a time, a more complex version can be used to |
58 | * transmit an arbitrary number of messages without interruption. | 58 | * transmit an arbitrary number of messages without interruption. |
59 | */ | 59 | */ |
60 | extern int i2c_master_send(struct i2c_client *,const char* ,int); | 60 | extern int i2c_master_send(struct i2c_client *,const char* ,int); |
@@ -67,10 +67,10 @@ extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | |||
67 | 67 | ||
68 | /* This is the very generalized SMBus access routine. You probably do not | 68 | /* This is the very generalized SMBus access routine. You probably do not |
69 | want to use this, though; one of the functions below may be much easier, | 69 | want to use this, though; one of the functions below may be much easier, |
70 | and probably just as fast. | 70 | and probably just as fast. |
71 | Note that we use i2c_adapter here, because you do not need a specific | 71 | Note that we use i2c_adapter here, because you do not need a specific |
72 | smbus adapter to call this function. */ | 72 | smbus adapter to call this function. */ |
73 | extern s32 i2c_smbus_xfer (struct i2c_adapter * adapter, u16 addr, | 73 | extern s32 i2c_smbus_xfer (struct i2c_adapter * adapter, u16 addr, |
74 | unsigned short flags, | 74 | unsigned short flags, |
75 | char read_write, u8 command, int size, | 75 | char read_write, u8 command, int size, |
76 | union i2c_smbus_data * data); | 76 | union i2c_smbus_data * data); |
@@ -112,14 +112,14 @@ struct i2c_driver { | |||
112 | 112 | ||
113 | /* Notifies the driver that a new bus has appeared. This routine | 113 | /* Notifies the driver that a new bus has appeared. This routine |
114 | * can be used by the driver to test if the bus meets its conditions | 114 | * can be used by the driver to test if the bus meets its conditions |
115 | * & seek for the presence of the chip(s) it supports. If found, it | 115 | * & seek for the presence of the chip(s) it supports. If found, it |
116 | * registers the client(s) that are on the bus to the i2c admin. via | 116 | * registers the client(s) that are on the bus to the i2c admin. via |
117 | * i2c_attach_client. | 117 | * i2c_attach_client. |
118 | */ | 118 | */ |
119 | int (*attach_adapter)(struct i2c_adapter *); | 119 | int (*attach_adapter)(struct i2c_adapter *); |
120 | int (*detach_adapter)(struct i2c_adapter *); | 120 | int (*detach_adapter)(struct i2c_adapter *); |
121 | 121 | ||
122 | /* tells the driver that a client is about to be deleted & gives it | 122 | /* tells the driver that a client is about to be deleted & gives it |
123 | * the chance to remove its private data. Also, if the client struct | 123 | * the chance to remove its private data. Also, if the client struct |
124 | * has been dynamically allocated by the driver in the function above, | 124 | * has been dynamically allocated by the driver in the function above, |
125 | * it must be freed here. | 125 | * it must be freed here. |
@@ -139,13 +139,13 @@ struct i2c_driver { | |||
139 | #define I2C_NAME_SIZE 50 | 139 | #define I2C_NAME_SIZE 50 |
140 | 140 | ||
141 | /* | 141 | /* |
142 | * i2c_client identifies a single device (i.e. chip) that is connected to an | 142 | * i2c_client identifies a single device (i.e. chip) that is connected to an |
143 | * i2c bus. The behaviour is defined by the routines of the driver. This | 143 | * i2c bus. The behaviour is defined by the routines of the driver. This |
144 | * function is mainly used for lookup & other admin. functions. | 144 | * function is mainly used for lookup & other admin. functions. |
145 | */ | 145 | */ |
146 | struct i2c_client { | 146 | struct i2c_client { |
147 | unsigned int flags; /* div., see below */ | 147 | unsigned int flags; /* div., see below */ |
148 | unsigned short addr; /* chip address - NOTE: 7bit */ | 148 | unsigned short addr; /* chip address - NOTE: 7bit */ |
149 | /* addresses are stored in the */ | 149 | /* addresses are stored in the */ |
150 | /* _LOWER_ 7 bits */ | 150 | /* _LOWER_ 7 bits */ |
151 | struct i2c_adapter *adapter; /* the adapter we sit on */ | 151 | struct i2c_adapter *adapter; /* the adapter we sit on */ |
@@ -182,14 +182,14 @@ static inline void i2c_set_clientdata (struct i2c_client *dev, void *data) | |||
182 | */ | 182 | */ |
183 | struct i2c_algorithm { | 183 | struct i2c_algorithm { |
184 | /* If an adapter algorithm can't do I2C-level access, set master_xfer | 184 | /* If an adapter algorithm can't do I2C-level access, set master_xfer |
185 | to NULL. If an adapter algorithm can do SMBus access, set | 185 | to NULL. If an adapter algorithm can do SMBus access, set |
186 | smbus_xfer. If set to NULL, the SMBus protocol is simulated | 186 | smbus_xfer. If set to NULL, the SMBus protocol is simulated |
187 | using common I2C messages */ | 187 | using common I2C messages */ |
188 | /* master_xfer should return the number of messages successfully | 188 | /* master_xfer should return the number of messages successfully |
189 | processed, or a negative value on error */ | 189 | processed, or a negative value on error */ |
190 | int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg *msgs, | 190 | int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg *msgs, |
191 | int num); | 191 | int num); |
192 | int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr, | 192 | int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr, |
193 | unsigned short flags, char read_write, | 193 | unsigned short flags, char read_write, |
194 | u8 command, int size, union i2c_smbus_data * data); | 194 | u8 command, int size, union i2c_smbus_data * data); |
195 | 195 | ||
@@ -216,6 +216,7 @@ struct i2c_adapter { | |||
216 | int (*client_unregister)(struct i2c_client *); | 216 | int (*client_unregister)(struct i2c_client *); |
217 | 217 | ||
218 | /* data fields that are valid for all devices */ | 218 | /* data fields that are valid for all devices */ |
219 | u8 level; /* nesting level for lockdep */ | ||
219 | struct mutex bus_lock; | 220 | struct mutex bus_lock; |
220 | struct mutex clist_lock; | 221 | struct mutex clist_lock; |
221 | 222 | ||
@@ -316,7 +317,7 @@ extern int i2c_check_addr (struct i2c_adapter *adapter, int addr); | |||
316 | * It will only call found_proc if some client is connected at the | 317 | * It will only call found_proc if some client is connected at the |
317 | * specific address (unless a 'force' matched); | 318 | * specific address (unless a 'force' matched); |
318 | */ | 319 | */ |
319 | extern int i2c_probe(struct i2c_adapter *adapter, | 320 | extern int i2c_probe(struct i2c_adapter *adapter, |
320 | struct i2c_client_address_data *address_data, | 321 | struct i2c_client_address_data *address_data, |
321 | int (*found_proc) (struct i2c_adapter *, int, int)); | 322 | int (*found_proc) (struct i2c_adapter *, int, int)); |
322 | 323 | ||
@@ -352,15 +353,15 @@ static inline int i2c_adapter_id(struct i2c_adapter *adap) | |||
352 | */ | 353 | */ |
353 | struct i2c_msg { | 354 | struct i2c_msg { |
354 | __u16 addr; /* slave address */ | 355 | __u16 addr; /* slave address */ |
355 | __u16 flags; | 356 | __u16 flags; |
356 | #define I2C_M_TEN 0x10 /* we have a ten bit chip address */ | 357 | #define I2C_M_TEN 0x10 /* we have a ten bit chip address */ |
357 | #define I2C_M_RD 0x01 | 358 | #define I2C_M_RD 0x01 |
358 | #define I2C_M_NOSTART 0x4000 | 359 | #define I2C_M_NOSTART 0x4000 |
359 | #define I2C_M_REV_DIR_ADDR 0x2000 | 360 | #define I2C_M_REV_DIR_ADDR 0x2000 |
360 | #define I2C_M_IGNORE_NAK 0x1000 | 361 | #define I2C_M_IGNORE_NAK 0x1000 |
361 | #define I2C_M_NO_RD_ACK 0x0800 | 362 | #define I2C_M_NO_RD_ACK 0x0800 |
362 | __u16 len; /* msg length */ | 363 | __u16 len; /* msg length */ |
363 | __u8 *buf; /* pointer to msg data */ | 364 | __u8 *buf; /* pointer to msg data */ |
364 | }; | 365 | }; |
365 | 366 | ||
366 | /* To determine what functionality is present */ | 367 | /* To determine what functionality is present */ |
@@ -370,16 +371,16 @@ struct i2c_msg { | |||
370 | #define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART,..} */ | 371 | #define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART,..} */ |
371 | #define I2C_FUNC_SMBUS_HWPEC_CALC 0x00000008 /* SMBus 2.0 */ | 372 | #define I2C_FUNC_SMBUS_HWPEC_CALC 0x00000008 /* SMBus 2.0 */ |
372 | #define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */ | 373 | #define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */ |
373 | #define I2C_FUNC_SMBUS_QUICK 0x00010000 | 374 | #define I2C_FUNC_SMBUS_QUICK 0x00010000 |
374 | #define I2C_FUNC_SMBUS_READ_BYTE 0x00020000 | 375 | #define I2C_FUNC_SMBUS_READ_BYTE 0x00020000 |
375 | #define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000 | 376 | #define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000 |
376 | #define I2C_FUNC_SMBUS_READ_BYTE_DATA 0x00080000 | 377 | #define I2C_FUNC_SMBUS_READ_BYTE_DATA 0x00080000 |
377 | #define I2C_FUNC_SMBUS_WRITE_BYTE_DATA 0x00100000 | 378 | #define I2C_FUNC_SMBUS_WRITE_BYTE_DATA 0x00100000 |
378 | #define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000 | 379 | #define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000 |
379 | #define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000 | 380 | #define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000 |
380 | #define I2C_FUNC_SMBUS_PROC_CALL 0x00800000 | 381 | #define I2C_FUNC_SMBUS_PROC_CALL 0x00800000 |
381 | #define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000 | 382 | #define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000 |
382 | #define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000 | 383 | #define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000 |
383 | #define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */ | 384 | #define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */ |
384 | #define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */ | 385 | #define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */ |
385 | #define I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 0x10000000 /* I2C-like block xfer */ | 386 | #define I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 0x10000000 /* I2C-like block xfer */ |
@@ -406,10 +407,10 @@ struct i2c_msg { | |||
406 | I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \ | 407 | I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \ |
407 | I2C_FUNC_SMBUS_I2C_BLOCK) | 408 | I2C_FUNC_SMBUS_I2C_BLOCK) |
408 | 409 | ||
409 | /* | 410 | /* |
410 | * Data for SMBus Messages | 411 | * Data for SMBus Messages |
411 | */ | 412 | */ |
412 | #define I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */ | 413 | #define I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */ |
413 | union i2c_smbus_data { | 414 | union i2c_smbus_data { |
414 | __u8 byte; | 415 | __u8 byte; |
415 | __u16 word; | 416 | __u16 word; |
@@ -421,11 +422,11 @@ union i2c_smbus_data { | |||
421 | #define I2C_SMBUS_READ 1 | 422 | #define I2C_SMBUS_READ 1 |
422 | #define I2C_SMBUS_WRITE 0 | 423 | #define I2C_SMBUS_WRITE 0 |
423 | 424 | ||
424 | /* SMBus transaction types (size parameter in the above functions) | 425 | /* SMBus transaction types (size parameter in the above functions) |
425 | Note: these no longer correspond to the (arbitrary) PIIX4 internal codes! */ | 426 | Note: these no longer correspond to the (arbitrary) PIIX4 internal codes! */ |
426 | #define I2C_SMBUS_QUICK 0 | 427 | #define I2C_SMBUS_QUICK 0 |
427 | #define I2C_SMBUS_BYTE 1 | 428 | #define I2C_SMBUS_BYTE 1 |
428 | #define I2C_SMBUS_BYTE_DATA 2 | 429 | #define I2C_SMBUS_BYTE_DATA 2 |
429 | #define I2C_SMBUS_WORD_DATA 3 | 430 | #define I2C_SMBUS_WORD_DATA 3 |
430 | #define I2C_SMBUS_PROC_CALL 4 | 431 | #define I2C_SMBUS_PROC_CALL 4 |
431 | #define I2C_SMBUS_BLOCK_DATA 5 | 432 | #define I2C_SMBUS_BLOCK_DATA 5 |
@@ -434,15 +435,15 @@ union i2c_smbus_data { | |||
434 | 435 | ||
435 | 436 | ||
436 | /* ----- commands for the ioctl like i2c_command call: | 437 | /* ----- commands for the ioctl like i2c_command call: |
437 | * note that additional calls are defined in the algorithm and hw | 438 | * note that additional calls are defined in the algorithm and hw |
438 | * dependent layers - these can be listed here, or see the | 439 | * dependent layers - these can be listed here, or see the |
439 | * corresponding header files. | 440 | * corresponding header files. |
440 | */ | 441 | */ |
441 | /* -> bit-adapter specific ioctls */ | 442 | /* -> bit-adapter specific ioctls */ |
442 | #define I2C_RETRIES 0x0701 /* number of times a device address */ | 443 | #define I2C_RETRIES 0x0701 /* number of times a device address */ |
443 | /* should be polled when not */ | 444 | /* should be polled when not */ |
444 | /* acknowledging */ | 445 | /* acknowledging */ |
445 | #define I2C_TIMEOUT 0x0702 /* set timeout - call with int */ | 446 | #define I2C_TIMEOUT 0x0702 /* set timeout - call with int */ |
446 | 447 | ||
447 | 448 | ||
448 | /* this is for i2c-dev.c */ | 449 | /* this is for i2c-dev.c */ |
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h index 46000936f8f1..6b0648cfdffc 100644 --- a/include/linux/seqlock.h +++ b/include/linux/seqlock.h | |||
@@ -44,8 +44,11 @@ typedef struct { | |||
44 | #define SEQLOCK_UNLOCKED \ | 44 | #define SEQLOCK_UNLOCKED \ |
45 | __SEQLOCK_UNLOCKED(old_style_seqlock_init) | 45 | __SEQLOCK_UNLOCKED(old_style_seqlock_init) |
46 | 46 | ||
47 | #define seqlock_init(x) \ | 47 | #define seqlock_init(x) \ |
48 | do { *(x) = (seqlock_t) __SEQLOCK_UNLOCKED(x); } while (0) | 48 | do { \ |
49 | (x)->sequence = 0; \ | ||
50 | spin_lock_init(&(x)->lock); \ | ||
51 | } while (0) | ||
49 | 52 | ||
50 | #define DEFINE_SEQLOCK(x) \ | 53 | #define DEFINE_SEQLOCK(x) \ |
51 | seqlock_t x = __SEQLOCK_UNLOCKED(x) | 54 | seqlock_t x = __SEQLOCK_UNLOCKED(x) |
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index a01abdd2d3ea..823215d8e90f 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
@@ -55,6 +55,7 @@ static void queue_process(struct work_struct *work) | |||
55 | struct netpoll_info *npinfo = | 55 | struct netpoll_info *npinfo = |
56 | container_of(work, struct netpoll_info, tx_work.work); | 56 | container_of(work, struct netpoll_info, tx_work.work); |
57 | struct sk_buff *skb; | 57 | struct sk_buff *skb; |
58 | unsigned long flags; | ||
58 | 59 | ||
59 | while ((skb = skb_dequeue(&npinfo->txq))) { | 60 | while ((skb = skb_dequeue(&npinfo->txq))) { |
60 | struct net_device *dev = skb->dev; | 61 | struct net_device *dev = skb->dev; |
@@ -64,15 +65,19 @@ static void queue_process(struct work_struct *work) | |||
64 | continue; | 65 | continue; |
65 | } | 66 | } |
66 | 67 | ||
67 | netif_tx_lock_bh(dev); | 68 | local_irq_save(flags); |
69 | netif_tx_lock(dev); | ||
68 | if (netif_queue_stopped(dev) || | 70 | if (netif_queue_stopped(dev) || |
69 | dev->hard_start_xmit(skb, dev) != NETDEV_TX_OK) { | 71 | dev->hard_start_xmit(skb, dev) != NETDEV_TX_OK) { |
70 | skb_queue_head(&npinfo->txq, skb); | 72 | skb_queue_head(&npinfo->txq, skb); |
71 | netif_tx_unlock_bh(dev); | 73 | netif_tx_unlock(dev); |
74 | local_irq_restore(flags); | ||
72 | 75 | ||
73 | schedule_delayed_work(&npinfo->tx_work, HZ/10); | 76 | schedule_delayed_work(&npinfo->tx_work, HZ/10); |
74 | return; | 77 | return; |
75 | } | 78 | } |
79 | netif_tx_unlock(dev); | ||
80 | local_irq_restore(flags); | ||
76 | } | 81 | } |
77 | } | 82 | } |
78 | 83 | ||
diff --git a/sound/Kconfig b/sound/Kconfig index 95949b6806ac..9d77300746c6 100644 --- a/sound/Kconfig +++ b/sound/Kconfig | |||
@@ -93,4 +93,12 @@ endmenu | |||
93 | 93 | ||
94 | endif | 94 | endif |
95 | 95 | ||
96 | config AC97_BUS | ||
97 | tristate | ||
98 | help | ||
99 | This is used to avoid config and link hard dependencies between the | ||
100 | sound subsystem and other function drivers completely unrelated to | ||
101 | sound although they're sharing the AC97 bus. Concerned drivers | ||
102 | should "select" this. | ||
103 | |||
96 | endmenu | 104 | endmenu |
diff --git a/sound/Makefile b/sound/Makefile index 5f6bef57e825..9aee54c4882d 100644 --- a/sound/Makefile +++ b/sound/Makefile | |||
@@ -8,6 +8,9 @@ obj-$(CONFIG_DMASOUND) += oss/ | |||
8 | obj-$(CONFIG_SND) += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ synth/ usb/ sparc/ parisc/ pcmcia/ mips/ | 8 | obj-$(CONFIG_SND) += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ synth/ usb/ sparc/ parisc/ pcmcia/ mips/ |
9 | obj-$(CONFIG_SND_AOA) += aoa/ | 9 | obj-$(CONFIG_SND_AOA) += aoa/ |
10 | 10 | ||
11 | # This one must be compilable even if sound is configured out | ||
12 | obj-$(CONFIG_AC97_BUS) += ac97_bus.o | ||
13 | |||
11 | ifeq ($(CONFIG_SND),y) | 14 | ifeq ($(CONFIG_SND),y) |
12 | obj-y += last.o | 15 | obj-y += last.o |
13 | endif | 16 | endif |
diff --git a/sound/pci/ac97/ac97_bus.c b/sound/ac97_bus.c index 66de2c2f1554..66de2c2f1554 100644 --- a/sound/pci/ac97/ac97_bus.c +++ b/sound/ac97_bus.c | |||
diff --git a/sound/drivers/Kconfig b/sound/drivers/Kconfig index 7971285dfd5b..40ebd2f44056 100644 --- a/sound/drivers/Kconfig +++ b/sound/drivers/Kconfig | |||
@@ -26,11 +26,7 @@ config SND_VX_LIB | |||
26 | config SND_AC97_CODEC | 26 | config SND_AC97_CODEC |
27 | tristate | 27 | tristate |
28 | select SND_PCM | 28 | select SND_PCM |
29 | select SND_AC97_BUS | 29 | select AC97_BUS |
30 | |||
31 | config SND_AC97_BUS | ||
32 | tristate | ||
33 | |||
34 | 30 | ||
35 | config SND_DUMMY | 31 | config SND_DUMMY |
36 | tristate "Dummy (/dev/null) soundcard" | 32 | tristate "Dummy (/dev/null) soundcard" |
diff --git a/sound/pci/ac97/Makefile b/sound/pci/ac97/Makefile index 77b3482cb133..3c3222122d8b 100644 --- a/sound/pci/ac97/Makefile +++ b/sound/pci/ac97/Makefile | |||
@@ -10,11 +10,9 @@ snd-ac97-codec-objs += ac97_proc.o | |||
10 | endif | 10 | endif |
11 | 11 | ||
12 | snd-ak4531-codec-objs := ak4531_codec.o | 12 | snd-ak4531-codec-objs := ak4531_codec.o |
13 | snd-ac97-bus-objs := ac97_bus.o | ||
14 | 13 | ||
15 | # Toplevel Module Dependency | 14 | # Toplevel Module Dependency |
16 | obj-$(CONFIG_SND_AC97_CODEC) += snd-ac97-codec.o | 15 | obj-$(CONFIG_SND_AC97_CODEC) += snd-ac97-codec.o |
17 | obj-$(CONFIG_SND_ENS1370) += snd-ak4531-codec.o | 16 | obj-$(CONFIG_SND_ENS1370) += snd-ak4531-codec.o |
18 | obj-$(CONFIG_SND_AC97_BUS) += snd-ac97-bus.o | ||
19 | 17 | ||
20 | obj-m := $(sort $(obj-m)) | 18 | obj-m := $(sort $(obj-m)) |