# Base git commit: 845a2fdcbd5bc5b9f652201ee95c825827a1d521 # (Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2) # # Author: Eric Miao (Fri Jun 22 05:40:17 BST 2007) # Committer: Russell King (Mon Jun 25 20:35:57 BST 2007) # # [ARM] 4451/1: pxa: make dma.c generic and remove cpu specific dma code # # Since the number of dma channels varies between pxa25x and pxa27x, it # introduces some specific code in dma.c. This patch moves the specific # code to pxa25x.c and pxa27x.c and makes dma.c more generic. # # 1. add pxa_init_dma() for dma initialization, the number of channels # are passed in by the argument # # 2. add a "prio" field to the "struct pxa_dma_channel" for the channel # priority, and is initialized in pxa_init_dma() # # 3. use a general priority comparison with the channels "prio" field so # to remove the processor specific pxa_for_each_dma_prio macro, this # is not lightning fast as the original one, but it is acceptable as # it happens when requesting dma, which is usually not so performance # critical # # Signed-off-by: eric miao # Acked-by: Nicolas Pitre # Signed-off-by: Russell King # # arch/arm/common/sharpsl_pm.c | 2 # arch/arm/mach-pxa/clock.c | 15 ++-- # arch/arm/mach-pxa/corgi.c | 6 - # arch/arm/mach-pxa/dma.c | 44 +++++++++---- # arch/arm/mach-pxa/generic.c | 6 - # arch/arm/mach-pxa/generic.h | 6 + # arch/arm/mach-pxa/idp.c | 2 # arch/arm/mach-pxa/irq.c | 106 +++++++++++++++------------------ # arch/arm/mach-pxa/lpd270.c | 2 # arch/arm/mach-pxa/lubbock.c | 2 # arch/arm/mach-pxa/mainstone.c | 2 # arch/arm/mach-pxa/pm.c | 37 ----------- # arch/arm/mach-pxa/poodle.c | 2 # arch/arm/mach-pxa/pxa25x.c | 39 ++++++++---- # arch/arm/mach-pxa/pxa27x.c | 41 +++++++++--- # arch/arm/mach-pxa/spitz.c | 6 - # arch/arm/mach-pxa/tosa.c | 2 # arch/arm/mach-pxa/trizeps4.c | 2 # drivers/mmc/host/pxamci.h | 22 ------ # include/asm-arm/arch-pxa/dma.h | 22 ------ # include/asm-arm/arch-pxa/entry-macro.S | 30 +++++++-- # include/asm-arm/arch-pxa/hardware.h | 36 +++++++++++ # include/asm-arm/arch-pxa/irqs.h | 26 +++----- # include/asm-arm/arch-pxa/pm.h | 1 # include/asm-arm/arch-pxa/pxa-regs.h | 22 ------ # 25 files changed, 237 insertions(+), 244 deletions(-) # # Author: Eric Miao (Fri Jun 22 04:14:09 BST 2007) # Committer: Russell King (Mon Jun 25 20:35:00 BST 2007) # # [ARM] 4450/1: pxa: add pxa25x_init_irq() and pxa27x_init_irq() # # /* should be ok this time, I aligned this patch to your arm:pxa2.mbox */ # # 1. move pxa25x specific IRQ initialization code to pxa25x_init_irq() # and pxa27x code to pxa27x_init_irq(), remove pxa_init_irq() # # 2. replace all pxa_init_irq() with their PXA25x or PXA27x specific # functions # # Signed-off-by: eric miao # Signed-off-by: Russell King # # # Author: Eric Miao (Wed Jun 6 06:49:59 BST 2007) # Committer: Russell King (Sun Jun 17 14:08:55 BST 2007) # # [ARM] 4440/1: PXA: enable the checking of ICIP2 for IRQs # # ICIP2 is not examined during IRQ entrance, this patch add the # checking if the processor is PXA27x or later, with CoreG bits # in CPUID (Core Generation) > 1 # # Signed-off-by: eric miao # Signed-off-by: Russell King # # # Author: Eric Miao (Wed Jun 6 06:45:18 BST 2007) # Committer: Russell King (Sun Jun 17 14:08:52 BST 2007) # # [ARM] 4438/1: PXA: remove #ifdef .. #endif from pxa_gpio_demux_handler() # # 1. use GPIO_IRQ_mask[] to select those bits of interest, actually # only those "unmasked" GPIO IRQs with their corresponding bits # in GPIO_IRQ_mask[] set to "1" should be checked # # 2. remove #ifdef PXA_LAST_GPIO > 96 .. #endif, GPIO_IRQ_mask[] # is used to mask out the irrelevant bits, so that even though # the GEDR3 on PXA25x is reserved, it will be masked, and the # following code will never run. Another point is that GPIO85- # GPIO95 bits within GEDR2 will also be masked out on PXA25x # # Signed-off-by: eric miao # Signed-off-by: Russell King # # # Author: Eric Miao (Wed Jun 6 06:37:15 BST 2007) # Committer: Russell King (Sun Jun 17 14:08:49 BST 2007) # # [ARM] 4437/1: PXA: move the GPIO IRQ initialization code to pxa_init_irq_gpio() # # move the GPIO IRQ initialization code to pxa_init_irq_gpio() # # Signed-off-by: eric miao # Signed-off-by: Russell King # # # Author: Eric Miao (Wed Jun 6 06:36:04 BST 2007) # Committer: Russell King (Sun Jun 17 14:08:44 BST 2007) # # [ARM] 4436/1: PXA: move low IRQ initialization code to pxa_init_irq_low() # # 1. move low IRQ initialization code to pxa_init_irq_low() # # Signed-off-by: eric miao # Signed-off-by: Russell King # # # Author: Eric Miao (Wed Jun 6 06:32:38 BST 2007) # Committer: Russell King (Sun Jun 17 14:08:37 BST 2007) # # [ARM] 4435/1: PXA: remove PXA_INTERNAL_IRQS # # 1. define PXA_GPIO_IRQ_BASE to be right after the internal IRQs, # and define PXA_GPIO_IRQ_NUM to be 128 for all PXA2xx variants # # 2. make the code specific to the high IRQ numbers (32..64) to be # PXA27x specific # # 3. add a function pxa_init_irq_high() to initialize the internal # high IRQ chip, the invoke of this function could be moved to # PXA27x specific initialization code # # Signed-off-by: eric miao # Signed-off-by: Russell King # # # Author: Eric Miao (Wed Jun 6 06:22:20 BST 2007) # Committer: Russell King (Sun Jun 17 14:08:27 BST 2007) # # [ARM] 4434/1: PXA: remove PXA_IRQ_SKIP # # 1. PXA_IRQ_SKIP is defined to be 7 on PXA25x so that the first IRQ # starts from zero. This makes IRQ numbering inconsistent between # PXA25x and PXA27x. Remove this macro so that the same IRQ_XXXXX # definition has the same value on both PXA25x and PXA27x. # # 2. make IRQ_SSP3..IRQ_PWRI2C valid only if PXA27x is defined, this # avoids unintentional use of these macros on PXA25x # # Signed-off-by: eric miao # Signed-off-by: Russell King # # # Author: Russell King (Tue May 15 11:22:48 BST 2007) # Committer: Russell King (Mon Jun 11 10:16:04 BST 2007) # # [ARM] pxa: Fix PXA27x suspend type validation, remove pxa_pm_prepare() # # pxa_pm_prepare() tried to validate the suspend method type. As # noted in previous commits: # eb9289eb20df6b54214c45ac7c6bf5179a149026 # 9c372d06ce9ddf65e1393f9ea22a6d6bd5f96b42 # e8c9c502690efd24b7055bf608e7a3c34216848b # # the checking of the suspend type in the 'prepare' method is the # wrong place to do this; use the 'valid' method instead. This # means that pxa_pm_prepare() can be entirely removed. # # Signed-off-by: Russell King # # # Author: Russell King (Tue May 15 11:16:10 BST 2007) # Committer: Russell King (Mon Jun 11 10:16:04 BST 2007) # # [ARM] pxa: move pm_ops structure into CPU specific files # # Move the pm_ops structure into the PXA25x and PXA27x support # files. Remove the old pxa_pm_prepare() function, and rename # the both pxa_cpu_pm_prepare() functions as pxa_pm_prepare(). # We'll fix that later. # # Signed-off-by: Russell King # # # Author: Russell King (Tue May 15 10:26:49 BST 2007) # Committer: Russell King (Mon Jun 11 10:16:02 BST 2007) # # [ARM] pxa: introduce cpu_is_pxaXXX macros # # Signed-off-by: Russell King # # # Author: Russell King (Wed May 16 15:44:37 BST 2007) # Committer: Russell King (Mon Jun 11 10:16:02 BST 2007) # # [ARM] pxa: remove MMC register defines from pxa-regs.h # # pxamci.h redefines the MMC registers differently so they can be used # with ioremap. Remove the incompatible definitions from pxa-regs.h. # # Signed-off-by: Russell King # # # Author: Russell King (Tue May 15 16:49:02 BST 2007) # Committer: Russell King (Mon Jun 11 10:16:02 BST 2007) # # [ARM] pxa: use mutexes instead of semaphores # # Signed-off-by: Russell King # # # Author: Russell King (Tue May 15 11:03:24 BST 2007) # Committer: Russell King (Mon Jun 11 10:15:57 BST 2007) # # [ARM] pxa: remove useless pxa_pm_finish() function # # pxa_pm_finish() does nothing but return zero. The core code # does nothing with this return value, and will not try to call # the finish method in the pm_ops structure if it is NULL. # # Therefore, we can remove this useless function. # # Signed-off-by: Russell King # # diff --git a/arch/arm/common/sharpsl_pm.c b/arch/arm/common/sharpsl_pm.c index 3bf3a92..111a7fa 100644 Index: linux-2.6.22-rc7/arch/arm/common/sharpsl_pm.c =================================================================== --- linux-2.6.22-rc7.orig/arch/arm/common/sharpsl_pm.c 2007-07-02 08:55:39.000000000 +0200 +++ linux-2.6.22-rc7/arch/arm/common/sharpsl_pm.c 2007-07-02 09:05:36.000000000 +0200 @@ -766,9 +766,7 @@ static void sharpsl_apm_get_power_status } static struct pm_ops sharpsl_pm_ops = { - .prepare = pxa_pm_prepare, .enter = corgi_pxa_pm_enter, - .finish = pxa_pm_finish, .valid = pm_valid_only_mem, }; Index: linux-2.6.22-rc7/arch/arm/mach-pxa/clock.c =================================================================== --- linux-2.6.22-rc7.orig/arch/arm/mach-pxa/clock.c 2007-07-02 08:53:36.000000000 +0200 +++ linux-2.6.22-rc7/arch/arm/mach-pxa/clock.c 2007-07-02 09:05:36.000000000 +0200 @@ -12,7 +12,6 @@ #include #include -#include struct clk { struct list_head node; @@ -25,21 +24,21 @@ struct clk { }; static LIST_HEAD(clocks); -static DECLARE_MUTEX(clocks_sem); +static DEFINE_MUTEX(clocks_mutex); static DEFINE_SPINLOCK(clocks_lock); struct clk *clk_get(struct device *dev, const char *id) { struct clk *p, *clk = ERR_PTR(-ENOENT); - down(&clocks_sem); + mutex_lock(&clocks_mutex); list_for_each_entry(p, &clocks, node) { if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { clk = p; break; } } - up(&clocks_sem); + mutex_unlock(&clocks_mutex); return clk; } @@ -101,18 +100,18 @@ static struct clk clk_gpio27 = { int clk_register(struct clk *clk) { - down(&clocks_sem); + mutex_lock(&clocks_mutex); list_add(&clk->node, &clocks); - up(&clocks_sem); + mutex_unlock(&clocks_mutex); return 0; } EXPORT_SYMBOL(clk_register); void clk_unregister(struct clk *clk) { - down(&clocks_sem); + mutex_lock(&clocks_mutex); list_del(&clk->node); - up(&clocks_sem); + mutex_unlock(&clocks_mutex); } EXPORT_SYMBOL(clk_unregister); Index: linux-2.6.22-rc7/arch/arm/mach-pxa/corgi.c =================================================================== --- linux-2.6.22-rc7.orig/arch/arm/mach-pxa/corgi.c 2007-07-02 08:53:36.000000000 +0200 +++ linux-2.6.22-rc7/arch/arm/mach-pxa/corgi.c 2007-07-02 09:05:36.000000000 +0200 @@ -368,7 +368,7 @@ MACHINE_START(CORGI, "SHARP Corgi") .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, .fixup = fixup_corgi, .map_io = pxa_map_io, - .init_irq = pxa_init_irq, + .init_irq = pxa25x_init_irq, .init_machine = corgi_init, .timer = &pxa_timer, MACHINE_END @@ -380,7 +380,7 @@ MACHINE_START(SHEPHERD, "SHARP Shepherd" .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, .fixup = fixup_corgi, .map_io = pxa_map_io, - .init_irq = pxa_init_irq, + .init_irq = pxa25x_init_irq, .init_machine = corgi_init, .timer = &pxa_timer, MACHINE_END @@ -392,7 +392,7 @@ MACHINE_START(HUSKY, "SHARP Husky") .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, .fixup = fixup_corgi, .map_io = pxa_map_io, - .init_irq = pxa_init_irq, + .init_irq = pxa25x_init_irq, .init_machine = corgi_init, .timer = &pxa_timer, MACHINE_END Index: linux-2.6.22-rc7/arch/arm/mach-pxa/dma.c =================================================================== --- linux-2.6.22-rc7.orig/arch/arm/mach-pxa/dma.c 2007-07-02 08:53:36.000000000 +0200 +++ linux-2.6.22-rc7/arch/arm/mach-pxa/dma.c 2007-07-02 09:05:36.000000000 +0200 @@ -25,12 +25,15 @@ #include -static struct dma_channel { +struct dma_channel { char *name; + pxa_dma_prio prio; void (*irq_handler)(int, void *); void *data; -} dma_channels[PXA_DMA_CHANNELS]; +}; +static struct dma_channel *dma_channels; +static int num_dma_channels; int pxa_request_dma (char *name, pxa_dma_prio prio, void (*irq_handler)(int, void *), @@ -47,8 +50,9 @@ int pxa_request_dma (char *name, pxa_dma do { /* try grabbing a DMA channel with the requested priority */ - pxa_for_each_dma_prio (i, prio) { - if (!dma_channels[i].name) { + for (i = 0; i < num_dma_channels; i++) { + if ((dma_channels[i].prio == prio) && + !dma_channels[i].name) { found = 1; break; } @@ -91,7 +95,7 @@ static irqreturn_t dma_irq_handler(int i { int i, dint = DINT; - for (i = 0; i < PXA_DMA_CHANNELS; i++) { + for (i = 0; i < num_dma_channels; i++) { if (dint & (1 << i)) { struct dma_channel *channel = &dma_channels[i]; if (channel->name && channel->irq_handler) { @@ -109,18 +113,32 @@ static irqreturn_t dma_irq_handler(int i return IRQ_HANDLED; } -static int __init pxa_dma_init (void) +int __init pxa_init_dma(int num_ch) { - int ret; + int i, ret; - ret = request_irq (IRQ_DMA, dma_irq_handler, 0, "DMA", NULL); - if (ret) + dma_channels = kzalloc(sizeof(struct dma_channel) * num_ch, GFP_KERNEL); + if (dma_channels == NULL) + return -ENOMEM; + + ret = request_irq(IRQ_DMA, dma_irq_handler, IRQF_DISABLED, "DMA", NULL); + if (ret) { printk (KERN_CRIT "Wow! Can't register IRQ for DMA\n"); - return ret; -} + kfree(dma_channels); + return ret; + } -arch_initcall(pxa_dma_init); + /* dma channel priorities on pxa2xx processors: + * ch 0 - 3, 16 - 19 <--> (0) DMA_PRIO_HIGH + * ch 4 - 7, 20 - 23 <--> (1) DMA_PRIO_MEDIUM + * ch 8 - 15, 24 - 31 <--> (2) DMA_PRIO_LOW + */ + for (i = 0; i < num_ch; i++) + dma_channels[i].prio = min((i & 0xf) >> 2, DMA_PRIO_LOW); + + num_dma_channels = num_ch; + return 0; +} EXPORT_SYMBOL(pxa_request_dma); EXPORT_SYMBOL(pxa_free_dma); - Index: linux-2.6.22-rc7/arch/arm/mach-pxa/generic.c =================================================================== --- linux-2.6.22-rc7.orig/arch/arm/mach-pxa/generic.c 2007-07-02 08:55:39.000000000 +0200 +++ linux-2.6.22-rc7/arch/arm/mach-pxa/generic.c 2007-07-02 09:05:36.000000000 +0200 @@ -448,16 +448,14 @@ static struct platform_device *devices[] static int __init pxa_init(void) { - int cpuid, ret; + int ret; ret = platform_add_devices(devices, ARRAY_SIZE(devices)); if (ret) return ret; /* Only add HWUART for PXA255/26x; PXA210/250/27x do not have it. */ - cpuid = read_cpuid(CPUID_ID); - if (((cpuid >> 4) & 0xfff) == 0x2d0 || - ((cpuid >> 4) & 0xfff) == 0x290) + if (cpu_is_pxa25x()) ret = platform_device_register(&hwuart_device); return ret; Index: linux-2.6.22-rc7/arch/arm/mach-pxa/generic.h =================================================================== --- linux-2.6.22-rc7.orig/arch/arm/mach-pxa/generic.h 2007-07-02 08:53:36.000000000 +0200 +++ linux-2.6.22-rc7/arch/arm/mach-pxa/generic.h 2007-07-02 09:05:36.000000000 +0200 @@ -12,8 +12,12 @@ struct sys_timer; extern struct sys_timer pxa_timer; +extern void __init pxa_init_irq_low(void); +extern void __init pxa_init_irq_high(void); +extern void __init pxa_init_irq_gpio(int gpio_nr); +extern void __init pxa25x_init_irq(void); +extern void __init pxa27x_init_irq(void); extern void __init pxa_map_io(void); -extern void __init pxa_init_irq(void); extern unsigned int get_clk_frequency_khz(int info); Index: linux-2.6.22-rc7/arch/arm/mach-pxa/idp.c =================================================================== --- linux-2.6.22-rc7.orig/arch/arm/mach-pxa/idp.c 2007-07-02 08:53:36.000000000 +0200 +++ linux-2.6.22-rc7/arch/arm/mach-pxa/idp.c 2007-07-02 09:05:36.000000000 +0200 @@ -152,7 +152,7 @@ static void __init idp_init(void) static void __init idp_init_irq(void) { - pxa_init_irq(); + pxa25x_init_irq(); set_irq_type(TOUCH_PANEL_IRQ, TOUCH_PANEL_IRQ_EDGE); } Index: linux-2.6.22-rc7/arch/arm/mach-pxa/irq.c =================================================================== --- linux-2.6.22-rc7.orig/arch/arm/mach-pxa/irq.c 2007-07-02 08:55:39.000000000 +0200 +++ linux-2.6.22-rc7/arch/arm/mach-pxa/irq.c 2007-07-02 09:05:36.000000000 +0200 @@ -30,12 +30,12 @@ static void pxa_mask_low_irq(unsigned int irq) { - ICMR &= ~(1 << (irq + PXA_IRQ_SKIP)); + ICMR &= ~(1 << irq); } static void pxa_unmask_low_irq(unsigned int irq) { - ICMR |= (1 << (irq + PXA_IRQ_SKIP)); + ICMR |= (1 << irq); } static int pxa_set_wake(unsigned int irq, unsigned int on) @@ -67,7 +67,27 @@ static struct irq_chip pxa_internal_chip .set_wake = pxa_set_wake, }; -#if PXA_INTERNAL_IRQS > 32 +void __init pxa_init_irq_low(void) +{ + int irq; + + /* disable all IRQs */ + ICMR = 0; + + /* all IRQs are IRQ, not FIQ */ + ICLR = 0; + + /* only unmasked interrupts kick us out of idle */ + ICCR = 1; + + for (irq = PXA_IRQ(0); irq <= PXA_IRQ(31); irq++) { + set_irq_chip(irq, &pxa_internal_chip_low); + set_irq_handler(irq, handle_level_irq); + set_irq_flags(irq, IRQF_VALID); + } +} + +#ifdef CONFIG_PXA27x /* * This is for the second set of internal IRQs as found on the PXA27x. @@ -75,12 +95,12 @@ static struct irq_chip pxa_internal_chip static void pxa_mask_high_irq(unsigned int irq) { - ICMR2 &= ~(1 << (irq - 32 + PXA_IRQ_SKIP)); + ICMR2 &= ~(1 << (irq - 32)); } static void pxa_unmask_high_irq(unsigned int irq) { - ICMR2 |= (1 << (irq - 32 + PXA_IRQ_SKIP)); + ICMR2 |= (1 << (irq - 32)); } static struct irq_chip pxa_internal_chip_high = { @@ -90,6 +110,19 @@ static struct irq_chip pxa_internal_chip .unmask = pxa_unmask_high_irq, }; +void __init pxa_init_irq_high(void) +{ + int irq; + + ICMR2 = 0; + ICLR2 = 0; + + for (irq = PXA_IRQ(32); irq < PXA_IRQ(64); irq++) { + set_irq_chip(irq, &pxa_internal_chip_high); + set_irq_handler(irq, handle_level_irq); + set_irq_flags(irq, IRQF_VALID); + } +} #endif /* Note that if an input/irq line ever gets changed to an output during @@ -217,7 +250,7 @@ static void pxa_gpio_demux_handler(unsig do { loop = 0; - mask = GEDR0 & ~3; + mask = GEDR0 & GPIO_IRQ_mask[0] & ~3; if (mask) { GEDR0 = mask; irq = IRQ_GPIO(2); @@ -233,7 +266,7 @@ static void pxa_gpio_demux_handler(unsig loop = 1; } - mask = GEDR1; + mask = GEDR1 & GPIO_IRQ_mask[1]; if (mask) { GEDR1 = mask; irq = IRQ_GPIO(32); @@ -248,7 +281,7 @@ static void pxa_gpio_demux_handler(unsig loop = 1; } - mask = GEDR2; + mask = GEDR2 & GPIO_IRQ_mask[2]; if (mask) { GEDR2 = mask; irq = IRQ_GPIO(64); @@ -263,8 +296,7 @@ static void pxa_gpio_demux_handler(unsig loop = 1; } -#if PXA_LAST_GPIO >= 96 - mask = GEDR3; + mask = GEDR3 & GPIO_IRQ_mask[3]; if (mask) { GEDR3 = mask; irq = IRQ_GPIO(96); @@ -278,7 +310,6 @@ static void pxa_gpio_demux_handler(unsig } while (mask); loop = 1; } -#endif } while (loop); } @@ -314,64 +345,27 @@ static struct irq_chip pxa_muxed_gpio_ch .set_wake = pxa_set_gpio_wake, }; - -void __init pxa_init_irq(void) +void __init pxa_init_irq_gpio(int gpio_nr) { - int irq; - - /* disable all IRQs */ - ICMR = 0; - - /* all IRQs are IRQ, not FIQ */ - ICLR = 0; + int irq, i; /* clear all GPIO edge detects */ - GFER0 = 0; - GFER1 = 0; - GFER2 = 0; - GRER0 = 0; - GRER1 = 0; - GRER2 = 0; - GEDR0 = GEDR0; - GEDR1 = GEDR1; - GEDR2 = GEDR2; - -#ifdef CONFIG_PXA27x - /* And similarly for the extra regs on the PXA27x */ - ICMR2 = 0; - ICLR2 = 0; - GFER3 = 0; - GRER3 = 0; - GEDR3 = GEDR3; -#endif - - /* only unmasked interrupts kick us out of idle */ - ICCR = 1; + for (i = 0; i < gpio_nr; i += 32) { + GFER(i) = 0; + GRER(i) = 0; + GEDR(i) = GEDR(i); + } /* GPIO 0 and 1 must have their mask bit always set */ GPIO_IRQ_mask[0] = 3; - for (irq = PXA_IRQ(PXA_IRQ_SKIP); irq <= PXA_IRQ(31); irq++) { - set_irq_chip(irq, &pxa_internal_chip_low); - set_irq_handler(irq, handle_level_irq); - set_irq_flags(irq, IRQF_VALID); - } - -#if PXA_INTERNAL_IRQS > 32 - for (irq = PXA_IRQ(32); irq < PXA_IRQ(PXA_INTERNAL_IRQS); irq++) { - set_irq_chip(irq, &pxa_internal_chip_high); - set_irq_handler(irq, handle_level_irq); - set_irq_flags(irq, IRQF_VALID); - } -#endif - for (irq = IRQ_GPIO0; irq <= IRQ_GPIO1; irq++) { set_irq_chip(irq, &pxa_low_gpio_chip); set_irq_handler(irq, handle_edge_irq); set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); } - for (irq = IRQ_GPIO(2); irq <= IRQ_GPIO(PXA_LAST_GPIO); irq++) { + for (irq = IRQ_GPIO(2); irq <= IRQ_GPIO(gpio_nr); irq++) { set_irq_chip(irq, &pxa_muxed_gpio_chip); set_irq_handler(irq, handle_edge_irq); set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); Index: linux-2.6.22-rc7/arch/arm/mach-pxa/lpd270.c =================================================================== --- linux-2.6.22-rc7.orig/arch/arm/mach-pxa/lpd270.c 2007-07-02 08:55:39.000000000 +0200 +++ linux-2.6.22-rc7/arch/arm/mach-pxa/lpd270.c 2007-07-02 09:05:36.000000000 +0200 @@ -97,7 +97,7 @@ static void __init lpd270_init_irq(void) { int irq; - pxa_init_irq(); + pxa27x_init_irq(); __raw_writew(0, LPD270_INT_MASK); __raw_writew(0, LPD270_INT_STATUS); Index: linux-2.6.22-rc7/arch/arm/mach-pxa/lubbock.c =================================================================== --- linux-2.6.22-rc7.orig/arch/arm/mach-pxa/lubbock.c 2007-07-02 08:55:39.000000000 +0200 +++ linux-2.6.22-rc7/arch/arm/mach-pxa/lubbock.c 2007-07-02 09:05:36.000000000 +0200 @@ -103,7 +103,7 @@ static void __init lubbock_init_irq(void { int irq; - pxa_init_irq(); + pxa25x_init_irq(); /* setup extra lubbock irqs */ for (irq = LUBBOCK_IRQ(0); irq <= LUBBOCK_LAST_IRQ; irq++) { Index: linux-2.6.22-rc7/arch/arm/mach-pxa/mainstone.c =================================================================== --- linux-2.6.22-rc7.orig/arch/arm/mach-pxa/mainstone.c 2007-07-02 08:55:39.000000000 +0200 +++ linux-2.6.22-rc7/arch/arm/mach-pxa/mainstone.c 2007-07-02 09:05:36.000000000 +0200 @@ -89,7 +89,7 @@ static void __init mainstone_init_irq(vo { int irq; - pxa_init_irq(); + pxa27x_init_irq(); /* setup extra Mainstone irqs */ for(irq = MAINSTONE_IRQ(0); irq <= MAINSTONE_IRQ(15); irq++) { Index: linux-2.6.22-rc7/arch/arm/mach-pxa/pm.c =================================================================== --- linux-2.6.22-rc7.orig/arch/arm/mach-pxa/pm.c 2007-07-02 08:55:39.000000000 +0200 +++ linux-2.6.22-rc7/arch/arm/mach-pxa/pm.c 2007-07-02 09:05:36.000000000 +0200 @@ -200,40 +200,3 @@ unsigned long sleep_phys_sp(void *sp) { return virt_to_phys(sp); } - -/* - * Called after processes are frozen, but before we shut down devices. - */ -int pxa_pm_prepare(suspend_state_t state) -{ - extern int pxa_cpu_pm_prepare(suspend_state_t state); - - return pxa_cpu_pm_prepare(state); -} - -EXPORT_SYMBOL_GPL(pxa_pm_prepare); - -/* - * Called after devices are re-setup, but before processes are thawed. - */ -int pxa_pm_finish(suspend_state_t state) -{ - return 0; -} - -EXPORT_SYMBOL_GPL(pxa_pm_finish); - -static struct pm_ops pxa_pm_ops = { - .prepare = pxa_pm_prepare, - .enter = pxa_pm_enter, - .finish = pxa_pm_finish, - .valid = pm_valid_only_mem, -}; - -static int __init pxa_pm_init(void) -{ - pm_set_ops(&pxa_pm_ops); - return 0; -} - -device_initcall(pxa_pm_init); Index: linux-2.6.22-rc7/arch/arm/mach-pxa/poodle.c =================================================================== --- linux-2.6.22-rc7.orig/arch/arm/mach-pxa/poodle.c 2007-07-02 08:53:36.000000000 +0200 +++ linux-2.6.22-rc7/arch/arm/mach-pxa/poodle.c 2007-07-02 09:05:36.000000000 +0200 @@ -412,7 +412,7 @@ MACHINE_START(POODLE, "SHARP Poodle") .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, .fixup = fixup_poodle, .map_io = pxa_map_io, - .init_irq = pxa_init_irq, + .init_irq = pxa25x_init_irq, .timer = &pxa_timer, .init_machine = poodle_init, MACHINE_END Index: linux-2.6.22-rc7/arch/arm/mach-pxa/pxa25x.c =================================================================== --- linux-2.6.22-rc7.orig/arch/arm/mach-pxa/pxa25x.c 2007-07-02 08:53:36.000000000 +0200 +++ linux-2.6.22-rc7/arch/arm/mach-pxa/pxa25x.c 2007-07-02 09:05:36.000000000 +0200 @@ -22,7 +22,10 @@ #include #include +#include #include +#include +#include #include "generic.h" @@ -105,18 +108,6 @@ EXPORT_SYMBOL(get_lcdclk_frequency_10khz #ifdef CONFIG_PM -int pxa_cpu_pm_prepare(suspend_state_t state) -{ - switch (state) { - case PM_SUSPEND_MEM: - break; - default: - return -EINVAL; - } - - return 0; -} - void pxa_cpu_pm_enter(suspend_state_t state) { extern void pxa_cpu_suspend(unsigned int); @@ -133,4 +124,28 @@ void pxa_cpu_pm_enter(suspend_state_t st } } +static struct pm_ops pxa25x_pm_ops = { + .enter = pxa_pm_enter, + .valid = pm_valid_only_mem, +}; +#endif + +void __init pxa25x_init_irq(void) +{ + pxa_init_irq_low(); + pxa_init_irq_gpio(85); +} + +static int __init pxa25x_init(void) +{ + if (cpu_is_pxa21x() || cpu_is_pxa25x()) { + if ((ret = pxa_init_dma(16))) + return ret; +#ifdef CONFIG_PM + pm_set_ops(&pxa25x_pm_ops); #endif + } + return 0; +} + +subsys_initcall(pxa25x_init); Index: linux-2.6.22-rc7/arch/arm/mach-pxa/pxa27x.c =================================================================== --- linux-2.6.22-rc7.orig/arch/arm/mach-pxa/pxa27x.c 2007-07-02 08:55:39.000000000 +0200 +++ linux-2.6.22-rc7/arch/arm/mach-pxa/pxa27x.c 2007-07-02 09:05:36.000000000 +0200 @@ -19,8 +19,11 @@ #include #include +#include #include #include +#include +#include #include "generic.h" @@ -122,17 +125,6 @@ EXPORT_SYMBOL(get_lcdclk_frequency_10khz #ifdef CONFIG_PM -int pxa_cpu_pm_prepare(suspend_state_t state) -{ - switch (state) { - case PM_SUSPEND_MEM: - case PM_SUSPEND_STANDBY: - return 0; - default: - return -EINVAL; - } -} - void pxa_cpu_pm_enter(suspend_state_t state) { extern void pxa_cpu_standby(void); @@ -162,6 +154,15 @@ void pxa_cpu_pm_enter(suspend_state_t st } } +static int pxa27x_pm_valid(suspend_state_t state) +{ + return state == PM_SUSPEND_MEM || state == PM_SUSPEND_STANDBY; +} + +static struct pm_ops pxa27x_pm_ops = { + .enter = pxa_pm_enter, + .valid = pxa27x_pm_valid, +}; #endif /* @@ -203,9 +204,25 @@ static struct platform_device *devices[] &ohci_device, }; +void __init pxa27x_init_irq(void) +{ + pxa_init_irq_low(); + pxa_init_irq_high(); + pxa_init_irq_gpio(128); +} + static int __init pxa27x_init(void) { - return platform_add_devices(devices, ARRAY_SIZE(devices)); + int ret = 0; + if (cpu_is_pxa27x()) { + if ((ret = pxa_init_dma(32))) + return ret; +#ifdef CONFIG_PM + pm_set_ops(&pxa27x_pm_ops); +#endif + ret = platform_add_devices(devices, ARRAY_SIZE(devices)); + } + return ret; } subsys_initcall(pxa27x_init); Index: linux-2.6.22-rc7/arch/arm/mach-pxa/spitz.c =================================================================== --- linux-2.6.22-rc7.orig/arch/arm/mach-pxa/spitz.c 2007-07-02 08:53:36.000000000 +0200 +++ linux-2.6.22-rc7/arch/arm/mach-pxa/spitz.c 2007-07-02 09:05:36.000000000 +0200 @@ -560,7 +560,7 @@ MACHINE_START(SPITZ, "SHARP Spitz") .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, .fixup = fixup_spitz, .map_io = pxa_map_io, - .init_irq = pxa_init_irq, + .init_irq = pxa27x_init_irq, .init_machine = spitz_init, .timer = &pxa_timer, MACHINE_END @@ -572,7 +572,7 @@ MACHINE_START(BORZOI, "SHARP Borzoi") .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, .fixup = fixup_spitz, .map_io = pxa_map_io, - .init_irq = pxa_init_irq, + .init_irq = pxa27x_init_irq, .init_machine = spitz_init, .timer = &pxa_timer, MACHINE_END @@ -584,7 +584,7 @@ MACHINE_START(AKITA, "SHARP Akita") .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, .fixup = fixup_spitz, .map_io = pxa_map_io, - .init_irq = pxa_init_irq, + .init_irq = pxa27x_init_irq, .init_machine = akita_init, .timer = &pxa_timer, MACHINE_END Index: linux-2.6.22-rc7/arch/arm/mach-pxa/tosa.c =================================================================== --- linux-2.6.22-rc7.orig/arch/arm/mach-pxa/tosa.c 2007-07-02 08:53:36.000000000 +0200 +++ linux-2.6.22-rc7/arch/arm/mach-pxa/tosa.c 2007-07-02 09:05:36.000000000 +0200 @@ -332,7 +332,7 @@ MACHINE_START(TOSA, "SHARP Tosa") .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, .fixup = fixup_tosa, .map_io = pxa_map_io, - .init_irq = pxa_init_irq, + .init_irq = pxa25x_init_irq, .init_machine = tosa_init, .timer = &pxa_timer, MACHINE_END Index: linux-2.6.22-rc7/arch/arm/mach-pxa/trizeps4.c =================================================================== --- linux-2.6.22-rc7.orig/arch/arm/mach-pxa/trizeps4.c 2007-07-02 08:55:39.000000000 +0200 +++ linux-2.6.22-rc7/arch/arm/mach-pxa/trizeps4.c 2007-07-02 09:05:36.000000000 +0200 @@ -503,7 +503,7 @@ MACHINE_START(TRIZEPS4, "Keith und Koep .boot_params = TRIZEPS4_SDRAM_BASE + 0x100, .init_machine = trizeps4_init, .map_io = trizeps4_map_io, - .init_irq = pxa_init_irq, + .init_irq = pxa27x_init_irq, .timer = &pxa_timer, MACHINE_END Index: linux-2.6.22-rc7/drivers/mmc/host/pxamci.h =================================================================== --- linux-2.6.22-rc7.orig/drivers/mmc/host/pxamci.h 2007-07-02 08:55:48.000000000 +0200 +++ linux-2.6.22-rc7/drivers/mmc/host/pxamci.h 2007-07-02 09:05:36.000000000 +0200 @@ -1,25 +1,3 @@ -#undef MMC_STRPCL -#undef MMC_STAT -#undef MMC_CLKRT -#undef MMC_SPI -#undef MMC_CMDAT -#undef MMC_RESTO -#undef MMC_RDTO -#undef MMC_BLKLEN -#undef MMC_NOB -#undef MMC_PRTBUF -#undef MMC_I_MASK -#undef END_CMD_RES -#undef PRG_DONE -#undef DATA_TRAN_DONE -#undef MMC_I_REG -#undef MMC_CMD -#undef MMC_ARGH -#undef MMC_ARGL -#undef MMC_RES -#undef MMC_RXFIFO -#undef MMC_TXFIFO - #define MMC_STRPCL 0x0000 #define STOP_CLOCK (1 << 0) #define START_CLOCK (2 << 0) Index: linux-2.6.22-rc7/include/asm-arm/arch-pxa/dma.h =================================================================== --- linux-2.6.22-rc7.orig/include/asm-arm/arch-pxa/dma.h 2007-07-02 08:53:36.000000000 +0200 +++ linux-2.6.22-rc7/include/asm-arm/arch-pxa/dma.h 2007-07-02 09:05:36.000000000 +0200 @@ -30,30 +30,12 @@ typedef enum { DMA_PRIO_LOW = 2 } pxa_dma_prio; -#if defined(CONFIG_PXA27x) - -#define PXA_DMA_CHANNELS 32 - -#define pxa_for_each_dma_prio(ch, prio) \ -for ( \ - ch = prio * 4; \ - ch != (4 << prio) + 16; \ - ch = (ch + 1 == (4 << prio)) ? (prio * 4 + 16) : (ch + 1) \ -) - -#elif defined(CONFIG_PXA25x) - -#define PXA_DMA_CHANNELS 16 - -#define pxa_for_each_dma_prio(ch, prio) \ - for (ch = prio * 4; ch != (4 << prio); ch++) - -#endif - /* * DMA registration */ +int __init pxa_init_dma(int num_ch); + int pxa_request_dma (char *name, pxa_dma_prio prio, void (*irq_handler)(int, void *), Index: linux-2.6.22-rc7/include/asm-arm/arch-pxa/entry-macro.S =================================================================== --- linux-2.6.22-rc7.orig/include/asm-arm/arch-pxa/entry-macro.S 2007-07-02 08:53:36.000000000 +0200 +++ linux-2.6.22-rc7/include/asm-arm/arch-pxa/entry-macro.S 2007-07-02 09:05:36.000000000 +0200 @@ -20,20 +20,38 @@ .endm .macro get_irqnr_and_base, irqnr, irqstat, base, tmp -#ifdef CONFIG_PXA27x - mrc p6, 0, \irqstat, c0, c0, 0 @ ICIP - mrc p6, 0, \irqnr, c1, c0, 0 @ ICMR -#else + mrc p15, 0, \tmp, c0, c0, 0 @ CPUID + mov \tmp, \tmp, lsr #13 + and \tmp, \tmp, #0x7 @ Core G + cmp \tmp, #1 + bhi 1004f + mov \base, #io_p2v(0x40000000) @ IIR Ctl = 0x40d00000 add \base, \base, #0x00d00000 ldr \irqstat, [\base, #0] @ ICIP ldr \irqnr, [\base, #4] @ ICMR -#endif + b 1002f + +1004: + mrc p6, 0, \irqstat, c6, c0, 0 @ ICIP2 + mrc p6, 0, \irqnr, c7, c0, 0 @ ICMR2 + ands \irqstat, \irqstat, \irqnr + beq 1003f + rsb \irqstat, \irqnr, #0 + and \irqstat, \irqstat, \irqnr + clz \irqnr, \irqstat + rsb \irqnr, \irqnr, #31 + add \irqnr, \irqnr, #32 + b 1001f +1003: + mrc p6, 0, \irqstat, c0, c0, 0 @ ICIP + mrc p6, 0, \irqnr, c1, c0, 0 @ ICMR +1002: ands \irqnr, \irqstat, \irqnr beq 1001f rsb \irqstat, \irqnr, #0 and \irqstat, \irqstat, \irqnr clz \irqnr, \irqstat - rsb \irqnr, \irqnr, #(31 - PXA_IRQ_SKIP) + rsb \irqnr, \irqnr, #31 1001: .endm Index: linux-2.6.22-rc7/include/asm-arm/arch-pxa/hardware.h =================================================================== --- linux-2.6.22-rc7.orig/include/asm-arm/arch-pxa/hardware.h 2007-07-02 08:53:36.000000000 +0200 +++ linux-2.6.22-rc7/include/asm-arm/arch-pxa/hardware.h 2007-07-02 09:05:36.000000000 +0200 @@ -62,6 +62,42 @@ #ifndef __ASSEMBLY__ +#define __cpu_is_pxa21x(id) \ + ({ \ + unsigned int _id = (id) >> 4 & 0xf3f; \ + _id == 0x212; \ + }) + +#define __cpu_is_pxa25x(id) \ + ({ \ + unsigned int _id = (id) >> 4 & 0xfff; \ + _id == 0x2d0 || _id == 0x290; \ + }) + +#define __cpu_is_pxa27x(id) \ + ({ \ + unsigned int _id = (id) >> 4 & 0xfff; \ + _id == 0x411; \ + }) + +#define cpu_is_pxa21x() \ + ({ \ + unsigned int id = read_cpuid(CPUID_ID); \ + __cpu_is_pxa21x(id); \ + }) + +#define cpu_is_pxa25x() \ + ({ \ + unsigned int id = read_cpuid(CPUID_ID); \ + __cpu_is_pxa25x(id); \ + }) + +#define cpu_is_pxa27x() \ + ({ \ + unsigned int id = read_cpuid(CPUID_ID); \ + __cpu_is_pxa27x(id); \ + }) + /* * Handy routine to set GPIO alternate functions */ Index: linux-2.6.22-rc7/include/asm-arm/arch-pxa/irqs.h =================================================================== --- linux-2.6.22-rc7.orig/include/asm-arm/arch-pxa/irqs.h 2007-07-02 08:53:36.000000000 +0200 +++ linux-2.6.22-rc7/include/asm-arm/arch-pxa/irqs.h 2007-07-02 09:05:36.000000000 +0200 @@ -11,14 +11,9 @@ */ -#ifdef CONFIG_PXA27x -#define PXA_IRQ_SKIP 0 -#else -#define PXA_IRQ_SKIP 7 -#endif - -#define PXA_IRQ(x) ((x) - PXA_IRQ_SKIP) +#define PXA_IRQ(x) (x) +#ifdef CONFIG_PXA27x #define IRQ_SSP3 PXA_IRQ(0) /* SSP3 service request */ #define IRQ_MSL PXA_IRQ(1) /* MSL Interface interrupt */ #define IRQ_USBH2 PXA_IRQ(2) /* USB Host interrupt 1 (OHCI) */ @@ -26,6 +21,8 @@ #define IRQ_KEYPAD PXA_IRQ(4) /* Key pad controller */ #define IRQ_MEMSTK PXA_IRQ(5) /* Memory Stick interrupt */ #define IRQ_PWRI2C PXA_IRQ(6) /* Power I2C interrupt */ +#endif + #define IRQ_HWUART PXA_IRQ(7) /* HWUART Transmit/Receive/Error (PXA26x) */ #define IRQ_OST_4_11 PXA_IRQ(7) /* OS timer 4-11 matches (PXA27x) */ #define IRQ_GPIO0 PXA_IRQ(8) /* GPIO0 Edge Detect */ @@ -58,18 +55,15 @@ #ifdef CONFIG_PXA27x #define IRQ_TPM PXA_IRQ(32) /* TPM interrupt */ #define IRQ_CAMERA PXA_IRQ(33) /* Camera Interface */ - -#define PXA_INTERNAL_IRQS 34 -#else -#define PXA_INTERNAL_IRQS 32 #endif -#define GPIO_2_x_TO_IRQ(x) \ - PXA_IRQ((x) - 2 + PXA_INTERNAL_IRQS) +#define PXA_GPIO_IRQ_BASE (64) +#define PXA_GPIO_IRQ_NUM (128) + +#define GPIO_2_x_TO_IRQ(x) (PXA_GPIO_IRQ_BASE + (x)) #define IRQ_GPIO(x) (((x) < 2) ? (IRQ_GPIO0 + (x)) : GPIO_2_x_TO_IRQ(x)) -#define IRQ_TO_GPIO_2_x(i) \ - ((i) - IRQ_GPIO(2) + 2) +#define IRQ_TO_GPIO_2_x(i) ((i) - PXA_GPIO_IRQ_BASE) #define IRQ_TO_GPIO(i) (((i) < IRQ_GPIO(2)) ? ((i) - IRQ_GPIO0) : IRQ_TO_GPIO_2_x(i)) #if defined(CONFIG_PXA25x) @@ -84,7 +78,7 @@ * these. If you need more, increase IRQ_BOARD_END, but keep it * within sensible limits. */ -#define IRQ_BOARD_START (IRQ_GPIO(PXA_LAST_GPIO) + 1) +#define IRQ_BOARD_START (PXA_GPIO_IRQ_BASE + PXA_GPIO_IRQ_NUM) #define IRQ_BOARD_END (IRQ_BOARD_START + 16) #define IRQ_SA1111_START (IRQ_BOARD_END) Index: linux-2.6.22-rc7/include/asm-arm/arch-pxa/pm.h =================================================================== --- linux-2.6.22-rc7.orig/include/asm-arm/arch-pxa/pm.h 2007-07-02 08:53:36.000000000 +0200 +++ linux-2.6.22-rc7/include/asm-arm/arch-pxa/pm.h 2007-07-02 09:05:36.000000000 +0200 @@ -9,4 +9,3 @@ extern int pxa_pm_prepare(suspend_state_t state); extern int pxa_pm_enter(suspend_state_t state); -extern int pxa_pm_finish(suspend_state_t state); Index: linux-2.6.22-rc7/include/asm-arm/arch-pxa/pxa-regs.h =================================================================== --- linux-2.6.22-rc7.orig/include/asm-arm/arch-pxa/pxa-regs.h 2007-07-02 08:56:00.000000000 +0200 +++ linux-2.6.22-rc7/include/asm-arm/arch-pxa/pxa-regs.h 2007-07-02 09:05:36.000000000 +0200 @@ -1765,29 +1765,9 @@ #define SSACD_P(x) (*(((x) == 1) ? &SSACD_P1 : ((x) == 2) ? &SSACD_P2 : ((x) == 3) ? &SSACD_P3 : NULL)) /* - * MultiMediaCard (MMC) controller + * MultiMediaCard (MMC) controller - see drivers/mmc/host/pxamci.h */ -#define MMC_STRPCL __REG(0x41100000) /* Control to start and stop MMC clock */ -#define MMC_STAT __REG(0x41100004) /* MMC Status Register (read only) */ -#define MMC_CLKRT __REG(0x41100008) /* MMC clock rate */ -#define MMC_SPI __REG(0x4110000c) /* SPI mode control bits */ -#define MMC_CMDAT __REG(0x41100010) /* Command/response/data sequence control */ -#define MMC_RESTO __REG(0x41100014) /* Expected response time out */ -#define MMC_RDTO __REG(0x41100018) /* Expected data read time out */ -#define MMC_BLKLEN __REG(0x4110001c) /* Block length of data transaction */ -#define MMC_NOB __REG(0x41100020) /* Number of blocks, for block mode */ -#define MMC_PRTBUF __REG(0x41100024) /* Partial MMC_TXFIFO FIFO written */ -#define MMC_I_MASK __REG(0x41100028) /* Interrupt Mask */ -#define MMC_I_REG __REG(0x4110002c) /* Interrupt Register (read only) */ -#define MMC_CMD __REG(0x41100030) /* Index of current command */ -#define MMC_ARGH __REG(0x41100034) /* MSW part of the current command argument */ -#define MMC_ARGL __REG(0x41100038) /* LSW part of the current command argument */ -#define MMC_RES __REG(0x4110003c) /* Response FIFO (read only) */ -#define MMC_RXFIFO __REG(0x41100040) /* Receive FIFO (read only) */ -#define MMC_TXFIFO __REG(0x41100044) /* Transmit FIFO (write only) */ - - /* * Core Clock */