aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS2
-rw-r--r--arch/arm/common/uengine.c6
-rw-r--r--arch/arm/kernel/entry-armv.S96
-rw-r--r--arch/arm/kernel/traps.c5
-rw-r--r--arch/arm/mach-at91/at91rm9200_devices.c41
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c42
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c42
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c42
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c43
-rw-r--r--arch/arm/mach-at91/board-carmeva.c2
-rw-r--r--arch/arm/mach-at91/board-csb337.c11
-rw-r--r--arch/arm/mach-at91/board-csb637.c2
-rw-r--r--arch/arm/mach-at91/board-dk.c15
-rw-r--r--arch/arm/mach-at91/board-eb9200.c10
-rw-r--r--arch/arm/mach-at91/board-ek.c2
-rw-r--r--arch/arm/mach-at91/board-kafa.c2
-rw-r--r--arch/arm/mach-at91/board-kb9202.c2
-rw-r--r--arch/arm/mach-at91/board-picotux200.c2
-rw-r--r--arch/arm/mach-at91/board-sam9260ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c18
-rw-r--r--arch/arm/mach-at91/board-sam9263ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9rlek.c2
-rw-r--r--arch/arm/mach-at91/clock.c9
-rw-r--r--arch/arm/mach-imx/irq.c51
-rw-r--r--arch/arm/mach-pxa/pxa27x.c2
-rw-r--r--arch/arm/mach-pxa/pxa320.c7
-rw-r--r--arch/arm/mach-pxa/ssp.c1
-rw-r--r--drivers/serial/pxa.c4
-rw-r--r--include/asm-arm/arch-at91/board.h3
-rw-r--r--include/asm-arm/arch-ixp23xx/irqs.h2
-rw-r--r--include/asm-arm/arch-omap/board-innovator.h2
-rw-r--r--include/asm-arm/arch-pxa/irqs.h20
-rw-r--r--include/asm-arm/arch-pxa/mfp-pxa300.h2
-rw-r--r--include/asm-arm/arch-pxa/mfp-pxa320.h2
-rw-r--r--include/asm-arm/arch-pxa/mfp.h18
-rw-r--r--include/asm-arm/arch-pxa/pxa-regs.h5
36 files changed, 403 insertions, 116 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index ac425b5b4a40..7c8392e1797d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -439,7 +439,7 @@ S: Maintained
439 439
440ARM/ATMEL AT91RM9200 ARM ARCHITECTURE 440ARM/ATMEL AT91RM9200 ARM ARCHITECTURE
441P: Andrew Victor 441P: Andrew Victor
442M: andrew@sanpeople.com 442M: linux@maxim.org.za
443L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only) 443L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
444W: http://maxim.org.za/at91_26.html 444W: http://maxim.org.za/at91_26.html
445S: Maintained 445S: Maintained
diff --git a/arch/arm/common/uengine.c b/arch/arm/common/uengine.c
index 95c8508c29b7..117cab30bd36 100644
--- a/arch/arm/common/uengine.c
+++ b/arch/arm/common/uengine.c
@@ -374,8 +374,8 @@ static int set_initial_registers(int uengine, struct ixp2000_uengine_code *c)
374 u8 *ucode; 374 u8 *ucode;
375 int i; 375 int i;
376 376
377 gpr_a = kmalloc(128 * sizeof(u32), GFP_KERNEL); 377 gpr_a = kzalloc(128 * sizeof(u32), GFP_KERNEL);
378 gpr_b = kmalloc(128 * sizeof(u32), GFP_KERNEL); 378 gpr_b = kzalloc(128 * sizeof(u32), GFP_KERNEL);
379 ucode = kmalloc(513 * 5, GFP_KERNEL); 379 ucode = kmalloc(513 * 5, GFP_KERNEL);
380 if (gpr_a == NULL || gpr_b == NULL || ucode == NULL) { 380 if (gpr_a == NULL || gpr_b == NULL || ucode == NULL) {
381 kfree(ucode); 381 kfree(ucode);
@@ -388,8 +388,6 @@ static int set_initial_registers(int uengine, struct ixp2000_uengine_code *c)
388 if (c->uengine_parameters & IXP2000_UENGINE_4_CONTEXTS) 388 if (c->uengine_parameters & IXP2000_UENGINE_4_CONTEXTS)
389 per_ctx_regs = 32; 389 per_ctx_regs = 32;
390 390
391 memset(gpr_a, 0, sizeof(gpr_a));
392 memset(gpr_b, 0, sizeof(gpr_b));
393 for (i = 0; i < 256; i++) { 391 for (i = 0; i < 256; i++) {
394 struct ixp2000_reg_value *r = c->initial_reg_values + i; 392 struct ixp2000_reg_value *r = c->initial_reg_values + i;
395 u32 *bank; 393 u32 *bank;
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index d645897652c2..29dec080a604 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -339,16 +339,6 @@ __pabt_svc:
339 str r1, [sp] @ save the "real" r0 copied 339 str r1, [sp] @ save the "real" r0 copied
340 @ from the exception stack 340 @ from the exception stack
341 341
342#if __LINUX_ARM_ARCH__ < 6 && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
343#ifndef CONFIG_MMU
344#warning "NPTL on non MMU needs fixing"
345#else
346 @ make sure our user space atomic helper is aborted
347 cmp r2, #TASK_SIZE
348 bichs r3, r3, #PSR_Z_BIT
349#endif
350#endif
351
352 @ 342 @
353 @ We are now ready to fill in the remaining blanks on the stack: 343 @ We are now ready to fill in the remaining blanks on the stack:
354 @ 344 @
@@ -372,9 +362,25 @@ __pabt_svc:
372 zero_fp 362 zero_fp
373 .endm 363 .endm
374 364
365 .macro kuser_cmpxchg_check
366#if __LINUX_ARM_ARCH__ < 6 && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
367#ifndef CONFIG_MMU
368#warning "NPTL on non MMU needs fixing"
369#else
370 @ Make sure our user space atomic helper is restarted
371 @ if it was interrupted in a critical region. Here we
372 @ perform a quick test inline since it should be false
373 @ 99.9999% of the time. The rest is done out of line.
374 cmp r2, #TASK_SIZE
375 blhs kuser_cmpxchg_fixup
376#endif
377#endif
378 .endm
379
375 .align 5 380 .align 5
376__dabt_usr: 381__dabt_usr:
377 usr_entry 382 usr_entry
383 kuser_cmpxchg_check
378 384
379 @ 385 @
380 @ Call the processor-specific abort handler: 386 @ Call the processor-specific abort handler:
@@ -404,6 +410,7 @@ __dabt_usr:
404 .align 5 410 .align 5
405__irq_usr: 411__irq_usr:
406 usr_entry 412 usr_entry
413 kuser_cmpxchg_check
407 414
408#ifdef CONFIG_TRACE_IRQFLAGS 415#ifdef CONFIG_TRACE_IRQFLAGS
409 bl trace_hardirqs_off 416 bl trace_hardirqs_off
@@ -446,9 +453,9 @@ __und_usr:
446 @ 453 @
447 @ r0 - instruction 454 @ r0 - instruction
448 @ 455 @
4491: ldrt r0, [r4]
450 adr r9, ret_from_exception 456 adr r9, ret_from_exception
451 adr lr, __und_usr_unknown 457 adr lr, __und_usr_unknown
4581: ldrt r0, [r4]
452 @ 459 @
453 @ fallthrough to call_fpe 460 @ fallthrough to call_fpe
454 @ 461 @
@@ -669,7 +676,7 @@ __kuser_helper_start:
669 * 676 *
670 * Clobbered: 677 * Clobbered:
671 * 678 *
672 * the Z flag might be lost 679 * none
673 * 680 *
674 * Definition and user space usage example: 681 * Definition and user space usage example:
675 * 682 *
@@ -730,9 +737,6 @@ __kuser_memory_barrier: @ 0xffff0fa0
730 * 737 *
731 * - This routine already includes memory barriers as needed. 738 * - This routine already includes memory barriers as needed.
732 * 739 *
733 * - A failure might be transient, i.e. it is possible, although unlikely,
734 * that "failure" be returned even if *ptr == oldval.
735 *
736 * For example, a user space atomic_add implementation could look like this: 740 * For example, a user space atomic_add implementation could look like this:
737 * 741 *
738 * #define atomic_add(ptr, val) \ 742 * #define atomic_add(ptr, val) \
@@ -769,46 +773,62 @@ __kuser_cmpxchg: @ 0xffff0fc0
769 773
770#elif __LINUX_ARM_ARCH__ < 6 774#elif __LINUX_ARM_ARCH__ < 6
771 775
776#ifdef CONFIG_MMU
777
772 /* 778 /*
773 * Theory of operation: 779 * The only thing that can break atomicity in this cmpxchg
774 * 780 * implementation is either an IRQ or a data abort exception
775 * We set the Z flag before loading oldval. If ever an exception 781 * causing another process/thread to be scheduled in the middle
776 * occurs we can not be sure the loaded value will still be the same 782 * of the critical sequence. To prevent this, code is added to
777 * when the exception returns, therefore the user exception handler 783 * the IRQ and data abort exception handlers to set the pc back
778 * will clear the Z flag whenever the interrupted user code was 784 * to the beginning of the critical section if it is found to be
779 * actually from the kernel address space (see the usr_entry macro). 785 * within that critical section (see kuser_cmpxchg_fixup).
780 *
781 * The post-increment on the str is used to prevent a race with an
782 * exception happening just after the str instruction which would
783 * clear the Z flag although the exchange was done.
784 */ 786 */
785#ifdef CONFIG_MMU 7871: ldr r3, [r2] @ load current val
786 teq ip, ip @ set Z flag 788 subs r3, r3, r0 @ compare with oldval
787 ldr ip, [r2] @ load current val 7892: streq r1, [r2] @ store newval if eq
788 add r3, r2, #1 @ prepare store ptr 790 rsbs r0, r3, #0 @ set return val and C flag
789 teqeq ip, r0 @ compare with oldval if still allowed 791 usr_ret lr
790 streq r1, [r3, #-1]! @ store newval if still allowed 792
791 subs r0, r2, r3 @ if r2 == r3 the str occured 793 .text
794kuser_cmpxchg_fixup:
795 @ Called from kuser_cmpxchg_check macro.
796 @ r2 = address of interrupted insn (must be preserved).
797 @ sp = saved regs. r7 and r8 are clobbered.
798 @ 1b = first critical insn, 2b = last critical insn.
799 @ If r2 >= 1b and r2 <= 2b then saved pc_usr is set to 1b.
800 mov r7, #0xffff0fff
801 sub r7, r7, #(0xffff0fff - (0xffff0fc0 + (1b - __kuser_cmpxchg)))
802 subs r8, r2, r7
803 rsbcss r8, r8, #(2b - 1b)
804 strcs r7, [sp, #S_PC]
805 mov pc, lr
806 .previous
807
792#else 808#else
793#warning "NPTL on non MMU needs fixing" 809#warning "NPTL on non MMU needs fixing"
794 mov r0, #-1 810 mov r0, #-1
795 adds r0, r0, #0 811 adds r0, r0, #0
796#endif
797 usr_ret lr 812 usr_ret lr
813#endif
798 814
799#else 815#else
800 816
801#ifdef CONFIG_SMP 817#ifdef CONFIG_SMP
802 mcr p15, 0, r0, c7, c10, 5 @ dmb 818 mcr p15, 0, r0, c7, c10, 5 @ dmb
803#endif 819#endif
804 ldrex r3, [r2] 8201: ldrex r3, [r2]
805 subs r3, r3, r0 821 subs r3, r3, r0
806 strexeq r3, r1, [r2] 822 strexeq r3, r1, [r2]
823 teqeq r3, #1
824 beq 1b
807 rsbs r0, r3, #0 825 rsbs r0, r3, #0
826 /* beware -- each __kuser slot must be 8 instructions max */
808#ifdef CONFIG_SMP 827#ifdef CONFIG_SMP
809 mcr p15, 0, r0, c7, c10, 5 @ dmb 828 b __kuser_memory_barrier
810#endif 829#else
811 usr_ret lr 830 usr_ret lr
831#endif
812 832
813#endif 833#endif
814 834
@@ -829,7 +849,7 @@ __kuser_cmpxchg: @ 0xffff0fc0
829 * 849 *
830 * Clobbered: 850 * Clobbered:
831 * 851 *
832 * the Z flag might be lost 852 * none
833 * 853 *
834 * Definition and user space usage example: 854 * Definition and user space usage example:
835 * 855 *
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 4764bd9ccee8..c34db4e868fa 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -327,7 +327,7 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
327 if ((instr & hook->instr_mask) == hook->instr_val && 327 if ((instr & hook->instr_mask) == hook->instr_val &&
328 (regs->ARM_cpsr & hook->cpsr_mask) == hook->cpsr_val) { 328 (regs->ARM_cpsr & hook->cpsr_mask) == hook->cpsr_val) {
329 if (hook->fn(regs, instr) == 0) { 329 if (hook->fn(regs, instr) == 0) {
330 spin_unlock_irq(&undef_lock); 330 spin_unlock_irqrestore(&undef_lock, flags);
331 return; 331 return;
332 } 332 }
333 } 333 }
@@ -509,7 +509,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
509 * existence. Don't ever use this from user code. 509 * existence. Don't ever use this from user code.
510 */ 510 */
511 case 0xfff0: 511 case 0xfff0:
512 { 512 for (;;) {
513 extern void do_DataAbort(unsigned long addr, unsigned int fsr, 513 extern void do_DataAbort(unsigned long addr, unsigned int fsr,
514 struct pt_regs *regs); 514 struct pt_regs *regs);
515 unsigned long val; 515 unsigned long val;
@@ -545,7 +545,6 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
545 up_read(&mm->mmap_sem); 545 up_read(&mm->mmap_sem);
546 /* simulate a write access fault */ 546 /* simulate a write access fault */
547 do_DataAbort(addr, 15 + (1 << 11), regs); 547 do_DataAbort(addr, 15 + (1 << 11), regs);
548 return -1;
549 } 548 }
550#endif 549#endif
551 550
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index 0417c165d50d..9296833f91cc 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -14,6 +14,7 @@
14#include <asm/mach/map.h> 14#include <asm/mach/map.h>
15 15
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/i2c-gpio.h>
17 18
18#include <asm/arch/board.h> 19#include <asm/arch/board.h>
19#include <asm/arch/gpio.h> 20#include <asm/arch/gpio.h>
@@ -435,7 +436,40 @@ void __init at91_add_device_nand(struct at91_nand_data *data) {}
435 * TWI (i2c) 436 * TWI (i2c)
436 * -------------------------------------------------------------------- */ 437 * -------------------------------------------------------------------- */
437 438
438#if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) 439/*
440 * Prefer the GPIO code since the TWI controller isn't robust
441 * (gets overruns and underruns under load) and can only issue
442 * repeated STARTs in one scenario (the driver doesn't yet handle them).
443 */
444#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
445
446static struct i2c_gpio_platform_data pdata = {
447 .sda_pin = AT91_PIN_PA25,
448 .sda_is_open_drain = 1,
449 .scl_pin = AT91_PIN_PA26,
450 .scl_is_open_drain = 1,
451 .udelay = 2, /* ~100 kHz */
452};
453
454static struct platform_device at91rm9200_twi_device = {
455 .name = "i2c-gpio",
456 .id = -1,
457 .dev.platform_data = &pdata,
458};
459
460void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
461{
462 at91_set_GPIO_periph(AT91_PIN_PA25, 1); /* TWD (SDA) */
463 at91_set_multi_drive(AT91_PIN_PA25, 1);
464
465 at91_set_GPIO_periph(AT91_PIN_PA26, 1); /* TWCK (SCL) */
466 at91_set_multi_drive(AT91_PIN_PA26, 1);
467
468 i2c_register_board_info(0, devices, nr_devices);
469 platform_device_register(&at91rm9200_twi_device);
470}
471
472#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
439 473
440static struct resource twi_resources[] = { 474static struct resource twi_resources[] = {
441 [0] = { 475 [0] = {
@@ -457,7 +491,7 @@ static struct platform_device at91rm9200_twi_device = {
457 .num_resources = ARRAY_SIZE(twi_resources), 491 .num_resources = ARRAY_SIZE(twi_resources),
458}; 492};
459 493
460void __init at91_add_device_i2c(void) 494void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
461{ 495{
462 /* pins used for TWI interface */ 496 /* pins used for TWI interface */
463 at91_set_A_periph(AT91_PIN_PA25, 0); /* TWD */ 497 at91_set_A_periph(AT91_PIN_PA25, 0); /* TWD */
@@ -466,10 +500,11 @@ void __init at91_add_device_i2c(void)
466 at91_set_A_periph(AT91_PIN_PA26, 0); /* TWCK */ 500 at91_set_A_periph(AT91_PIN_PA26, 0); /* TWCK */
467 at91_set_multi_drive(AT91_PIN_PA26, 1); 501 at91_set_multi_drive(AT91_PIN_PA26, 1);
468 502
503 i2c_register_board_info(0, devices, nr_devices);
469 platform_device_register(&at91rm9200_twi_device); 504 platform_device_register(&at91rm9200_twi_device);
470} 505}
471#else 506#else
472void __init at91_add_device_i2c(void) {} 507void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
473#endif 508#endif
474 509
475 510
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index ffd3154c1e54..3091bf47d8c9 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -13,6 +13,7 @@
13#include <asm/mach/map.h> 13#include <asm/mach/map.h>
14 14
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/i2c-gpio.h>
16 17
17#include <asm/arch/board.h> 18#include <asm/arch/board.h>
18#include <asm/arch/gpio.h> 19#include <asm/arch/gpio.h>
@@ -352,7 +353,41 @@ void __init at91_add_device_nand(struct at91_nand_data *data) {}
352 * TWI (i2c) 353 * TWI (i2c)
353 * -------------------------------------------------------------------- */ 354 * -------------------------------------------------------------------- */
354 355
355#if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) 356/*
357 * Prefer the GPIO code since the TWI controller isn't robust
358 * (gets overruns and underruns under load) and can only issue
359 * repeated STARTs in one scenario (the driver doesn't yet handle them).
360 */
361
362#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
363
364static struct i2c_gpio_platform_data pdata = {
365 .sda_pin = AT91_PIN_PA23,
366 .sda_is_open_drain = 1,
367 .scl_pin = AT91_PIN_PA24,
368 .scl_is_open_drain = 1,
369 .udelay = 2, /* ~100 kHz */
370};
371
372static struct platform_device at91sam9260_twi_device = {
373 .name = "i2c-gpio",
374 .id = -1,
375 .dev.platform_data = &pdata,
376};
377
378void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
379{
380 at91_set_GPIO_periph(AT91_PIN_PA23, 1); /* TWD (SDA) */
381 at91_set_multi_drive(AT91_PIN_PA23, 1);
382
383 at91_set_GPIO_periph(AT91_PIN_PA24, 1); /* TWCK (SCL) */
384 at91_set_multi_drive(AT91_PIN_PA24, 1);
385
386 i2c_register_board_info(0, devices, nr_devices);
387 platform_device_register(&at91sam9260_twi_device);
388}
389
390#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
356 391
357static struct resource twi_resources[] = { 392static struct resource twi_resources[] = {
358 [0] = { 393 [0] = {
@@ -374,7 +409,7 @@ static struct platform_device at91sam9260_twi_device = {
374 .num_resources = ARRAY_SIZE(twi_resources), 409 .num_resources = ARRAY_SIZE(twi_resources),
375}; 410};
376 411
377void __init at91_add_device_i2c(void) 412void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
378{ 413{
379 /* pins used for TWI interface */ 414 /* pins used for TWI interface */
380 at91_set_A_periph(AT91_PIN_PA23, 0); /* TWD */ 415 at91_set_A_periph(AT91_PIN_PA23, 0); /* TWD */
@@ -383,10 +418,11 @@ void __init at91_add_device_i2c(void)
383 at91_set_A_periph(AT91_PIN_PA24, 0); /* TWCK */ 418 at91_set_A_periph(AT91_PIN_PA24, 0); /* TWCK */
384 at91_set_multi_drive(AT91_PIN_PA24, 1); 419 at91_set_multi_drive(AT91_PIN_PA24, 1);
385 420
421 i2c_register_board_info(0, devices, nr_devices);
386 platform_device_register(&at91sam9260_twi_device); 422 platform_device_register(&at91sam9260_twi_device);
387} 423}
388#else 424#else
389void __init at91_add_device_i2c(void) {} 425void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
390#endif 426#endif
391 427
392 428
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 3576595b4941..64979a9023c2 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -14,7 +14,9 @@
14#include <asm/mach/map.h> 14#include <asm/mach/map.h>
15 15
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/i2c-gpio.h>
17 18
19#include <linux/fb.h>
18#include <video/atmel_lcdc.h> 20#include <video/atmel_lcdc.h>
19 21
20#include <asm/arch/board.h> 22#include <asm/arch/board.h>
@@ -275,7 +277,40 @@ void __init at91_add_device_nand(struct at91_nand_data *data) {}
275 * TWI (i2c) 277 * TWI (i2c)
276 * -------------------------------------------------------------------- */ 278 * -------------------------------------------------------------------- */
277 279
278#if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) 280/*
281 * Prefer the GPIO code since the TWI controller isn't robust
282 * (gets overruns and underruns under load) and can only issue
283 * repeated STARTs in one scenario (the driver doesn't yet handle them).
284 */
285#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
286
287static struct i2c_gpio_platform_data pdata = {
288 .sda_pin = AT91_PIN_PA7,
289 .sda_is_open_drain = 1,
290 .scl_pin = AT91_PIN_PA8,
291 .scl_is_open_drain = 1,
292 .udelay = 2, /* ~100 kHz */
293};
294
295static struct platform_device at91sam9261_twi_device = {
296 .name = "i2c-gpio",
297 .id = -1,
298 .dev.platform_data = &pdata,
299};
300
301void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
302{
303 at91_set_GPIO_periph(AT91_PIN_PA7, 1); /* TWD (SDA) */
304 at91_set_multi_drive(AT91_PIN_PA7, 1);
305
306 at91_set_GPIO_periph(AT91_PIN_PA8, 1); /* TWCK (SCL) */
307 at91_set_multi_drive(AT91_PIN_PA8, 1);
308
309 i2c_register_board_info(0, devices, nr_devices);
310 platform_device_register(&at91sam9261_twi_device);
311}
312
313#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
279 314
280static struct resource twi_resources[] = { 315static struct resource twi_resources[] = {
281 [0] = { 316 [0] = {
@@ -297,7 +332,7 @@ static struct platform_device at91sam9261_twi_device = {
297 .num_resources = ARRAY_SIZE(twi_resources), 332 .num_resources = ARRAY_SIZE(twi_resources),
298}; 333};
299 334
300void __init at91_add_device_i2c(void) 335void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
301{ 336{
302 /* pins used for TWI interface */ 337 /* pins used for TWI interface */
303 at91_set_A_periph(AT91_PIN_PA7, 0); /* TWD */ 338 at91_set_A_periph(AT91_PIN_PA7, 0); /* TWD */
@@ -306,10 +341,11 @@ void __init at91_add_device_i2c(void)
306 at91_set_A_periph(AT91_PIN_PA8, 0); /* TWCK */ 341 at91_set_A_periph(AT91_PIN_PA8, 0); /* TWCK */
307 at91_set_multi_drive(AT91_PIN_PA8, 1); 342 at91_set_multi_drive(AT91_PIN_PA8, 1);
308 343
344 i2c_register_board_info(0, devices, nr_devices);
309 platform_device_register(&at91sam9261_twi_device); 345 platform_device_register(&at91sam9261_twi_device);
310} 346}
311#else 347#else
312void __init at91_add_device_i2c(void) {} 348void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
313#endif 349#endif
314 350
315 351
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index f924bd5017de..ac329a98e959 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -13,7 +13,9 @@
13#include <asm/mach/map.h> 13#include <asm/mach/map.h>
14 14
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/i2c-gpio.h>
16 17
18#include <linux/fb.h>
17#include <video/atmel_lcdc.h> 19#include <video/atmel_lcdc.h>
18 20
19#include <asm/arch/board.h> 21#include <asm/arch/board.h>
@@ -421,7 +423,40 @@ void __init at91_add_device_nand(struct at91_nand_data *data) {}
421 * TWI (i2c) 423 * TWI (i2c)
422 * -------------------------------------------------------------------- */ 424 * -------------------------------------------------------------------- */
423 425
424#if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) 426/*
427 * Prefer the GPIO code since the TWI controller isn't robust
428 * (gets overruns and underruns under load) and can only issue
429 * repeated STARTs in one scenario (the driver doesn't yet handle them).
430 */
431#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
432
433static struct i2c_gpio_platform_data pdata = {
434 .sda_pin = AT91_PIN_PB4,
435 .sda_is_open_drain = 1,
436 .scl_pin = AT91_PIN_PB5,
437 .scl_is_open_drain = 1,
438 .udelay = 2, /* ~100 kHz */
439};
440
441static struct platform_device at91sam9263_twi_device = {
442 .name = "i2c-gpio",
443 .id = -1,
444 .dev.platform_data = &pdata,
445};
446
447void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
448{
449 at91_set_GPIO_periph(AT91_PIN_PB4, 1); /* TWD (SDA) */
450 at91_set_multi_drive(AT91_PIN_PB4, 1);
451
452 at91_set_GPIO_periph(AT91_PIN_PB5, 1); /* TWCK (SCL) */
453 at91_set_multi_drive(AT91_PIN_PB5, 1);
454
455 i2c_register_board_info(0, devices, nr_devices);
456 platform_device_register(&at91sam9263_twi_device);
457}
458
459#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
425 460
426static struct resource twi_resources[] = { 461static struct resource twi_resources[] = {
427 [0] = { 462 [0] = {
@@ -443,7 +478,7 @@ static struct platform_device at91sam9263_twi_device = {
443 .num_resources = ARRAY_SIZE(twi_resources), 478 .num_resources = ARRAY_SIZE(twi_resources),
444}; 479};
445 480
446void __init at91_add_device_i2c(void) 481void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
447{ 482{
448 /* pins used for TWI interface */ 483 /* pins used for TWI interface */
449 at91_set_A_periph(AT91_PIN_PB4, 0); /* TWD */ 484 at91_set_A_periph(AT91_PIN_PB4, 0); /* TWD */
@@ -452,10 +487,11 @@ void __init at91_add_device_i2c(void)
452 at91_set_A_periph(AT91_PIN_PB5, 0); /* TWCK */ 487 at91_set_A_periph(AT91_PIN_PB5, 0); /* TWCK */
453 at91_set_multi_drive(AT91_PIN_PB5, 1); 488 at91_set_multi_drive(AT91_PIN_PB5, 1);
454 489
490 i2c_register_board_info(0, devices, nr_devices);
455 platform_device_register(&at91sam9263_twi_device); 491 platform_device_register(&at91sam9263_twi_device);
456} 492}
457#else 493#else
458void __init at91_add_device_i2c(void) {} 494void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
459#endif 495#endif
460 496
461 497
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index cd7532bcd4e5..2bd60a3dc623 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -10,8 +10,9 @@
10#include <asm/mach/map.h> 10#include <asm/mach/map.h>
11 11
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13#include <linux/fb.h> 13#include <linux/i2c-gpio.h>
14 14
15#include <linux/fb.h>
15#include <video/atmel_lcdc.h> 16#include <video/atmel_lcdc.h>
16 17
17#include <asm/arch/board.h> 18#include <asm/arch/board.h>
@@ -169,7 +170,40 @@ void __init at91_add_device_nand(struct at91_nand_data *data) {}
169 * TWI (i2c) 170 * TWI (i2c)
170 * -------------------------------------------------------------------- */ 171 * -------------------------------------------------------------------- */
171 172
172#if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) 173/*
174 * Prefer the GPIO code since the TWI controller isn't robust
175 * (gets overruns and underruns under load) and can only issue
176 * repeated STARTs in one scenario (the driver doesn't yet handle them).
177 */
178#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
179
180static struct i2c_gpio_platform_data pdata = {
181 .sda_pin = AT91_PIN_PA23,
182 .sda_is_open_drain = 1,
183 .scl_pin = AT91_PIN_PA24,
184 .scl_is_open_drain = 1,
185 .udelay = 2, /* ~100 kHz */
186};
187
188static struct platform_device at91sam9rl_twi_device = {
189 .name = "i2c-gpio",
190 .id = -1,
191 .dev.platform_data = &pdata,
192};
193
194void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
195{
196 at91_set_GPIO_periph(AT91_PIN_PA23, 1); /* TWD (SDA) */
197 at91_set_multi_drive(AT91_PIN_PA23, 1);
198
199 at91_set_GPIO_periph(AT91_PIN_PA24, 1); /* TWCK (SCL) */
200 at91_set_multi_drive(AT91_PIN_PA24, 1);
201
202 i2c_register_board_info(0, devices, nr_devices);
203 platform_device_register(&at91sam9rl_twi_device);
204}
205
206#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
173 207
174static struct resource twi_resources[] = { 208static struct resource twi_resources[] = {
175 [0] = { 209 [0] = {
@@ -191,7 +225,7 @@ static struct platform_device at91sam9rl_twi_device = {
191 .num_resources = ARRAY_SIZE(twi_resources), 225 .num_resources = ARRAY_SIZE(twi_resources),
192}; 226};
193 227
194void __init at91_add_device_i2c(void) 228void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
195{ 229{
196 /* pins used for TWI interface */ 230 /* pins used for TWI interface */
197 at91_set_A_periph(AT91_PIN_PA23, 0); /* TWD */ 231 at91_set_A_periph(AT91_PIN_PA23, 0); /* TWD */
@@ -200,10 +234,11 @@ void __init at91_add_device_i2c(void)
200 at91_set_A_periph(AT91_PIN_PA24, 0); /* TWCK */ 234 at91_set_A_periph(AT91_PIN_PA24, 0); /* TWCK */
201 at91_set_multi_drive(AT91_PIN_PA24, 1); 235 at91_set_multi_drive(AT91_PIN_PA24, 1);
202 236
237 i2c_register_board_info(0, devices, nr_devices);
203 platform_device_register(&at91sam9rl_twi_device); 238 platform_device_register(&at91sam9rl_twi_device);
204} 239}
205#else 240#else
206void __init at91_add_device_i2c(void) {} 241void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
207#endif 242#endif
208 243
209 244
diff --git a/arch/arm/mach-at91/board-carmeva.c b/arch/arm/mach-at91/board-carmeva.c
index 76ec856cd4f9..0f0878294a67 100644
--- a/arch/arm/mach-at91/board-carmeva.c
+++ b/arch/arm/mach-at91/board-carmeva.c
@@ -128,7 +128,7 @@ static void __init carmeva_board_init(void)
128 /* USB Device */ 128 /* USB Device */
129 at91_add_device_udc(&carmeva_udc_data); 129 at91_add_device_udc(&carmeva_udc_data);
130 /* I2C */ 130 /* I2C */
131 at91_add_device_i2c(); 131 at91_add_device_i2c(NULL, 0);
132 /* SPI */ 132 /* SPI */
133 at91_add_device_spi(carmeva_spi_devices, ARRAY_SIZE(carmeva_spi_devices)); 133 at91_add_device_spi(carmeva_spi_devices, ARRAY_SIZE(carmeva_spi_devices));
134 /* Compact Flash */ 134 /* Compact Flash */
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c
index dde089922e3b..d0aa20c9383e 100644
--- a/arch/arm/mach-at91/board-csb337.c
+++ b/arch/arm/mach-at91/board-csb337.c
@@ -23,7 +23,6 @@
23#include <linux/mm.h> 23#include <linux/mm.h>
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <linux/i2c.h>
27#include <linux/spi/spi.h> 26#include <linux/spi/spi.h>
28#include <linux/mtd/physmap.h> 27#include <linux/mtd/physmap.h>
29 28
@@ -85,12 +84,12 @@ static struct at91_udc_data __initdata csb337_udc_data = {
85}; 84};
86 85
87static struct i2c_board_info __initdata csb337_i2c_devices[] = { 86static struct i2c_board_info __initdata csb337_i2c_devices[] = {
88 { I2C_BOARD_INFO("rtc-ds1307", 0x68), 87 {
89 .type = "ds1307", 88 I2C_BOARD_INFO("rtc-ds1307", 0x68),
89 .type = "ds1307",
90 }, 90 },
91}; 91};
92 92
93
94static struct at91_cf_data __initdata csb337_cf_data = { 93static struct at91_cf_data __initdata csb337_cf_data = {
95 /* 94 /*
96 * connector P4 on the CSB 337 mates to 95 * connector P4 on the CSB 337 mates to
@@ -168,9 +167,7 @@ static void __init csb337_board_init(void)
168 /* USB Device */ 167 /* USB Device */
169 at91_add_device_udc(&csb337_udc_data); 168 at91_add_device_udc(&csb337_udc_data);
170 /* I2C */ 169 /* I2C */
171 at91_add_device_i2c(); 170 at91_add_device_i2c(csb337_i2c_devices, ARRAY_SIZE(csb337_i2c_devices));
172 i2c_register_board_info(0, csb337_i2c_devices,
173 ARRAY_SIZE(csb337_i2c_devices));
174 /* Compact Flash */ 171 /* Compact Flash */
175 at91_set_gpio_input(AT91_PIN_PB22, 1); /* IOIS16 */ 172 at91_set_gpio_input(AT91_PIN_PB22, 1); /* IOIS16 */
176 at91_add_device_cf(&csb337_cf_data); 173 at91_add_device_cf(&csb337_cf_data);
diff --git a/arch/arm/mach-at91/board-csb637.c b/arch/arm/mach-at91/board-csb637.c
index 77f04b935b3a..c5c721d27f42 100644
--- a/arch/arm/mach-at91/board-csb637.c
+++ b/arch/arm/mach-at91/board-csb637.c
@@ -129,7 +129,7 @@ static void __init csb637_board_init(void)
129 /* USB Device */ 129 /* USB Device */
130 at91_add_device_udc(&csb637_udc_data); 130 at91_add_device_udc(&csb637_udc_data);
131 /* I2C */ 131 /* I2C */
132 at91_add_device_i2c(); 132 at91_add_device_i2c(NULL, 0);
133 /* SPI */ 133 /* SPI */
134 at91_add_device_spi(NULL, 0); 134 at91_add_device_spi(NULL, 0);
135 /* NOR flash */ 135 /* NOR flash */
diff --git a/arch/arm/mach-at91/board-dk.c b/arch/arm/mach-at91/board-dk.c
index af497896a96c..40c9e4331706 100644
--- a/arch/arm/mach-at91/board-dk.c
+++ b/arch/arm/mach-at91/board-dk.c
@@ -124,6 +124,19 @@ static struct spi_board_info dk_spi_devices[] = {
124#endif 124#endif
125}; 125};
126 126
127static struct i2c_board_info __initdata dk_i2c_devices[] = {
128 {
129 I2C_BOARD_INFO("ics1523", 0x26),
130 },
131 {
132 I2C_BOARD_INFO("x9429", 0x28),
133 },
134 {
135 I2C_BOARD_INFO("at24c", 0x50),
136 .type = "24c1024",
137 }
138};
139
127static struct mtd_partition __initdata dk_nand_partition[] = { 140static struct mtd_partition __initdata dk_nand_partition[] = {
128 { 141 {
129 .name = "NAND Partition 1", 142 .name = "NAND Partition 1",
@@ -185,7 +198,7 @@ static void __init dk_board_init(void)
185 /* Compact Flash */ 198 /* Compact Flash */
186 at91_add_device_cf(&dk_cf_data); 199 at91_add_device_cf(&dk_cf_data);
187 /* I2C */ 200 /* I2C */
188 at91_add_device_i2c(); 201 at91_add_device_i2c(dk_i2c_devices, ARRAY_SIZE(dk_i2c_devices));
189 /* SPI */ 202 /* SPI */
190 at91_add_device_spi(dk_spi_devices, ARRAY_SIZE(dk_spi_devices)); 203 at91_add_device_spi(dk_spi_devices, ARRAY_SIZE(dk_spi_devices));
191#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD 204#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
diff --git a/arch/arm/mach-at91/board-eb9200.c b/arch/arm/mach-at91/board-eb9200.c
index 20458b5548f0..b7b79bb9d6c4 100644
--- a/arch/arm/mach-at91/board-eb9200.c
+++ b/arch/arm/mach-at91/board-eb9200.c
@@ -91,6 +91,14 @@ static struct at91_mmc_data __initdata eb9200_mmc_data = {
91 .wire4 = 1, 91 .wire4 = 1,
92}; 92};
93 93
94static struct i2c_board_info __initdata eb9200_i2c_devices[] = {
95 {
96 I2C_BOARD_INFO("at24c", 0x50),
97 .type = "24c512",
98 },
99};
100
101
94static void __init eb9200_board_init(void) 102static void __init eb9200_board_init(void)
95{ 103{
96 /* Serial */ 104 /* Serial */
@@ -102,7 +110,7 @@ static void __init eb9200_board_init(void)
102 /* USB Device */ 110 /* USB Device */
103 at91_add_device_udc(&eb9200_udc_data); 111 at91_add_device_udc(&eb9200_udc_data);
104 /* I2C */ 112 /* I2C */
105 at91_add_device_i2c(); 113 at91_add_device_i2c(eb9200_i2c_devices, ARRAY_SIZE(eb9200_i2c_devices));
106 /* Compact Flash */ 114 /* Compact Flash */
107 at91_add_device_cf(&eb9200_cf_data); 115 at91_add_device_cf(&eb9200_cf_data);
108 /* SPI */ 116 /* SPI */
diff --git a/arch/arm/mach-at91/board-ek.c b/arch/arm/mach-at91/board-ek.c
index 322fdd75a1e4..d05b1b2be9fb 100644
--- a/arch/arm/mach-at91/board-ek.c
+++ b/arch/arm/mach-at91/board-ek.c
@@ -145,7 +145,7 @@ static void __init ek_board_init(void)
145 at91_add_device_udc(&ek_udc_data); 145 at91_add_device_udc(&ek_udc_data);
146 at91_set_multi_drive(ek_udc_data.pullup_pin, 1); /* pullup_pin is connected to reset */ 146 at91_set_multi_drive(ek_udc_data.pullup_pin, 1); /* pullup_pin is connected to reset */
147 /* I2C */ 147 /* I2C */
148 at91_add_device_i2c(); 148 at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices));
149 /* SPI */ 149 /* SPI */
150 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); 150 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
151#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD 151#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
diff --git a/arch/arm/mach-at91/board-kafa.c b/arch/arm/mach-at91/board-kafa.c
index c77d84ce9cae..cf1b7b2f76fb 100644
--- a/arch/arm/mach-at91/board-kafa.c
+++ b/arch/arm/mach-at91/board-kafa.c
@@ -92,7 +92,7 @@ static void __init kafa_board_init(void)
92 /* USB Device */ 92 /* USB Device */
93 at91_add_device_udc(&kafa_udc_data); 93 at91_add_device_udc(&kafa_udc_data);
94 /* I2C */ 94 /* I2C */
95 at91_add_device_i2c(); 95 at91_add_device_i2c(NULL, 0);
96 /* SPI */ 96 /* SPI */
97 at91_add_device_spi(NULL, 0); 97 at91_add_device_spi(NULL, 0);
98} 98}
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c
index 7d9b1a278fd6..4b39b9cda75b 100644
--- a/arch/arm/mach-at91/board-kb9202.c
+++ b/arch/arm/mach-at91/board-kb9202.c
@@ -124,7 +124,7 @@ static void __init kb9202_board_init(void)
124 /* MMC */ 124 /* MMC */
125 at91_add_device_mmc(0, &kb9202_mmc_data); 125 at91_add_device_mmc(0, &kb9202_mmc_data);
126 /* I2C */ 126 /* I2C */
127 at91_add_device_i2c(); 127 at91_add_device_i2c(NULL, 0);
128 /* SPI */ 128 /* SPI */
129 at91_add_device_spi(NULL, 0); 129 at91_add_device_spi(NULL, 0);
130 /* NAND */ 130 /* NAND */
diff --git a/arch/arm/mach-at91/board-picotux200.c b/arch/arm/mach-at91/board-picotux200.c
index 49cfe7ab4a85..6acb55c09ae5 100644
--- a/arch/arm/mach-at91/board-picotux200.c
+++ b/arch/arm/mach-at91/board-picotux200.c
@@ -139,7 +139,7 @@ static void __init picotux200_board_init(void)
139 // at91_add_device_udc(&picotux200_udc_data); 139 // at91_add_device_udc(&picotux200_udc_data);
140 // at91_set_multi_drive(picotux200_udc_data.pullup_pin, 1); /* pullup_pin is connected to reset */ 140 // at91_set_multi_drive(picotux200_udc_data.pullup_pin, 1); /* pullup_pin is connected to reset */
141 /* I2C */ 141 /* I2C */
142 at91_add_device_i2c(); 142 at91_add_device_i2c(NULL, 0);
143 /* SPI */ 143 /* SPI */
144 // at91_add_device_spi(picotux200_spi_devices, ARRAY_SIZE(picotux200_spi_devices)); 144 // at91_add_device_spi(picotux200_spi_devices, ARRAY_SIZE(picotux200_spi_devices));
145#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD 145#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c
index 65fa532bb4ac..b343a6c28120 100644
--- a/arch/arm/mach-at91/board-sam9260ek.c
+++ b/arch/arm/mach-at91/board-sam9260ek.c
@@ -189,7 +189,7 @@ static void __init ek_board_init(void)
189 /* MMC */ 189 /* MMC */
190 at91_add_device_mmc(0, &ek_mmc_data); 190 at91_add_device_mmc(0, &ek_mmc_data);
191 /* I2C */ 191 /* I2C */
192 at91_add_device_i2c(); 192 at91_add_device_i2c(NULL, 0);
193} 193}
194 194
195MACHINE_START(AT91SAM9260EK, "Atmel AT91SAM9260-EK") 195MACHINE_START(AT91SAM9260EK, "Atmel AT91SAM9260-EK")
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index 42e172cb0f49..550ae59a3aca 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -382,14 +382,14 @@ static struct platform_device ek_button_device = {
382 382
383static void __init ek_add_device_buttons(void) 383static void __init ek_add_device_buttons(void)
384{ 384{
385 at91_set_gpio_input(AT91_PIN_PB27, 0); /* btn0 */ 385 at91_set_gpio_input(AT91_PIN_PA27, 0); /* btn0 */
386 at91_set_deglitch(AT91_PIN_PB27, 1); 386 at91_set_deglitch(AT91_PIN_PA27, 1);
387 at91_set_gpio_input(AT91_PIN_PB26, 0); /* btn1 */ 387 at91_set_gpio_input(AT91_PIN_PA26, 0); /* btn1 */
388 at91_set_deglitch(AT91_PIN_PB26, 1); 388 at91_set_deglitch(AT91_PIN_PA26, 1);
389 at91_set_gpio_input(AT91_PIN_PB25, 0); /* btn2 */ 389 at91_set_gpio_input(AT91_PIN_PA25, 0); /* btn2 */
390 at91_set_deglitch(AT91_PIN_PB25, 1); 390 at91_set_deglitch(AT91_PIN_PA25, 1);
391 at91_set_gpio_input(AT91_PIN_PB24, 0); /* btn3 */ 391 at91_set_gpio_input(AT91_PIN_PA24, 0); /* btn3 */
392 at91_set_deglitch(AT91_PIN_PB24, 1); 392 at91_set_deglitch(AT91_PIN_PA24, 1);
393 393
394 platform_device_register(&ek_button_device); 394 platform_device_register(&ek_button_device);
395} 395}
@@ -406,7 +406,7 @@ static void __init ek_board_init(void)
406 /* USB Device */ 406 /* USB Device */
407 at91_add_device_udc(&ek_udc_data); 407 at91_add_device_udc(&ek_udc_data);
408 /* I2C */ 408 /* I2C */
409 at91_add_device_i2c(); 409 at91_add_device_i2c(NULL, 0);
410 /* NAND */ 410 /* NAND */
411 at91_add_device_nand(&ek_nand_data); 411 at91_add_device_nand(&ek_nand_data);
412 /* DM9000 ethernet */ 412 /* DM9000 ethernet */
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index 2a1cc73390b7..ab9dcc075454 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -291,7 +291,7 @@ static void __init ek_board_init(void)
291 /* NAND */ 291 /* NAND */
292 at91_add_device_nand(&ek_nand_data); 292 at91_add_device_nand(&ek_nand_data);
293 /* I2C */ 293 /* I2C */
294 at91_add_device_i2c(); 294 at91_add_device_i2c(NULL, 0);
295 /* LCD Controller */ 295 /* LCD Controller */
296 at91_add_device_lcdc(&ek_lcdc_data); 296 at91_add_device_lcdc(&ek_lcdc_data);
297 /* AC97 */ 297 /* AC97 */
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index 9b61320f295a..bc0546d7245f 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -181,7 +181,7 @@ static void __init ek_board_init(void)
181 /* Serial */ 181 /* Serial */
182 at91_add_device_serial(); 182 at91_add_device_serial();
183 /* I2C */ 183 /* I2C */
184 at91_add_device_i2c(); 184 at91_add_device_i2c(NULL, 0);
185 /* NAND */ 185 /* NAND */
186 at91_add_device_nand(&ek_nand_data); 186 at91_add_device_nand(&ek_nand_data);
187 /* SPI */ 187 /* SPI */
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
index 848efb2a4ebf..57c3b647ce83 100644
--- a/arch/arm/mach-at91/clock.c
+++ b/arch/arm/mach-at91/clock.c
@@ -351,7 +351,7 @@ static void init_programmable_clock(struct clk *clk)
351 pckr = at91_sys_read(AT91_PMC_PCKR(clk->id)); 351 pckr = at91_sys_read(AT91_PMC_PCKR(clk->id));
352 parent = at91_css_to_clk(pckr & AT91_PMC_CSS); 352 parent = at91_css_to_clk(pckr & AT91_PMC_CSS);
353 clk->parent = parent; 353 clk->parent = parent;
354 clk->rate_hz = parent->rate_hz / (1 << ((pckr >> 2) & 3)); 354 clk->rate_hz = parent->rate_hz / (1 << ((pckr & AT91_PMC_PRES) >> 2));
355} 355}
356 356
357#endif /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */ 357#endif /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */
@@ -587,8 +587,11 @@ int __init at91_clock_init(unsigned long main_clock)
587 mckr = at91_sys_read(AT91_PMC_MCKR); 587 mckr = at91_sys_read(AT91_PMC_MCKR);
588 mck.parent = at91_css_to_clk(mckr & AT91_PMC_CSS); 588 mck.parent = at91_css_to_clk(mckr & AT91_PMC_CSS);
589 freq = mck.parent->rate_hz; 589 freq = mck.parent->rate_hz;
590 freq /= (1 << ((mckr >> 2) & 3)); /* prescale */ 590 freq /= (1 << ((mckr & AT91_PMC_PRES) >> 2)); /* prescale */
591 mck.rate_hz = freq / (1 + ((mckr >> 8) & 3)); /* mdiv */ 591 if (cpu_is_at91rm9200())
592 mck.rate_hz = freq / (1 + ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */
593 else
594 mck.rate_hz = freq / (1 << ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */
592 595
593 /* Register the PMC's standard clocks */ 596 /* Register the PMC's standard clocks */
594 for (i = 0; i < ARRAY_SIZE(standard_pmc_clocks); i++) 597 for (i = 0; i < ARRAY_SIZE(standard_pmc_clocks); i++)
diff --git a/arch/arm/mach-imx/irq.c b/arch/arm/mach-imx/irq.c
index 0791b56caecc..a7465db84893 100644
--- a/arch/arm/mach-imx/irq.c
+++ b/arch/arm/mach-imx/irq.c
@@ -43,12 +43,46 @@
43 * 43 *
44 */ 44 */
45 45
46#define INTENNUM_OFF 0x8 46#define INTCNTL_OFF 0x00
47#define INTDISNUM_OFF 0xC 47#define NIMASK_OFF 0x04
48#define INTENNUM_OFF 0x08
49#define INTDISNUM_OFF 0x0C
50#define INTENABLEH_OFF 0x10
51#define INTENABLEL_OFF 0x14
52#define INTTYPEH_OFF 0x18
53#define INTTYPEL_OFF 0x1C
54#define NIPRIORITY_OFF(x) (0x20+4*(7-(x)))
55#define NIVECSR_OFF 0x40
56#define FIVECSR_OFF 0x44
57#define INTSRCH_OFF 0x48
58#define INTSRCL_OFF 0x4C
59#define INTFRCH_OFF 0x50
60#define INTFRCL_OFF 0x54
61#define NIPNDH_OFF 0x58
62#define NIPNDL_OFF 0x5C
63#define FIPNDH_OFF 0x60
64#define FIPNDL_OFF 0x64
48 65
49#define VA_AITC_BASE IO_ADDRESS(IMX_AITC_BASE) 66#define VA_AITC_BASE IO_ADDRESS(IMX_AITC_BASE)
50#define IMX_AITC_INTDISNUM (VA_AITC_BASE + INTDISNUM_OFF) 67#define IMX_AITC_INTCNTL (VA_AITC_BASE + INTCNTL_OFF)
68#define IMX_AITC_NIMASK (VA_AITC_BASE + NIMASK_OFF)
51#define IMX_AITC_INTENNUM (VA_AITC_BASE + INTENNUM_OFF) 69#define IMX_AITC_INTENNUM (VA_AITC_BASE + INTENNUM_OFF)
70#define IMX_AITC_INTDISNUM (VA_AITC_BASE + INTDISNUM_OFF)
71#define IMX_AITC_INTENABLEH (VA_AITC_BASE + INTENABLEH_OFF)
72#define IMX_AITC_INTENABLEL (VA_AITC_BASE + INTENABLEL_OFF)
73#define IMX_AITC_INTTYPEH (VA_AITC_BASE + INTTYPEH_OFF)
74#define IMX_AITC_INTTYPEL (VA_AITC_BASE + INTTYPEL_OFF)
75#define IMX_AITC_NIPRIORITY(x) (VA_AITC_BASE + NIPRIORITY_OFF(x))
76#define IMX_AITC_NIVECSR (VA_AITC_BASE + NIVECSR_OFF)
77#define IMX_AITC_FIVECSR (VA_AITC_BASE + FIVECSR_OFF)
78#define IMX_AITC_INTSRCH (VA_AITC_BASE + INTSRCH_OFF)
79#define IMX_AITC_INTSRCL (VA_AITC_BASE + INTSRCL_OFF)
80#define IMX_AITC_INTFRCH (VA_AITC_BASE + INTFRCH_OFF)
81#define IMX_AITC_INTFRCL (VA_AITC_BASE + INTFRCL_OFF)
82#define IMX_AITC_NIPNDH (VA_AITC_BASE + NIPNDH_OFF)
83#define IMX_AITC_NIPNDL (VA_AITC_BASE + NIPNDL_OFF)
84#define IMX_AITC_FIPNDH (VA_AITC_BASE + FIPNDH_OFF)
85#define IMX_AITC_FIPNDL (VA_AITC_BASE + FIPNDL_OFF)
52 86
53#if 0 87#if 0
54#define DEBUG_IRQ(fmt...) printk(fmt) 88#define DEBUG_IRQ(fmt...) printk(fmt)
@@ -222,7 +256,12 @@ imx_init_irq(void)
222 256
223 DEBUG_IRQ("Initializing imx interrupts\n"); 257 DEBUG_IRQ("Initializing imx interrupts\n");
224 258
225 /* Mask all interrupts initially */ 259 /* Disable all interrupts initially. */
260 /* Do not rely on the bootloader. */
261 __raw_writel(0, IMX_AITC_INTENABLEH);
262 __raw_writel(0, IMX_AITC_INTENABLEL);
263
264 /* Mask all GPIO interrupts as well */
226 IMR(0) = 0; 265 IMR(0) = 0;
227 IMR(1) = 0; 266 IMR(1) = 0;
228 IMR(2) = 0; 267 IMR(2) = 0;
@@ -245,6 +284,6 @@ imx_init_irq(void)
245 set_irq_chained_handler(GPIO_INT_PORTC, imx_gpioc_demux_handler); 284 set_irq_chained_handler(GPIO_INT_PORTC, imx_gpioc_demux_handler);
246 set_irq_chained_handler(GPIO_INT_PORTD, imx_gpiod_demux_handler); 285 set_irq_chained_handler(GPIO_INT_PORTD, imx_gpiod_demux_handler);
247 286
248 /* Disable all interrupts initially. */ 287 /* Release masking of interrupts according to priority */
249 /* In IMX this is done in the bootloader. */ 288 __raw_writel(-1, IMX_AITC_NIMASK);
250} 289}
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index d0f2b597db12..8e126e6b74c3 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -146,7 +146,7 @@ static struct clk pxa27x_clks[] = {
146 INIT_CKEN("MMCCLK", MMC, 19500000, 0, &pxa_device_mci.dev), 146 INIT_CKEN("MMCCLK", MMC, 19500000, 0, &pxa_device_mci.dev),
147 INIT_CKEN("FICPCLK", FICP, 48000000, 0, &pxa_device_ficp.dev), 147 INIT_CKEN("FICPCLK", FICP, 48000000, 0, &pxa_device_ficp.dev),
148 148
149 INIT_CKEN("USBCLK", USB, 48000000, 0, &pxa27x_device_ohci.dev), 149 INIT_CKEN("USBCLK", USBHOST, 48000000, 0, &pxa27x_device_ohci.dev),
150 INIT_CKEN("I2CCLK", PWRI2C, 13000000, 0, &pxa27x_device_i2c_power.dev), 150 INIT_CKEN("I2CCLK", PWRI2C, 13000000, 0, &pxa27x_device_i2c_power.dev),
151 INIT_CKEN("KBDCLK", KEYPAD, 32768, 0, NULL), 151 INIT_CKEN("KBDCLK", KEYPAD, 32768, 0, NULL),
152 152
diff --git a/arch/arm/mach-pxa/pxa320.c b/arch/arm/mach-pxa/pxa320.c
index 1010f77d977a..74128eb8f8d0 100644
--- a/arch/arm/mach-pxa/pxa320.c
+++ b/arch/arm/mach-pxa/pxa320.c
@@ -23,8 +23,11 @@
23static struct pxa3xx_mfp_addr_map pxa320_mfp_addr_map[] __initdata = { 23static struct pxa3xx_mfp_addr_map pxa320_mfp_addr_map[] __initdata = {
24 24
25 MFP_ADDR_X(GPIO0, GPIO4, 0x0124), 25 MFP_ADDR_X(GPIO0, GPIO4, 0x0124),
26 MFP_ADDR_X(GPIO5, GPIO26, 0x028C), 26 MFP_ADDR_X(GPIO5, GPIO9, 0x028C),
27 MFP_ADDR_X(GPIO27, GPIO62, 0x0400), 27 MFP_ADDR(GPIO10, 0x0458),
28 MFP_ADDR_X(GPIO11, GPIO26, 0x02A0),
29 MFP_ADDR_X(GPIO27, GPIO48, 0x0400),
30 MFP_ADDR_X(GPIO49, GPIO62, 0x045C),
28 MFP_ADDR_X(GPIO63, GPIO73, 0x04B4), 31 MFP_ADDR_X(GPIO63, GPIO73, 0x04B4),
29 MFP_ADDR_X(GPIO74, GPIO98, 0x04F0), 32 MFP_ADDR_X(GPIO74, GPIO98, 0x04F0),
30 MFP_ADDR_X(GPIO99, GPIO127, 0x0600), 33 MFP_ADDR_X(GPIO99, GPIO127, 0x0600),
diff --git a/arch/arm/mach-pxa/ssp.c b/arch/arm/mach-pxa/ssp.c
index 71766ac0328b..422afee88169 100644
--- a/arch/arm/mach-pxa/ssp.c
+++ b/arch/arm/mach-pxa/ssp.c
@@ -309,6 +309,7 @@ void ssp_exit(struct ssp_dev *dev)
309 309
310 if (dev->port > PXA_SSP_PORTS || dev->port == 0) { 310 if (dev->port > PXA_SSP_PORTS || dev->port == 0) {
311 printk(KERN_WARNING "SSP: tried to close invalid port\n"); 311 printk(KERN_WARNING "SSP: tried to close invalid port\n");
312 mutex_unlock(&mutex);
312 return; 313 return;
313 } 314 }
314 315
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c
index af3a011b2b24..352fcb8926a6 100644
--- a/drivers/serial/pxa.c
+++ b/drivers/serial/pxa.c
@@ -585,11 +585,11 @@ serial_pxa_type(struct uart_port *port)
585 return up->name; 585 return up->name;
586} 586}
587 587
588#ifdef CONFIG_SERIAL_PXA_CONSOLE
589
590static struct uart_pxa_port *serial_pxa_ports[4]; 588static struct uart_pxa_port *serial_pxa_ports[4];
591static struct uart_driver serial_pxa_reg; 589static struct uart_driver serial_pxa_reg;
592 590
591#ifdef CONFIG_SERIAL_PXA_CONSOLE
592
593#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) 593#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
594 594
595/* 595/*
diff --git a/include/asm-arm/arch-at91/board.h b/include/asm-arm/arch-at91/board.h
index c0d7075982c1..79054965baa6 100644
--- a/include/asm-arm/arch-at91/board.h
+++ b/include/asm-arm/arch-at91/board.h
@@ -33,6 +33,7 @@
33 33
34#include <linux/mtd/partitions.h> 34#include <linux/mtd/partitions.h>
35#include <linux/device.h> 35#include <linux/device.h>
36#include <linux/i2c.h>
36#include <linux/spi/spi.h> 37#include <linux/spi/spi.h>
37 38
38 /* USB Device */ 39 /* USB Device */
@@ -94,7 +95,7 @@ struct at91_nand_data {
94extern void __init at91_add_device_nand(struct at91_nand_data *data); 95extern void __init at91_add_device_nand(struct at91_nand_data *data);
95 96
96 /* I2C*/ 97 /* I2C*/
97extern void __init at91_add_device_i2c(void); 98extern void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices);
98 99
99 /* SPI */ 100 /* SPI */
100extern void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices); 101extern void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices);
diff --git a/include/asm-arm/arch-ixp23xx/irqs.h b/include/asm-arm/arch-ixp23xx/irqs.h
index e69639585721..27c580898958 100644
--- a/include/asm-arm/arch-ixp23xx/irqs.h
+++ b/include/asm-arm/arch-ixp23xx/irqs.h
@@ -153,7 +153,7 @@
153 */ 153 */
154#define NR_IXP23XX_MACH_IRQS 32 154#define NR_IXP23XX_MACH_IRQS 32
155 155
156#define NR_IRQS NR_IXP23XX_IRQS + NR_IXP23XX_MACH_IRQS 156#define NR_IRQS (NR_IXP23XX_IRQS + NR_IXP23XX_MACH_IRQS)
157 157
158#define IXP23XX_MACH_IRQ(irq) (NR_IXP23XX_IRQ + (irq)) 158#define IXP23XX_MACH_IRQ(irq) (NR_IXP23XX_IRQ + (irq))
159 159
diff --git a/include/asm-arm/arch-omap/board-innovator.h b/include/asm-arm/arch-omap/board-innovator.h
index b3cf33441f6e..56d2c98e143c 100644
--- a/include/asm-arm/arch-omap/board-innovator.h
+++ b/include/asm-arm/arch-omap/board-innovator.h
@@ -37,7 +37,7 @@
37#define OMAP1510P1_EMIFF_PRI_VALUE 0x00 37#define OMAP1510P1_EMIFF_PRI_VALUE 0x00
38 38
39#define NR_FPGA_IRQS 24 39#define NR_FPGA_IRQS 24
40#define NR_IRQS IH_BOARD_BASE + NR_FPGA_IRQS 40#define NR_IRQS (IH_BOARD_BASE + NR_FPGA_IRQS)
41 41
42#ifndef __ASSEMBLY__ 42#ifndef __ASSEMBLY__
43void fpga_write(unsigned char val, int reg); 43void fpga_write(unsigned char val, int reg);
diff --git a/include/asm-arm/arch-pxa/irqs.h b/include/asm-arm/arch-pxa/irqs.h
index 6238dbf7a236..b76ee6d1f5b4 100644
--- a/include/asm-arm/arch-pxa/irqs.h
+++ b/include/asm-arm/arch-pxa/irqs.h
@@ -13,7 +13,7 @@
13 13
14#define PXA_IRQ(x) (x) 14#define PXA_IRQ(x) (x)
15 15
16#ifdef CONFIG_PXA27x 16#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
17#define IRQ_SSP3 PXA_IRQ(0) /* SSP3 service request */ 17#define IRQ_SSP3 PXA_IRQ(0) /* SSP3 service request */
18#define IRQ_MSL PXA_IRQ(1) /* MSL Interface interrupt */ 18#define IRQ_MSL PXA_IRQ(1) /* MSL Interface interrupt */
19#define IRQ_USBH2 PXA_IRQ(2) /* USB Host interrupt 1 (OHCI) */ 19#define IRQ_USBH2 PXA_IRQ(2) /* USB Host interrupt 1 (OHCI) */
@@ -52,11 +52,27 @@
52#define IRQ_RTC1Hz PXA_IRQ(30) /* RTC HZ Clock Tick */ 52#define IRQ_RTC1Hz PXA_IRQ(30) /* RTC HZ Clock Tick */
53#define IRQ_RTCAlrm PXA_IRQ(31) /* RTC Alarm */ 53#define IRQ_RTCAlrm PXA_IRQ(31) /* RTC Alarm */
54 54
55#ifdef CONFIG_PXA27x 55#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
56#define IRQ_TPM PXA_IRQ(32) /* TPM interrupt */ 56#define IRQ_TPM PXA_IRQ(32) /* TPM interrupt */
57#define IRQ_CAMERA PXA_IRQ(33) /* Camera Interface */ 57#define IRQ_CAMERA PXA_IRQ(33) /* Camera Interface */
58#endif 58#endif
59 59
60#ifdef CONFIG_PXA3xx
61#define IRQ_SSP4 PXA_IRQ(13) /* SSP4 service request */
62#define IRQ_CIR PXA_IRQ(34) /* Consumer IR */
63#define IRQ_TSI PXA_IRQ(36) /* Touch Screen Interface (PXA320) */
64#define IRQ_USIM2 PXA_IRQ(38) /* USIM2 Controller */
65#define IRQ_GRPHICS PXA_IRQ(39) /* Graphics Controller */
66#define IRQ_MMC2 PXA_IRQ(41) /* MMC2 Controller */
67#define IRQ_1WIRE PXA_IRQ(44) /* 1-Wire Controller */
68#define IRQ_NAND PXA_IRQ(45) /* NAND Controller */
69#define IRQ_USB2 PXA_IRQ(46) /* USB 2.0 Device Controller */
70#define IRQ_WAKEUP0 PXA_IRQ(49) /* EXT_WAKEUP0 */
71#define IRQ_WAKEUP1 PXA_IRQ(50) /* EXT_WAKEUP1 */
72#define IRQ_DMEMC PXA_IRQ(51) /* Dynamic Memory Controller */
73#define IRQ_MMC3 PXA_IRQ(55) /* MMC3 Controller (PXA310) */
74#endif
75
60#define PXA_GPIO_IRQ_BASE (64) 76#define PXA_GPIO_IRQ_BASE (64)
61#define PXA_GPIO_IRQ_NUM (128) 77#define PXA_GPIO_IRQ_NUM (128)
62 78
diff --git a/include/asm-arm/arch-pxa/mfp-pxa300.h b/include/asm-arm/arch-pxa/mfp-pxa300.h
index 822a27cd7864..a20996649889 100644
--- a/include/asm-arm/arch-pxa/mfp-pxa300.h
+++ b/include/asm-arm/arch-pxa/mfp-pxa300.h
@@ -179,7 +179,7 @@
179#define GPIO62_LCD_CS_N MFP_CFG_DRV(GPIO62, AF2, DS01X) 179#define GPIO62_LCD_CS_N MFP_CFG_DRV(GPIO62, AF2, DS01X)
180#define GPIO72_LCD_FCLK MFP_CFG_DRV(GPIO72, AF1, DS01X) 180#define GPIO72_LCD_FCLK MFP_CFG_DRV(GPIO72, AF1, DS01X)
181#define GPIO73_LCD_LCLK MFP_CFG_DRV(GPIO73, AF1, DS01X) 181#define GPIO73_LCD_LCLK MFP_CFG_DRV(GPIO73, AF1, DS01X)
182#define GPIO74_LCD_PCLK MFP_CFG_DRV(GPIO74, AF1, DS01X) 182#define GPIO74_LCD_PCLK MFP_CFG_DRV(GPIO74, AF1, DS02X)
183#define GPIO75_LCD_BIAS MFP_CFG_DRV(GPIO75, AF1, DS01X) 183#define GPIO75_LCD_BIAS MFP_CFG_DRV(GPIO75, AF1, DS01X)
184#define GPIO76_LCD_VSYNC MFP_CFG_DRV(GPIO76, AF2, DS01X) 184#define GPIO76_LCD_VSYNC MFP_CFG_DRV(GPIO76, AF2, DS01X)
185 185
diff --git a/include/asm-arm/arch-pxa/mfp-pxa320.h b/include/asm-arm/arch-pxa/mfp-pxa320.h
index 488a5bbc49e9..52deedcaf3bd 100644
--- a/include/asm-arm/arch-pxa/mfp-pxa320.h
+++ b/include/asm-arm/arch-pxa/mfp-pxa320.h
@@ -18,7 +18,7 @@
18#include <asm/arch/mfp.h> 18#include <asm/arch/mfp.h>
19 19
20/* GPIO */ 20/* GPIO */
21#define GPIO46_GPIO MFP_CFG(GPIO6, AF0) 21#define GPIO46_GPIO MFP_CFG(GPIO46, AF0)
22#define GPIO49_GPIO MFP_CFG(GPIO49, AF0) 22#define GPIO49_GPIO MFP_CFG(GPIO49, AF0)
23#define GPIO50_GPIO MFP_CFG(GPIO50, AF0) 23#define GPIO50_GPIO MFP_CFG(GPIO50, AF0)
24#define GPIO51_GPIO MFP_CFG(GPIO51, AF0) 24#define GPIO51_GPIO MFP_CFG(GPIO51, AF0)
diff --git a/include/asm-arm/arch-pxa/mfp.h b/include/asm-arm/arch-pxa/mfp.h
index ac4157af5a8e..03c508d94f0e 100644
--- a/include/asm-arm/arch-pxa/mfp.h
+++ b/include/asm-arm/arch-pxa/mfp.h
@@ -346,23 +346,31 @@ typedef uint32_t mfp_cfg_t;
346#define MFP_CFG_PIN(mfp_cfg) (((mfp_cfg) >> 16) & 0xffff) 346#define MFP_CFG_PIN(mfp_cfg) (((mfp_cfg) >> 16) & 0xffff)
347#define MFP_CFG_VAL(mfp_cfg) ((mfp_cfg) & 0xffff) 347#define MFP_CFG_VAL(mfp_cfg) ((mfp_cfg) & 0xffff)
348 348
349#define MFPR_DEFAULT (0x0000) 349/*
350 * MFP register defaults to
351 * drive strength fast 3mA (010'b)
352 * edge detection logic disabled
353 * alternate function 0
354 */
355#define MFPR_DEFAULT (0x0840)
350 356
351#define MFP_CFG(pin, af) \ 357#define MFP_CFG(pin, af) \
352 ((MFP_PIN_##pin << 16) | MFPR_DEFAULT | (MFP_##af)) 358 ((MFP_PIN_##pin << 16) | MFPR_DEFAULT | (MFP_##af))
353 359
354#define MFP_CFG_DRV(pin, af, drv) \ 360#define MFP_CFG_DRV(pin, af, drv) \
355 ((MFP_PIN_##pin << 16) | MFPR_DEFAULT |\ 361 ((MFP_PIN_##pin << 16) | (MFPR_DEFAULT & ~MFPR_DRV_MASK) |\
356 ((MFP_##drv) << 10) | (MFP_##af)) 362 ((MFP_##drv) << 10) | (MFP_##af))
357 363
358#define MFP_CFG_LPM(pin, af, lpm) \ 364#define MFP_CFG_LPM(pin, af, lpm) \
359 ((MFP_PIN_##pin << 16) | MFPR_DEFAULT | (MFP_##af) |\ 365 ((MFP_PIN_##pin << 16) | (MFPR_DEFAULT & ~MFPR_LPM_MASK) |\
360 (((MFP_LPM_##lpm) & 0x3) << 7) |\ 366 (((MFP_LPM_##lpm) & 0x3) << 7) |\
361 (((MFP_LPM_##lpm) & 0x4) << 12) |\ 367 (((MFP_LPM_##lpm) & 0x4) << 12) |\
362 (((MFP_LPM_##lpm) & 0x8) << 10)) 368 (((MFP_LPM_##lpm) & 0x8) << 10) |\
369 (MFP_##af))
363 370
364#define MFP_CFG_X(pin, af, drv, lpm) \ 371#define MFP_CFG_X(pin, af, drv, lpm) \
365 ((MFP_PIN_##pin << 16) | MFPR_DEFAULT |\ 372 ((MFP_PIN_##pin << 16) |\
373 (MFPR_DEFAULT & ~(MFPR_DRV_MASK | MFPR_LPM_MASK)) |\
366 ((MFP_##drv) << 10) | (MFP_##af) |\ 374 ((MFP_##drv) << 10) | (MFP_##af) |\
367 (((MFP_LPM_##lpm) & 0x3) << 7) |\ 375 (((MFP_LPM_##lpm) & 0x3) << 7) |\
368 (((MFP_LPM_##lpm) & 0x4) << 12) |\ 376 (((MFP_LPM_##lpm) & 0x4) << 12) |\
diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h
index bb68b598c436..6b33df6f1995 100644
--- a/include/asm-arm/arch-pxa/pxa-regs.h
+++ b/include/asm-arm/arch-pxa/pxa-regs.h
@@ -110,7 +110,10 @@
110#define DALGN __REG(0x400000a0) /* DMA Alignment Register */ 110#define DALGN __REG(0x400000a0) /* DMA Alignment Register */
111#define DINT __REG(0x400000f0) /* DMA Interrupt Register */ 111#define DINT __REG(0x400000f0) /* DMA Interrupt Register */
112 112
113#define DRCMR(n) __REG2(0x40000100, (n)<<2) 113#define DRCMR(n) (*(((n) < 64) ? \
114 &__REG2(0x40000100, ((n) & 0x3f) << 2) : \
115 &__REG2(0x40001100, ((n) & 0x3f) << 2)))
116
114#define DRCMR0 __REG(0x40000100) /* Request to Channel Map Register for DREQ 0 */ 117#define DRCMR0 __REG(0x40000100) /* Request to Channel Map Register for DREQ 0 */
115#define DRCMR1 __REG(0x40000104) /* Request to Channel Map Register for DREQ 1 */ 118#define DRCMR1 __REG(0x40000104) /* Request to Channel Map Register for DREQ 1 */
116#define DRCMR2 __REG(0x40000108) /* Request to Channel Map Register for I2S receive Request */ 119#define DRCMR2 __REG(0x40000108) /* Request to Channel Map Register for I2S receive Request */