diff options
19 files changed, 407 insertions, 308 deletions
diff --git a/arch/arm/mach-ns9xxx/Makefile b/arch/arm/mach-ns9xxx/Makefile index ca2c68dede1d..67a9e30c8789 100644 --- a/arch/arm/mach-ns9xxx/Makefile +++ b/arch/arm/mach-ns9xxx/Makefile | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | obj-y := irq.o time.o generic.o gpio.o | 1 | obj-y := irq.o generic.o gpio.o |
| 2 | 2 | ||
| 3 | obj-$(CONFIG_MACH_CC9P9360DEV) += mach-cc9p9360dev.o | 3 | obj-$(CONFIG_MACH_CC9P9360DEV) += mach-cc9p9360dev.o |
| 4 | obj-$(CONFIG_MACH_CC9P9360JS) += mach-cc9p9360js.o | 4 | obj-$(CONFIG_MACH_CC9P9360JS) += mach-cc9p9360js.o |
| 5 | 5 | ||
| 6 | obj-$(CONFIG_PROCESSOR_NS9360) += gpio-ns9360.o processor-ns9360.o time-ns9360.o | ||
| 7 | |||
| 6 | obj-$(CONFIG_BOARD_A9M9750DEV) += board-a9m9750dev.o | 8 | obj-$(CONFIG_BOARD_A9M9750DEV) += board-a9m9750dev.o |
| 7 | obj-$(CONFIG_BOARD_JSCC9P9360) += board-jscc9p9360.o | 9 | obj-$(CONFIG_BOARD_JSCC9P9360) += board-jscc9p9360.o |
| 8 | 10 | ||
diff --git a/arch/arm/mach-ns9xxx/board-a9m9750dev.c b/arch/arm/mach-ns9xxx/board-a9m9750dev.c index 14a06da25ac2..a494b71c0195 100644 --- a/arch/arm/mach-ns9xxx/board-a9m9750dev.c +++ b/arch/arm/mach-ns9xxx/board-a9m9750dev.c | |||
| @@ -14,7 +14,8 @@ | |||
| 14 | #include <asm/gpio.h> | 14 | #include <asm/gpio.h> |
| 15 | 15 | ||
| 16 | #include <asm/arch-ns9xxx/board.h> | 16 | #include <asm/arch-ns9xxx/board.h> |
| 17 | #include <asm/arch-ns9xxx/regs-sys.h> | 17 | #include <asm/arch-ns9xxx/processor-ns9360.h> |
| 18 | #include <asm/arch-ns9xxx/regs-sys-ns9360.h> | ||
| 18 | #include <asm/arch-ns9xxx/regs-mem.h> | 19 | #include <asm/arch-ns9xxx/regs-mem.h> |
| 19 | #include <asm/arch-ns9xxx/regs-bbu.h> | 20 | #include <asm/arch-ns9xxx/regs-bbu.h> |
| 20 | #include <asm/arch-ns9xxx/regs-board-a9m9750dev.h> | 21 | #include <asm/arch-ns9xxx/regs-board-a9m9750dev.h> |
| @@ -103,9 +104,9 @@ void __init board_a9m9750dev_init_irq(void) | |||
| 103 | int i; | 104 | int i; |
| 104 | 105 | ||
| 105 | if (gpio_request(11, "board a9m9750dev extirq2") == 0) | 106 | if (gpio_request(11, "board a9m9750dev extirq2") == 0) |
| 106 | ns9xxx_gpio_configure(11, 0, 1); | 107 | ns9360_gpio_configure(11, 0, 1); |
| 107 | else | 108 | else |
| 108 | printk(KERN_ERR "%s: cannot get gpio 11 for IRQ_EXT2\n", | 109 | printk(KERN_ERR "%s: cannot get gpio 11 for IRQ_NS9XXX_EXT2\n", |
| 109 | __func__); | 110 | __func__); |
| 110 | 111 | ||
| 111 | for (i = FPGA_IRQ(0); i <= FPGA_IRQ(7); ++i) { | 112 | for (i = FPGA_IRQ(0); i <= FPGA_IRQ(7); ++i) { |
| @@ -114,13 +115,13 @@ void __init board_a9m9750dev_init_irq(void) | |||
| 114 | set_irq_flags(i, IRQF_VALID); | 115 | set_irq_flags(i, IRQF_VALID); |
| 115 | } | 116 | } |
| 116 | 117 | ||
| 117 | /* IRQ_EXT2: level sensitive + active low */ | 118 | /* IRQ_NS9XXX_EXT2: level sensitive + active low */ |
| 118 | eic = __raw_readl(SYS_EIC(2)); | 119 | eic = __raw_readl(SYS_EIC(2)); |
| 119 | REGSET(eic, SYS_EIC, PLTY, AL); | 120 | REGSET(eic, SYS_EIC, PLTY, AL); |
| 120 | REGSET(eic, SYS_EIC, LVEDG, LEVEL); | 121 | REGSET(eic, SYS_EIC, LVEDG, LEVEL); |
| 121 | __raw_writel(eic, SYS_EIC(2)); | 122 | __raw_writel(eic, SYS_EIC(2)); |
| 122 | 123 | ||
| 123 | set_irq_chained_handler(IRQ_EXT2, | 124 | set_irq_chained_handler(IRQ_NS9XXX_EXT2, |
| 124 | a9m9750dev_fpga_demux_handler); | 125 | a9m9750dev_fpga_demux_handler); |
| 125 | } | 126 | } |
| 126 | 127 | ||
diff --git a/arch/arm/mach-ns9xxx/generic.c b/arch/arm/mach-ns9xxx/generic.c index d742c921e34d..1e0f467879cc 100644 --- a/arch/arm/mach-ns9xxx/generic.c +++ b/arch/arm/mach-ns9xxx/generic.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * arch/arm/mach-ns9xxx/generic.c | 2 | * arch/arm/mach-ns9xxx/generic.c |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2006 by Digi International Inc. | 4 | * Copyright (C) 2006,2007 by Digi International Inc. |
| 5 | * All rights reserved. | 5 | * All rights reserved. |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
| @@ -11,34 +11,9 @@ | |||
| 11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
| 12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
| 13 | #include <asm/memory.h> | 13 | #include <asm/memory.h> |
| 14 | #include <asm/page.h> | ||
| 15 | #include <asm/mach-types.h> | ||
| 16 | #include <asm/mach/map.h> | ||
| 17 | #include <asm/arch-ns9xxx/regs-sys.h> | ||
| 18 | #include <asm/arch-ns9xxx/regs-mem.h> | ||
| 19 | #include <asm/arch-ns9xxx/board.h> | ||
| 20 | 14 | ||
| 21 | #include "generic.h" | 15 | #include "generic.h" |
| 22 | 16 | ||
| 23 | static struct map_desc standard_io_desc[] __initdata = { | ||
| 24 | { /* BBus */ | ||
| 25 | .virtual = io_p2v(0x90000000), | ||
| 26 | .pfn = __phys_to_pfn(0x90000000), | ||
| 27 | .length = 0x00700000, | ||
| 28 | .type = MT_DEVICE, | ||
| 29 | }, { /* AHB */ | ||
| 30 | .virtual = io_p2v(0xa0100000), | ||
| 31 | .pfn = __phys_to_pfn(0xa0100000), | ||
| 32 | .length = 0x00900000, | ||
| 33 | .type = MT_DEVICE, | ||
| 34 | }, | ||
| 35 | }; | ||
| 36 | |||
| 37 | void __init ns9xxx_map_io(void) | ||
| 38 | { | ||
| 39 | iotable_init(standard_io_desc, ARRAY_SIZE(standard_io_desc)); | ||
| 40 | } | ||
| 41 | |||
| 42 | void __init ns9xxx_init_machine(void) | 17 | void __init ns9xxx_init_machine(void) |
| 43 | { | 18 | { |
| 44 | } | 19 | } |
diff --git a/arch/arm/mach-ns9xxx/generic.h b/arch/arm/mach-ns9xxx/generic.h index 687e291773f4..82493191aad6 100644 --- a/arch/arm/mach-ns9xxx/generic.h +++ b/arch/arm/mach-ns9xxx/generic.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * arch/arm/mach-ns9xxx/generic.h | 2 | * arch/arm/mach-ns9xxx/generic.h |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2006 by Digi International Inc. | 4 | * Copyright (C) 2006,2007 by Digi International Inc. |
| 5 | * All rights reserved. | 5 | * All rights reserved. |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
| @@ -13,7 +13,4 @@ | |||
| 13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
| 14 | 14 | ||
| 15 | void __init ns9xxx_init_irq(void); | 15 | void __init ns9xxx_init_irq(void); |
| 16 | void __init ns9xxx_map_io(void); | ||
| 17 | void __init ns9xxx_init_machine(void); | 16 | void __init ns9xxx_init_machine(void); |
| 18 | |||
| 19 | extern struct sys_timer ns9xxx_timer; | ||
diff --git a/arch/arm/mach-ns9xxx/gpio-ns9360.c b/arch/arm/mach-ns9xxx/gpio-ns9360.c new file mode 100644 index 000000000000..cabfb879dda9 --- /dev/null +++ b/arch/arm/mach-ns9xxx/gpio-ns9360.c | |||
| @@ -0,0 +1,118 @@ | |||
| 1 | /* | ||
| 2 | * arch/arm/mach-ns9xxx/gpio-ns9360.c | ||
| 3 | * | ||
| 4 | * Copyright (C) 2006,2007 by Digi International Inc. | ||
| 5 | * All rights reserved. | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License version 2 as published by | ||
| 9 | * the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | #include <linux/bug.h> | ||
| 12 | #include <linux/errno.h> | ||
| 13 | #include <linux/io.h> | ||
| 14 | #include <linux/kernel.h> | ||
| 15 | #include <linux/module.h> | ||
| 16 | |||
| 17 | #include <asm/arch-ns9xxx/regs-bbu.h> | ||
| 18 | #include <asm/arch-ns9xxx/processor-ns9360.h> | ||
| 19 | |||
| 20 | #include "gpio-ns9360.h" | ||
| 21 | |||
| 22 | static inline int ns9360_valid_gpio(unsigned gpio) | ||
| 23 | { | ||
| 24 | return gpio <= 72; | ||
| 25 | } | ||
| 26 | |||
| 27 | static inline void __iomem *ns9360_gpio_get_gconfaddr(unsigned gpio) | ||
| 28 | { | ||
| 29 | if (gpio < 56) | ||
| 30 | return BBU_GCONFb1(gpio / 8); | ||
| 31 | else | ||
| 32 | /* | ||
| 33 | * this could be optimised away on | ||
| 34 | * ns9750 only builds, but it isn't ... | ||
| 35 | */ | ||
| 36 | return BBU_GCONFb2((gpio - 56) / 8); | ||
| 37 | } | ||
| 38 | |||
| 39 | static inline void __iomem *ns9360_gpio_get_gctrladdr(unsigned gpio) | ||
| 40 | { | ||
| 41 | if (gpio < 32) | ||
| 42 | return BBU_GCTRL1; | ||
| 43 | else if (gpio < 64) | ||
| 44 | return BBU_GCTRL2; | ||
| 45 | else | ||
| 46 | /* this could be optimised away on ns9750 only builds */ | ||
| 47 | return BBU_GCTRL3; | ||
| 48 | } | ||
| 49 | |||
| 50 | static inline void __iomem *ns9360_gpio_get_gstataddr(unsigned gpio) | ||
| 51 | { | ||
| 52 | if (gpio < 32) | ||
| 53 | return BBU_GSTAT1; | ||
| 54 | else if (gpio < 64) | ||
| 55 | return BBU_GSTAT2; | ||
| 56 | else | ||
| 57 | /* this could be optimised away on ns9750 only builds */ | ||
| 58 | return BBU_GSTAT3; | ||
| 59 | } | ||
| 60 | |||
| 61 | /* | ||
| 62 | * each gpio can serve for 4 different purposes [0..3]. These are called | ||
| 63 | * "functions" and passed in the parameter func. Functions 0-2 are always some | ||
| 64 | * special things, function 3 is GPIO. If func == 3 dir specifies input or | ||
| 65 | * output, and with inv you can enable an inverter (independent of func). | ||
| 66 | */ | ||
| 67 | int __ns9360_gpio_configure(unsigned gpio, int dir, int inv, int func) | ||
| 68 | { | ||
| 69 | void __iomem *conf = ns9360_gpio_get_gconfaddr(gpio); | ||
| 70 | u32 confval; | ||
| 71 | |||
| 72 | confval = __raw_readl(conf); | ||
| 73 | REGSETIM_IDX(confval, BBU_GCONFx, DIR, gpio & 7, dir); | ||
| 74 | REGSETIM_IDX(confval, BBU_GCONFx, INV, gpio & 7, inv); | ||
| 75 | REGSETIM_IDX(confval, BBU_GCONFx, FUNC, gpio & 7, func); | ||
| 76 | __raw_writel(confval, conf); | ||
| 77 | |||
| 78 | return 0; | ||
| 79 | } | ||
| 80 | |||
| 81 | int ns9360_gpio_configure(unsigned gpio, int inv, int func) | ||
| 82 | { | ||
| 83 | if (likely(ns9360_valid_gpio(gpio))) { | ||
| 84 | if (func == 3) { | ||
| 85 | printk(KERN_WARNING "use gpio_direction_input " | ||
| 86 | "or gpio_direction_output\n"); | ||
| 87 | return -EINVAL; | ||
| 88 | } else | ||
| 89 | return __ns9360_gpio_configure(gpio, 0, inv, func); | ||
| 90 | } else | ||
| 91 | return -EINVAL; | ||
| 92 | } | ||
| 93 | EXPORT_SYMBOL(ns9360_gpio_configure); | ||
| 94 | |||
| 95 | int ns9360_gpio_get_value(unsigned gpio) | ||
| 96 | { | ||
| 97 | void __iomem *stat = ns9360_gpio_get_gstataddr(gpio); | ||
| 98 | int ret; | ||
| 99 | |||
| 100 | ret = 1 & (__raw_readl(stat) >> (gpio & 31)); | ||
| 101 | |||
| 102 | return ret; | ||
| 103 | } | ||
| 104 | |||
| 105 | void ns9360_gpio_set_value(unsigned gpio, int value) | ||
| 106 | { | ||
| 107 | void __iomem *ctrl = ns9360_gpio_get_gctrladdr(gpio); | ||
| 108 | u32 ctrlval; | ||
| 109 | |||
| 110 | ctrlval = __raw_readl(ctrl); | ||
| 111 | |||
| 112 | if (value) | ||
| 113 | ctrlval |= 1 << (gpio & 31); | ||
| 114 | else | ||
| 115 | ctrlval &= ~(1 << (gpio & 31)); | ||
| 116 | |||
| 117 | __raw_writel(ctrlval, ctrl); | ||
| 118 | } | ||
diff --git a/arch/arm/mach-ns9xxx/gpio-ns9360.h b/arch/arm/mach-ns9xxx/gpio-ns9360.h new file mode 100644 index 000000000000..131cd1715caa --- /dev/null +++ b/arch/arm/mach-ns9xxx/gpio-ns9360.h | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | /* | ||
| 2 | * arch/arm/mach-ns9xxx/gpio-ns9360.h | ||
| 3 | * | ||
| 4 | * Copyright (C) 2006,2007 by Digi International Inc. | ||
| 5 | * All rights reserved. | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License version 2 as published by | ||
| 9 | * the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | int __ns9360_gpio_configure(unsigned gpio, int dir, int inv, int func); | ||
| 12 | int ns9360_gpio_get_value(unsigned gpio); | ||
| 13 | void ns9360_gpio_set_value(unsigned gpio, int value); | ||
diff --git a/arch/arm/mach-ns9xxx/gpio.c b/arch/arm/mach-ns9xxx/gpio.c index 5286e9fc1d30..b3c963b0c8f5 100644 --- a/arch/arm/mach-ns9xxx/gpio.c +++ b/arch/arm/mach-ns9xxx/gpio.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * arch/arm/mach-ns9xxx/gpio.c | 2 | * arch/arm/mach-ns9xxx/gpio.c |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2006 by Digi International Inc. | 4 | * Copyright (C) 2006,2007 by Digi International Inc. |
| 5 | * All rights reserved. | 5 | * All rights reserved. |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
| @@ -15,12 +15,13 @@ | |||
| 15 | 15 | ||
| 16 | #include <asm/arch-ns9xxx/gpio.h> | 16 | #include <asm/arch-ns9xxx/gpio.h> |
| 17 | #include <asm/arch-ns9xxx/processor.h> | 17 | #include <asm/arch-ns9xxx/processor.h> |
| 18 | #include <asm/arch-ns9xxx/regs-bbu.h> | 18 | #include <asm/arch-ns9xxx/processor-ns9360.h> |
| 19 | #include <asm/io.h> | ||
| 20 | #include <asm/bug.h> | 19 | #include <asm/bug.h> |
| 21 | #include <asm/types.h> | 20 | #include <asm/types.h> |
| 22 | #include <asm/bitops.h> | 21 | #include <asm/bitops.h> |
| 23 | 22 | ||
| 23 | #include "gpio-ns9360.h" | ||
| 24 | |||
| 24 | #if defined(CONFIG_PROCESSOR_NS9360) | 25 | #if defined(CONFIG_PROCESSOR_NS9360) |
| 25 | #define GPIO_MAX 72 | 26 | #define GPIO_MAX 72 |
| 26 | #elif defined(CONFIG_PROCESSOR_NS9750) | 27 | #elif defined(CONFIG_PROCESSOR_NS9750) |
| @@ -45,41 +46,10 @@ static inline int ns9xxx_valid_gpio(unsigned gpio) | |||
| 45 | return gpio <= 49; | 46 | return gpio <= 49; |
| 46 | else | 47 | else |
| 47 | #endif | 48 | #endif |
| 49 | { | ||
| 48 | BUG(); | 50 | BUG(); |
| 49 | } | 51 | return 0; |
| 50 | 52 | } | |
| 51 | static inline void __iomem *ns9xxx_gpio_get_gconfaddr(unsigned gpio) | ||
| 52 | { | ||
| 53 | if (gpio < 56) | ||
| 54 | return BBU_GCONFb1(gpio / 8); | ||
| 55 | else | ||
| 56 | /* | ||
| 57 | * this could be optimised away on | ||
| 58 | * ns9750 only builds, but it isn't ... | ||
| 59 | */ | ||
| 60 | return BBU_GCONFb2((gpio - 56) / 8); | ||
| 61 | } | ||
| 62 | |||
| 63 | static inline void __iomem *ns9xxx_gpio_get_gctrladdr(unsigned gpio) | ||
| 64 | { | ||
| 65 | if (gpio < 32) | ||
| 66 | return BBU_GCTRL1; | ||
| 67 | else if (gpio < 64) | ||
| 68 | return BBU_GCTRL2; | ||
| 69 | else | ||
| 70 | /* this could be optimised away on ns9750 only builds */ | ||
| 71 | return BBU_GCTRL3; | ||
| 72 | } | ||
| 73 | |||
| 74 | static inline void __iomem *ns9xxx_gpio_get_gstataddr(unsigned gpio) | ||
| 75 | { | ||
| 76 | if (gpio < 32) | ||
| 77 | return BBU_GSTAT1; | ||
| 78 | else if (gpio < 64) | ||
| 79 | return BBU_GSTAT2; | ||
| 80 | else | ||
| 81 | /* this could be optimised away on ns9750 only builds */ | ||
| 82 | return BBU_GSTAT3; | ||
| 83 | } | 53 | } |
| 84 | 54 | ||
| 85 | int gpio_request(unsigned gpio, const char *label) | 55 | int gpio_request(unsigned gpio, const char *label) |
| @@ -98,49 +68,24 @@ void gpio_free(unsigned gpio) | |||
| 98 | } | 68 | } |
| 99 | EXPORT_SYMBOL(gpio_free); | 69 | EXPORT_SYMBOL(gpio_free); |
| 100 | 70 | ||
| 101 | /* | 71 | int gpio_direction_input(unsigned gpio) |
| 102 | * each gpio can serve for 4 different purposes [0..3]. These are called | ||
| 103 | * "functions" and passed in the parameter func. Functions 0-2 are always some | ||
| 104 | * special things, function 3 is GPIO. If func == 3 dir specifies input or | ||
| 105 | * output, and with inv you can enable an inverter (independent of func). | ||
| 106 | */ | ||
| 107 | static int __ns9xxx_gpio_configure(unsigned gpio, int dir, int inv, int func) | ||
| 108 | { | 72 | { |
| 109 | void __iomem *conf = ns9xxx_gpio_get_gconfaddr(gpio); | 73 | if (likely(ns9xxx_valid_gpio(gpio))) { |
| 110 | u32 confval; | 74 | int ret = -EINVAL; |
| 111 | unsigned long flags; | 75 | unsigned long flags; |
| 112 | |||
| 113 | spin_lock_irqsave(&gpio_lock, flags); | ||
| 114 | |||
| 115 | confval = __raw_readl(conf); | ||
| 116 | REGSETIM_IDX(confval, BBU_GCONFx, DIR, gpio & 7, dir); | ||
| 117 | REGSETIM_IDX(confval, BBU_GCONFx, INV, gpio & 7, inv); | ||
| 118 | REGSETIM_IDX(confval, BBU_GCONFx, FUNC, gpio & 7, func); | ||
| 119 | __raw_writel(confval, conf); | ||
| 120 | 76 | ||
| 121 | spin_unlock_irqrestore(&gpio_lock, flags); | 77 | spin_lock_irqsave(&gpio_lock, flags); |
| 78 | #if defined(CONFIG_PROCESSOR_NS9360) | ||
| 79 | if (processor_is_ns9360()) | ||
| 80 | ret = __ns9360_gpio_configure(gpio, 0, 0, 3); | ||
| 81 | else | ||
| 82 | #endif | ||
| 83 | BUG(); | ||
| 122 | 84 | ||
| 123 | return 0; | 85 | spin_unlock_irqrestore(&gpio_lock, flags); |
| 124 | } | ||
| 125 | 86 | ||
| 126 | int ns9xxx_gpio_configure(unsigned gpio, int inv, int func) | 87 | return ret; |
| 127 | { | ||
| 128 | if (likely(ns9xxx_valid_gpio(gpio))) { | ||
| 129 | if (func == 3) { | ||
| 130 | printk(KERN_WARNING "use gpio_direction_input " | ||
| 131 | "or gpio_direction_output\n"); | ||
| 132 | return -EINVAL; | ||
| 133 | } else | ||
| 134 | return __ns9xxx_gpio_configure(gpio, 0, inv, func); | ||
| 135 | } else | ||
| 136 | return -EINVAL; | ||
| 137 | } | ||
| 138 | EXPORT_SYMBOL(ns9xxx_gpio_configure); | ||
| 139 | 88 | ||
| 140 | int gpio_direction_input(unsigned gpio) | ||
| 141 | { | ||
| 142 | if (likely(ns9xxx_valid_gpio(gpio))) { | ||
| 143 | return __ns9xxx_gpio_configure(gpio, 0, 0, 3); | ||
| 144 | } else | 89 | } else |
| 145 | return -EINVAL; | 90 | return -EINVAL; |
| 146 | } | 91 | } |
| @@ -149,9 +94,22 @@ EXPORT_SYMBOL(gpio_direction_input); | |||
| 149 | int gpio_direction_output(unsigned gpio, int value) | 94 | int gpio_direction_output(unsigned gpio, int value) |
| 150 | { | 95 | { |
| 151 | if (likely(ns9xxx_valid_gpio(gpio))) { | 96 | if (likely(ns9xxx_valid_gpio(gpio))) { |
| 97 | int ret = -EINVAL; | ||
| 98 | unsigned long flags; | ||
| 99 | |||
| 152 | gpio_set_value(gpio, value); | 100 | gpio_set_value(gpio, value); |
| 153 | 101 | ||
| 154 | return __ns9xxx_gpio_configure(gpio, 1, 0, 3); | 102 | spin_lock_irqsave(&gpio_lock, flags); |
| 103 | #if defined(CONFIG_PROCESSOR_NS9360) | ||
| 104 | if (processor_is_ns9360()) | ||
| 105 | ret = __ns9360_gpio_configure(gpio, 1, 0, 3); | ||
| 106 | else | ||
| 107 | #endif | ||
| 108 | BUG(); | ||
| 109 | |||
| 110 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
| 111 | |||
| 112 | return ret; | ||
| 155 | } else | 113 | } else |
| 156 | return -EINVAL; | 114 | return -EINVAL; |
| 157 | } | 115 | } |
| @@ -159,31 +117,28 @@ EXPORT_SYMBOL(gpio_direction_output); | |||
| 159 | 117 | ||
| 160 | int gpio_get_value(unsigned gpio) | 118 | int gpio_get_value(unsigned gpio) |
| 161 | { | 119 | { |
| 162 | void __iomem *stat = ns9xxx_gpio_get_gstataddr(gpio); | 120 | #if defined(CONFIG_PROCESSOR_NS9360) |
| 163 | int ret; | 121 | if (processor_is_ns9360()) |
| 164 | 122 | return ns9360_gpio_get_value(gpio); | |
| 165 | ret = 1 & (__raw_readl(stat) >> (gpio & 31)); | 123 | else |
| 166 | 124 | #endif | |
| 167 | return ret; | 125 | { |
| 126 | BUG(); | ||
| 127 | return -EINVAL; | ||
| 128 | } | ||
| 168 | } | 129 | } |
| 169 | EXPORT_SYMBOL(gpio_get_value); | 130 | EXPORT_SYMBOL(gpio_get_value); |
| 170 | 131 | ||
| 171 | void gpio_set_value(unsigned gpio, int value) | 132 | void gpio_set_value(unsigned gpio, int value) |
| 172 | { | 133 | { |
| 173 | void __iomem *ctrl = ns9xxx_gpio_get_gctrladdr(gpio); | ||
| 174 | u32 ctrlval; | ||
| 175 | unsigned long flags; | 134 | unsigned long flags; |
| 176 | |||
| 177 | spin_lock_irqsave(&gpio_lock, flags); | 135 | spin_lock_irqsave(&gpio_lock, flags); |
| 178 | 136 | #if defined(CONFIG_PROCESSOR_NS9360) | |
| 179 | ctrlval = __raw_readl(ctrl); | 137 | if (processor_is_ns9360()) |
| 180 | 138 | ns9360_gpio_set_value(gpio, value); | |
| 181 | if (value) | ||
| 182 | ctrlval |= 1 << (gpio & 31); | ||
| 183 | else | 139 | else |
| 184 | ctrlval &= ~(1 << (gpio & 31)); | 140 | #endif |
| 185 | 141 | BUG(); | |
| 186 | __raw_writel(ctrlval, ctrl); | ||
| 187 | 142 | ||
| 188 | spin_unlock_irqrestore(&gpio_lock, flags); | 143 | spin_unlock_irqrestore(&gpio_lock, flags); |
| 189 | } | 144 | } |
diff --git a/arch/arm/mach-ns9xxx/irq.c b/arch/arm/mach-ns9xxx/irq.c index 00001b874e97..d4a583cc44c5 100644 --- a/arch/arm/mach-ns9xxx/irq.c +++ b/arch/arm/mach-ns9xxx/irq.c | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | #include <asm/io.h> | 12 | #include <asm/io.h> |
| 13 | #include <asm/mach/irq.h> | 13 | #include <asm/mach/irq.h> |
| 14 | #include <asm/mach-types.h> | 14 | #include <asm/mach-types.h> |
| 15 | #include <asm/arch-ns9xxx/regs-sys.h> | 15 | #include <asm/arch-ns9xxx/regs-sys-common.h> |
| 16 | #include <asm/arch-ns9xxx/irqs.h> | 16 | #include <asm/arch-ns9xxx/irqs.h> |
| 17 | #include <asm/arch-ns9xxx/board.h> | 17 | #include <asm/arch-ns9xxx/board.h> |
| 18 | 18 | ||
| @@ -67,7 +67,7 @@ void __init ns9xxx_init_irq(void) | |||
| 67 | for (i = 0; i < 32; ++i) | 67 | for (i = 0; i < 32; ++i) |
| 68 | __raw_writel(i, SYS_IVA(i)); | 68 | __raw_writel(i, SYS_IVA(i)); |
| 69 | 69 | ||
| 70 | for (i = IRQ_WATCHDOG; i <= IRQ_EXT3; ++i) { | 70 | for (i = 0; i <= 31; ++i) { |
| 71 | set_irq_chip(i, &ns9xxx_chip); | 71 | set_irq_chip(i, &ns9xxx_chip); |
| 72 | set_irq_handler(i, handle_level_irq); | 72 | set_irq_handler(i, handle_level_irq); |
| 73 | set_irq_flags(i, IRQF_VALID); | 73 | set_irq_flags(i, IRQF_VALID); |
diff --git a/arch/arm/mach-ns9xxx/mach-cc9p9360dev.c b/arch/arm/mach-ns9xxx/mach-cc9p9360dev.c index 760c9d0db7c3..9623fff6b3bc 100644 --- a/arch/arm/mach-ns9xxx/mach-cc9p9360dev.c +++ b/arch/arm/mach-ns9xxx/mach-cc9p9360dev.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * arch/arm/mach-ns9xxx/mach-cc9p9360dev.c | 2 | * arch/arm/mach-ns9xxx/mach-cc9p9360dev.c |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2006 by Digi International Inc. | 4 | * Copyright (C) 2006,2007 by Digi International Inc. |
| 5 | * All rights reserved. | 5 | * All rights reserved. |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
| @@ -11,12 +11,14 @@ | |||
| 11 | #include <asm/mach/arch.h> | 11 | #include <asm/mach/arch.h> |
| 12 | #include <asm/mach-types.h> | 12 | #include <asm/mach-types.h> |
| 13 | 13 | ||
| 14 | #include <asm/arch-ns9xxx/processor-ns9360.h> | ||
| 15 | |||
| 14 | #include "board-a9m9750dev.h" | 16 | #include "board-a9m9750dev.h" |
| 15 | #include "generic.h" | 17 | #include "generic.h" |
| 16 | 18 | ||
| 17 | static void __init mach_cc9p9360dev_map_io(void) | 19 | static void __init mach_cc9p9360dev_map_io(void) |
| 18 | { | 20 | { |
| 19 | ns9xxx_map_io(); | 21 | ns9360_map_io(); |
| 20 | board_a9m9750dev_map_io(); | 22 | board_a9m9750dev_map_io(); |
| 21 | } | 23 | } |
| 22 | 24 | ||
| @@ -36,6 +38,6 @@ MACHINE_START(CC9P9360DEV, "Digi ConnectCore 9P 9360 on an A9M9750 Devboard") | |||
| 36 | .map_io = mach_cc9p9360dev_map_io, | 38 | .map_io = mach_cc9p9360dev_map_io, |
| 37 | .init_irq = mach_cc9p9360dev_init_irq, | 39 | .init_irq = mach_cc9p9360dev_init_irq, |
| 38 | .init_machine = mach_cc9p9360dev_init_machine, | 40 | .init_machine = mach_cc9p9360dev_init_machine, |
| 39 | .timer = &ns9xxx_timer, | 41 | .timer = &ns9360_timer, |
| 40 | .boot_params = 0x100, | 42 | .boot_params = 0x100, |
| 41 | MACHINE_END | 43 | MACHINE_END |
diff --git a/arch/arm/mach-ns9xxx/mach-cc9p9360js.c b/arch/arm/mach-ns9xxx/mach-cc9p9360js.c index 85c8b41105c9..fcc815bdd291 100644 --- a/arch/arm/mach-ns9xxx/mach-cc9p9360js.c +++ b/arch/arm/mach-ns9xxx/mach-cc9p9360js.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * arch/arm/mach-ns9xxx/mach-cc9p9360js.c | 2 | * arch/arm/mach-ns9xxx/mach-cc9p9360js.c |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2006 by Digi International Inc. | 4 | * Copyright (C) 2006,2007 by Digi International Inc. |
| 5 | * All rights reserved. | 5 | * All rights reserved. |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
| @@ -11,6 +11,8 @@ | |||
| 11 | #include <asm/mach/arch.h> | 11 | #include <asm/mach/arch.h> |
| 12 | #include <asm/mach-types.h> | 12 | #include <asm/mach-types.h> |
| 13 | 13 | ||
| 14 | #include <asm/arch-ns9xxx/processor-ns9360.h> | ||
| 15 | |||
| 14 | #include "board-jscc9p9360.h" | 16 | #include "board-jscc9p9360.h" |
| 15 | #include "generic.h" | 17 | #include "generic.h" |
| 16 | 18 | ||
| @@ -21,9 +23,9 @@ static void __init mach_cc9p9360js_init_machine(void) | |||
| 21 | } | 23 | } |
| 22 | 24 | ||
| 23 | MACHINE_START(CC9P9360JS, "Digi ConnectCore 9P 9360 on an JSCC9P9360 Devboard") | 25 | MACHINE_START(CC9P9360JS, "Digi ConnectCore 9P 9360 on an JSCC9P9360 Devboard") |
| 24 | .map_io = ns9xxx_map_io, | 26 | .map_io = ns9360_map_io, |
| 25 | .init_irq = ns9xxx_init_irq, | 27 | .init_irq = ns9xxx_init_irq, |
| 26 | .init_machine = mach_cc9p9360js_init_machine, | 28 | .init_machine = mach_cc9p9360js_init_machine, |
| 27 | .timer = &ns9xxx_timer, | 29 | .timer = &ns9360_timer, |
| 28 | .boot_params = 0x100, | 30 | .boot_params = 0x100, |
| 29 | MACHINE_END | 31 | MACHINE_END |
diff --git a/arch/arm/mach-ns9xxx/processor-ns9360.c b/arch/arm/mach-ns9xxx/processor-ns9360.c new file mode 100644 index 000000000000..2bee0b7fccbb --- /dev/null +++ b/arch/arm/mach-ns9xxx/processor-ns9360.c | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | /* | ||
| 2 | * arch/arm/mach-ns9xxx/processor-ns9360.c | ||
| 3 | * | ||
| 4 | * Copyright (C) 2007 by Digi International Inc. | ||
| 5 | * All rights reserved. | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License version 2 as published by | ||
| 9 | * the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | #include <linux/io.h> | ||
| 12 | #include <linux/kernel.h> | ||
| 13 | #include <linux/slab.h> | ||
| 14 | |||
| 15 | #include <asm/page.h> | ||
| 16 | #include <asm/mach/map.h> | ||
| 17 | #include <asm/arch-ns9xxx/processor-ns9360.h> | ||
| 18 | #include <asm/arch-ns9xxx/regs-sys-ns9360.h> | ||
| 19 | |||
| 20 | void ns9360_reset(char mode) | ||
| 21 | { | ||
| 22 | u32 reg; | ||
| 23 | |||
| 24 | reg = __raw_readl(SYS_PLL) >> 16; | ||
| 25 | REGSET(reg, SYS_PLL, SWC, YES); | ||
| 26 | __raw_writel(reg, SYS_PLL); | ||
| 27 | } | ||
| 28 | |||
| 29 | #define CRYSTAL 29491200 /* Hz */ | ||
| 30 | unsigned long ns9360_systemclock(void) | ||
| 31 | { | ||
| 32 | u32 pll = __raw_readl(SYS_PLL); | ||
| 33 | return CRYSTAL * (REGGETIM(pll, SYS_PLL, ND) + 1) | ||
| 34 | >> REGGETIM(pll, SYS_PLL, FS); | ||
| 35 | } | ||
| 36 | |||
| 37 | static struct map_desc ns9360_io_desc[] __initdata = { | ||
| 38 | { /* BBus */ | ||
| 39 | .virtual = io_p2v(0x90000000), | ||
| 40 | .pfn = __phys_to_pfn(0x90000000), | ||
| 41 | .length = 0x00700000, | ||
| 42 | .type = MT_DEVICE, | ||
| 43 | }, { /* AHB */ | ||
| 44 | .virtual = io_p2v(0xa0100000), | ||
| 45 | .pfn = __phys_to_pfn(0xa0100000), | ||
| 46 | .length = 0x00900000, | ||
| 47 | .type = MT_DEVICE, | ||
| 48 | }, | ||
| 49 | }; | ||
| 50 | |||
| 51 | void __init ns9360_map_io(void) | ||
| 52 | { | ||
| 53 | iotable_init(ns9360_io_desc, ARRAY_SIZE(ns9360_io_desc)); | ||
| 54 | } | ||
diff --git a/arch/arm/mach-ns9xxx/time.c b/arch/arm/mach-ns9xxx/time-ns9360.c index c3dd1f4acb99..4d573c9793ed 100644 --- a/arch/arm/mach-ns9xxx/time.c +++ b/arch/arm/mach-ns9xxx/time-ns9360.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * arch/arm/mach-ns9xxx/time.c | 2 | * arch/arm/mach-ns9xxx/time-ns9360.c |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2006 by Digi International Inc. | 4 | * Copyright (C) 2006,2007 by Digi International Inc. |
| 5 | * All rights reserved. | 5 | * All rights reserved. |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
| @@ -15,8 +15,8 @@ | |||
| 15 | #include <linux/clocksource.h> | 15 | #include <linux/clocksource.h> |
| 16 | #include <linux/clockchips.h> | 16 | #include <linux/clockchips.h> |
| 17 | 17 | ||
| 18 | #include <asm/arch-ns9xxx/regs-sys.h> | 18 | #include <asm/arch-ns9xxx/processor-ns9360.h> |
| 19 | #include <asm/arch-ns9xxx/clock.h> | 19 | #include <asm/arch-ns9xxx/regs-sys-ns9360.h> |
| 20 | #include <asm/arch-ns9xxx/irqs.h> | 20 | #include <asm/arch-ns9xxx/irqs.h> |
| 21 | #include <asm/arch/system.h> | 21 | #include <asm/arch/system.h> |
| 22 | #include "generic.h" | 22 | #include "generic.h" |
| @@ -25,26 +25,26 @@ | |||
| 25 | #define TIMER_CLOCKEVENT 1 | 25 | #define TIMER_CLOCKEVENT 1 |
| 26 | static u32 latch; | 26 | static u32 latch; |
| 27 | 27 | ||
| 28 | static cycle_t ns9xxx_clocksource_read(void) | 28 | static cycle_t ns9360_clocksource_read(void) |
| 29 | { | 29 | { |
| 30 | return __raw_readl(SYS_TR(TIMER_CLOCKSOURCE)); | 30 | return __raw_readl(SYS_TR(TIMER_CLOCKSOURCE)); |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | static struct clocksource ns9xxx_clocksource = { | 33 | static struct clocksource ns9360_clocksource = { |
| 34 | .name = "ns9xxx-timer" __stringify(TIMER_CLOCKSOURCE), | 34 | .name = "ns9360-timer" __stringify(TIMER_CLOCKSOURCE), |
| 35 | .rating = 300, | 35 | .rating = 300, |
| 36 | .read = ns9xxx_clocksource_read, | 36 | .read = ns9360_clocksource_read, |
| 37 | .mask = CLOCKSOURCE_MASK(32), | 37 | .mask = CLOCKSOURCE_MASK(32), |
| 38 | .shift = 20, | 38 | .shift = 20, |
| 39 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 39 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
| 40 | }; | 40 | }; |
| 41 | 41 | ||
| 42 | static void ns9xxx_clockevent_setmode(enum clock_event_mode mode, | 42 | static void ns9360_clockevent_setmode(enum clock_event_mode mode, |
| 43 | struct clock_event_device *clk) | 43 | struct clock_event_device *clk) |
| 44 | { | 44 | { |
| 45 | u32 tc = __raw_readl(SYS_TC(TIMER_CLOCKEVENT)); | 45 | u32 tc = __raw_readl(SYS_TC(TIMER_CLOCKEVENT)); |
| 46 | 46 | ||
| 47 | switch(mode) { | 47 | switch (mode) { |
| 48 | case CLOCK_EVT_MODE_PERIODIC: | 48 | case CLOCK_EVT_MODE_PERIODIC: |
| 49 | __raw_writel(latch, SYS_TRC(TIMER_CLOCKEVENT)); | 49 | __raw_writel(latch, SYS_TRC(TIMER_CLOCKEVENT)); |
| 50 | REGSET(tc, SYS_TCx, REN, EN); | 50 | REGSET(tc, SYS_TCx, REN, EN); |
| @@ -69,7 +69,7 @@ static void ns9xxx_clockevent_setmode(enum clock_event_mode mode, | |||
| 69 | __raw_writel(tc, SYS_TC(TIMER_CLOCKEVENT)); | 69 | __raw_writel(tc, SYS_TC(TIMER_CLOCKEVENT)); |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | static int ns9xxx_clockevent_setnextevent(unsigned long evt, | 72 | static int ns9360_clockevent_setnextevent(unsigned long evt, |
| 73 | struct clock_event_device *clk) | 73 | struct clock_event_device *clk) |
| 74 | { | 74 | { |
| 75 | u32 tc = __raw_readl(SYS_TC(TIMER_CLOCKEVENT)); | 75 | u32 tc = __raw_readl(SYS_TC(TIMER_CLOCKEVENT)); |
| @@ -88,20 +88,20 @@ static int ns9xxx_clockevent_setnextevent(unsigned long evt, | |||
| 88 | return 0; | 88 | return 0; |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | static struct clock_event_device ns9xxx_clockevent_device = { | 91 | static struct clock_event_device ns9360_clockevent_device = { |
| 92 | .name = "ns9xxx-timer" __stringify(TIMER_CLOCKEVENT), | 92 | .name = "ns9360-timer" __stringify(TIMER_CLOCKEVENT), |
| 93 | .shift = 20, | 93 | .shift = 20, |
| 94 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, | 94 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, |
| 95 | .set_mode = ns9xxx_clockevent_setmode, | 95 | .set_mode = ns9360_clockevent_setmode, |
| 96 | .set_next_event = ns9xxx_clockevent_setnextevent, | 96 | .set_next_event = ns9360_clockevent_setnextevent, |
| 97 | }; | 97 | }; |
| 98 | 98 | ||
| 99 | static irqreturn_t ns9xxx_clockevent_handler(int irq, void *dev_id) | 99 | static irqreturn_t ns9360_clockevent_handler(int irq, void *dev_id) |
| 100 | { | 100 | { |
| 101 | int timerno = irq - IRQ_TIMER0; | 101 | int timerno = irq - IRQ_NS9360_TIMER0; |
| 102 | u32 tc; | 102 | u32 tc; |
| 103 | 103 | ||
| 104 | struct clock_event_device *evt = &ns9xxx_clockevent_device; | 104 | struct clock_event_device *evt = &ns9360_clockevent_device; |
| 105 | 105 | ||
| 106 | /* clear irq */ | 106 | /* clear irq */ |
| 107 | tc = __raw_readl(SYS_TC(timerno)); | 107 | tc = __raw_readl(SYS_TC(timerno)); |
| @@ -119,13 +119,13 @@ static irqreturn_t ns9xxx_clockevent_handler(int irq, void *dev_id) | |||
| 119 | return IRQ_HANDLED; | 119 | return IRQ_HANDLED; |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | static struct irqaction ns9xxx_clockevent_action = { | 122 | static struct irqaction ns9360_clockevent_action = { |
| 123 | .name = "ns9xxx-timer" __stringify(TIMER_CLOCKEVENT), | 123 | .name = "ns9360-timer" __stringify(TIMER_CLOCKEVENT), |
| 124 | .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, | 124 | .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, |
| 125 | .handler = ns9xxx_clockevent_handler, | 125 | .handler = ns9360_clockevent_handler, |
| 126 | }; | 126 | }; |
| 127 | 127 | ||
| 128 | static void __init ns9xxx_timer_init(void) | 128 | static void __init ns9360_timer_init(void) |
| 129 | { | 129 | { |
| 130 | int tc; | 130 | int tc; |
| 131 | 131 | ||
| @@ -148,12 +148,12 @@ static void __init ns9xxx_timer_init(void) | |||
| 148 | 148 | ||
| 149 | __raw_writel(tc, SYS_TC(TIMER_CLOCKSOURCE)); | 149 | __raw_writel(tc, SYS_TC(TIMER_CLOCKSOURCE)); |
| 150 | 150 | ||
| 151 | ns9xxx_clocksource.mult = clocksource_hz2mult(ns9xxx_cpuclock(), | 151 | ns9360_clocksource.mult = clocksource_hz2mult(ns9360_cpuclock(), |
| 152 | ns9xxx_clocksource.shift); | 152 | ns9360_clocksource.shift); |
| 153 | 153 | ||
| 154 | clocksource_register(&ns9xxx_clocksource); | 154 | clocksource_register(&ns9360_clocksource); |
| 155 | 155 | ||
| 156 | latch = SH_DIV(ns9xxx_cpuclock(), HZ, 0); | 156 | latch = SH_DIV(ns9360_cpuclock(), HZ, 0); |
| 157 | 157 | ||
| 158 | tc = __raw_readl(SYS_TC(TIMER_CLOCKEVENT)); | 158 | tc = __raw_readl(SYS_TC(TIMER_CLOCKEVENT)); |
| 159 | REGSET(tc, SYS_TCx, TEN, DIS); | 159 | REGSET(tc, SYS_TCx, TEN, DIS); |
| @@ -166,19 +166,20 @@ static void __init ns9xxx_timer_init(void) | |||
| 166 | REGSET(tc, SYS_TCx, REN, EN); | 166 | REGSET(tc, SYS_TCx, REN, EN); |
| 167 | __raw_writel(tc, SYS_TC(TIMER_CLOCKEVENT)); | 167 | __raw_writel(tc, SYS_TC(TIMER_CLOCKEVENT)); |
| 168 | 168 | ||
| 169 | ns9xxx_clockevent_device.mult = div_sc(ns9xxx_cpuclock(), | 169 | ns9360_clockevent_device.mult = div_sc(ns9360_cpuclock(), |
| 170 | NSEC_PER_SEC, ns9xxx_clockevent_device.shift); | 170 | NSEC_PER_SEC, ns9360_clockevent_device.shift); |
| 171 | ns9xxx_clockevent_device.max_delta_ns = | 171 | ns9360_clockevent_device.max_delta_ns = |
| 172 | clockevent_delta2ns(-1, &ns9xxx_clockevent_device); | 172 | clockevent_delta2ns(-1, &ns9360_clockevent_device); |
| 173 | ns9xxx_clockevent_device.min_delta_ns = | 173 | ns9360_clockevent_device.min_delta_ns = |
| 174 | clockevent_delta2ns(1, &ns9xxx_clockevent_device); | 174 | clockevent_delta2ns(1, &ns9360_clockevent_device); |
| 175 | 175 | ||
| 176 | ns9xxx_clockevent_device.cpumask = cpumask_of_cpu(0); | 176 | ns9360_clockevent_device.cpumask = cpumask_of_cpu(0); |
| 177 | clockevents_register_device(&ns9xxx_clockevent_device); | 177 | clockevents_register_device(&ns9360_clockevent_device); |
| 178 | 178 | ||
| 179 | setup_irq(IRQ_TIMER0 + TIMER_CLOCKEVENT, &ns9xxx_clockevent_action); | 179 | setup_irq(IRQ_NS9360_TIMER0 + TIMER_CLOCKEVENT, |
| 180 | &ns9360_clockevent_action); | ||
| 180 | } | 181 | } |
| 181 | 182 | ||
| 182 | struct sys_timer ns9xxx_timer = { | 183 | struct sys_timer ns9360_timer = { |
| 183 | .init = ns9xxx_timer_init, | 184 | .init = ns9360_timer_init, |
| 184 | }; | 185 | }; |
diff --git a/include/asm-arm/arch-ns9xxx/clock.h b/include/asm-arm/arch-ns9xxx/clock.h deleted file mode 100644 index b943d3a92a1d..000000000000 --- a/include/asm-arm/arch-ns9xxx/clock.h +++ /dev/null | |||
| @@ -1,71 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * include/asm-arm/arch-ns9xxx/clock.h | ||
| 3 | * | ||
| 4 | * Copyright (C) 2007 by Digi International Inc. | ||
| 5 | * All rights reserved. | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License version 2 as published by | ||
| 9 | * the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | #ifndef __ASM_ARCH_CLOCK_H | ||
| 12 | #define __ASM_ARCH_CLOCK_H | ||
| 13 | |||
| 14 | #include <asm/arch-ns9xxx/regs-sys.h> | ||
| 15 | |||
| 16 | #define CRYSTAL 29491200 /* Hz */ | ||
| 17 | |||
| 18 | /* The HRM calls this value f_vco */ | ||
| 19 | static inline u32 ns9xxx_systemclock(void) __attribute__((const)); | ||
| 20 | static inline u32 ns9xxx_systemclock(void) | ||
| 21 | { | ||
| 22 | u32 pll = __raw_readl(SYS_PLL); | ||
| 23 | |||
| 24 | /* | ||
| 25 | * The system clock should be a multiple of HZ * TIMERCLOCKSELECT (in | ||
| 26 | * time.c). | ||
| 27 | * | ||
| 28 | * The following values are given: | ||
| 29 | * - TIMERCLOCKSELECT == 2^i for an i in {0 .. 6} | ||
| 30 | * - CRYSTAL == 29491200 == 2^17 * 3^2 * 5^2 | ||
| 31 | * - ND in {0 .. 31} | ||
| 32 | * - FS in {0 .. 3} | ||
| 33 | * | ||
| 34 | * Assuming the worst, we consider: | ||
| 35 | * - TIMERCLOCKSELECT == 64 | ||
| 36 | * - ND == 0 | ||
| 37 | * - FS == 3 | ||
| 38 | * | ||
| 39 | * So HZ should be a divisor of: | ||
| 40 | * (CRYSTAL * (ND + 1) >> FS) / TIMERCLOCKSELECT | ||
| 41 | * == (2^17 * 3^2 * 5^2 * 1 >> 3) / 64 | ||
| 42 | * == 2^8 * 3^2 * 5^2 | ||
| 43 | * == 57600 | ||
| 44 | * | ||
| 45 | * Currently HZ is defined to be 100 for this platform. | ||
| 46 | * | ||
| 47 | * Fine. | ||
| 48 | */ | ||
| 49 | return CRYSTAL * (REGGETIM(pll, SYS_PLL, ND) + 1) | ||
| 50 | >> REGGETIM(pll, SYS_PLL, FS); | ||
| 51 | } | ||
| 52 | |||
| 53 | static inline u32 ns9xxx_cpuclock(void) __attribute__((const)); | ||
| 54 | static inline u32 ns9xxx_cpuclock(void) | ||
| 55 | { | ||
| 56 | return ns9xxx_systemclock() / 2; | ||
| 57 | } | ||
| 58 | |||
| 59 | static inline u32 ns9xxx_ahbclock(void) __attribute__((const)); | ||
| 60 | static inline u32 ns9xxx_ahbclock(void) | ||
| 61 | { | ||
| 62 | return ns9xxx_systemclock() / 4; | ||
| 63 | } | ||
| 64 | |||
| 65 | static inline u32 ns9xxx_bbusclock(void) __attribute__((const)); | ||
| 66 | static inline u32 ns9xxx_bbusclock(void) | ||
| 67 | { | ||
| 68 | return ns9xxx_systemclock() / 8; | ||
| 69 | } | ||
| 70 | |||
| 71 | #endif /* ifndef __ASM_ARCH_CLOCK_H */ | ||
diff --git a/include/asm-arm/arch-ns9xxx/entry-macro.S b/include/asm-arm/arch-ns9xxx/entry-macro.S index 5c706dd2379c..89a21c530468 100644 --- a/include/asm-arm/arch-ns9xxx/entry-macro.S +++ b/include/asm-arm/arch-ns9xxx/entry-macro.S | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * include/asm-arm/arch-ns9xxx/entry-macro.S | 2 | * include/asm-arm/arch-ns9xxx/entry-macro.S |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2006 by Digi International Inc. | 4 | * Copyright (C) 2006,2007 by Digi International Inc. |
| 5 | * All rights reserved. | 5 | * All rights reserved. |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
| @@ -9,7 +9,7 @@ | |||
| 9 | * the Free Software Foundation. | 9 | * the Free Software Foundation. |
| 10 | */ | 10 | */ |
| 11 | #include <asm/hardware.h> | 11 | #include <asm/hardware.h> |
| 12 | #include <asm/arch-ns9xxx/regs-sys.h> | 12 | #include <asm/arch-ns9xxx/regs-sys-common.h> |
| 13 | 13 | ||
| 14 | .macro get_irqnr_preamble, base, tmp | 14 | .macro get_irqnr_preamble, base, tmp |
| 15 | ldr \base, =SYS_ISRADDR | 15 | ldr \base, =SYS_ISRADDR |
diff --git a/include/asm-arm/arch-ns9xxx/irqs.h b/include/asm-arm/arch-ns9xxx/irqs.h index 25d8d28b27f3..e83d48ec42c9 100644 --- a/include/asm-arm/arch-ns9xxx/irqs.h +++ b/include/asm-arm/arch-ns9xxx/irqs.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * include/asm-arm/arch-ns9xxx/irqs.h | 2 | * include/asm-arm/arch-ns9xxx/irqs.h |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2006 by Digi International Inc. | 4 | * Copyright (C) 2006,2007 by Digi International Inc. |
| 5 | * All rights reserved. | 5 | * All rights reserved. |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
| @@ -11,38 +11,39 @@ | |||
| 11 | #ifndef __ASM_ARCH_IRQS_H | 11 | #ifndef __ASM_ARCH_IRQS_H |
| 12 | #define __ASM_ARCH_IRQS_H | 12 | #define __ASM_ARCH_IRQS_H |
| 13 | 13 | ||
| 14 | #define IRQ_WATCHDOG 0 | 14 | /* NetSilicon 9360 */ |
| 15 | #define IRQ_AHBBUSERR 1 | 15 | #define IRQ_NS9XXX_WATCHDOG 0 |
| 16 | #define IRQ_BBUSAGG 2 | 16 | #define IRQ_NS9XXX_AHBBUSERR 1 |
| 17 | #define IRQ_NS9360_BBUSAGG 2 | ||
| 17 | /* irq 3 is reserved for NS9360 */ | 18 | /* irq 3 is reserved for NS9360 */ |
| 18 | #define IRQ_ETHRX 4 | 19 | #define IRQ_NS9XXX_ETHRX 4 |
| 19 | #define IRQ_ETHTX 5 | 20 | #define IRQ_NS9XXX_ETHTX 5 |
| 20 | #define IRQ_ETHPHY 6 | 21 | #define IRQ_NS9XXX_ETHPHY 6 |
| 21 | #define IRQ_LCD 7 | 22 | #define IRQ_NS9360_LCD 7 |
| 22 | #define IRQ_SERBRX 8 | 23 | #define IRQ_NS9360_SERBRX 8 |
| 23 | #define IRQ_SERBTX 9 | 24 | #define IRQ_NS9360_SERBTX 9 |
| 24 | #define IRQ_SERARX 10 | 25 | #define IRQ_NS9360_SERARX 10 |
| 25 | #define IRQ_SERATX 11 | 26 | #define IRQ_NS9360_SERATX 11 |
| 26 | #define IRQ_SERCRX 12 | 27 | #define IRQ_NS9360_SERCRX 12 |
| 27 | #define IRQ_SERCTX 13 | 28 | #define IRQ_NS9360_SERCTX 13 |
| 28 | #define IRQ_I2C 14 | 29 | #define IRQ_NS9360_I2C 14 |
| 29 | #define IRQ_BBUSDMA 15 | 30 | #define IRQ_NS9360_BBUSDMA 15 |
| 30 | #define IRQ_TIMER0 16 | 31 | #define IRQ_NS9360_TIMER0 16 |
| 31 | #define IRQ_TIMER1 17 | 32 | #define IRQ_NS9360_TIMER1 17 |
| 32 | #define IRQ_TIMER2 18 | 33 | #define IRQ_NS9360_TIMER2 18 |
| 33 | #define IRQ_TIMER3 19 | 34 | #define IRQ_NS9360_TIMER3 19 |
| 34 | #define IRQ_TIMER4 20 | 35 | #define IRQ_NS9360_TIMER4 20 |
| 35 | #define IRQ_TIMER5 21 | 36 | #define IRQ_NS9360_TIMER5 21 |
| 36 | #define IRQ_TIMER6 22 | 37 | #define IRQ_NS9360_TIMER6 22 |
| 37 | #define IRQ_TIMER7 23 | 38 | #define IRQ_NS9360_TIMER7 23 |
| 38 | #define IRQ_RTC 24 | 39 | #define IRQ_NS9360_RTC 24 |
| 39 | #define IRQ_USBHOST 25 | 40 | #define IRQ_NS9360_USBHOST 25 |
| 40 | #define IRQ_USBDEVICE 26 | 41 | #define IRQ_NS9360_USBDEVICE 26 |
| 41 | #define IRQ_IEEE1284 27 | 42 | #define IRQ_NS9360_IEEE1284 27 |
| 42 | #define IRQ_EXT0 28 | 43 | #define IRQ_NS9XXX_EXT0 28 |
| 43 | #define IRQ_EXT1 29 | 44 | #define IRQ_NS9XXX_EXT1 29 |
| 44 | #define IRQ_EXT2 30 | 45 | #define IRQ_NS9XXX_EXT2 30 |
| 45 | #define IRQ_EXT3 31 | 46 | #define IRQ_NS9XXX_EXT3 31 |
| 46 | 47 | ||
| 47 | #define BBUS_IRQ(irq) (32 + irq) | 48 | #define BBUS_IRQ(irq) (32 + irq) |
| 48 | 49 | ||
| @@ -67,7 +68,7 @@ | |||
| 67 | /* | 68 | /* |
| 68 | * these Interrupts are specific for the a9m9750dev board. | 69 | * these Interrupts are specific for the a9m9750dev board. |
| 69 | * They are generated by an FPGA that interrupts the CPU on | 70 | * They are generated by an FPGA that interrupts the CPU on |
| 70 | * IRQ_EXT2 | 71 | * IRQ_NS9360_EXT2 |
| 71 | */ | 72 | */ |
| 72 | #define FPGA_IRQ(irq) (64 + irq) | 73 | #define FPGA_IRQ(irq) (64 + irq) |
| 73 | 74 | ||
diff --git a/include/asm-arm/arch-ns9xxx/processor-ns9360.h b/include/asm-arm/arch-ns9xxx/processor-ns9360.h new file mode 100644 index 000000000000..f3aa6c50dbe5 --- /dev/null +++ b/include/asm-arm/arch-ns9xxx/processor-ns9360.h | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | /* | ||
| 2 | * include/asm-arm/arch-ns9xxx/processor-ns9360.h | ||
| 3 | * | ||
| 4 | * Copyright (C) 2007 by Digi International Inc. | ||
| 5 | * All rights reserved. | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License version 2 as published by | ||
| 9 | * the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | #ifndef __ASM_ARCH_PROCESSORNS9360_H | ||
| 12 | #define __ASM_ARCH_PROCESSORNS9360_H | ||
| 13 | |||
| 14 | #include <linux/init.h> | ||
| 15 | |||
| 16 | void ns9360_reset(char mode); | ||
| 17 | |||
| 18 | unsigned long ns9360_systemclock(void) __attribute__((const)); | ||
| 19 | |||
| 20 | static inline unsigned long ns9360_cpuclock(void) __attribute__((const)); | ||
| 21 | static inline unsigned long ns9360_cpuclock(void) | ||
| 22 | { | ||
| 23 | return ns9360_systemclock() / 2; | ||
| 24 | } | ||
| 25 | |||
| 26 | void __init ns9360_map_io(void); | ||
| 27 | |||
| 28 | extern struct sys_timer ns9360_timer; | ||
| 29 | |||
| 30 | int ns9360_gpio_configure(unsigned gpio, int inv, int func); | ||
| 31 | |||
| 32 | #endif /* ifndef __ASM_ARCH_PROCESSORNS9360_H */ | ||
diff --git a/include/asm-arm/arch-ns9xxx/regs-sys-common.h b/include/asm-arm/arch-ns9xxx/regs-sys-common.h new file mode 100644 index 000000000000..956c57cb781f --- /dev/null +++ b/include/asm-arm/arch-ns9xxx/regs-sys-common.h | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | /* | ||
| 2 | * include/asm-arm/arch-ns9xxx/regs-sys-common.h | ||
| 3 | * | ||
| 4 | * Copyright (C) 2007 by Digi International Inc. | ||
| 5 | * All rights reserved. | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License version 2 as published by | ||
| 9 | * the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #ifndef __ASM_ARCH_REGSSYSCOMMON_H | ||
| 13 | #define __ASM_ARCH_REGSSYSCOMMON_H | ||
| 14 | #include <asm/hardware.h> | ||
| 15 | |||
| 16 | /* Interrupt Vector Address Register Level x */ | ||
| 17 | #define SYS_IVA(x) __REG2(0xa09000c4, (x)) | ||
| 18 | |||
| 19 | /* Interrupt Configuration registers */ | ||
| 20 | #define SYS_IC(x) __REG2(0xa0900144, (x)) | ||
| 21 | |||
| 22 | /* ISRADDR */ | ||
| 23 | #define SYS_ISRADDR __REG(0xa0900164) | ||
| 24 | |||
| 25 | /* Interrupt Status Active */ | ||
| 26 | #define SYS_ISA __REG(0xa0900168) | ||
| 27 | |||
| 28 | /* Interrupt Status Raw */ | ||
| 29 | #define SYS_ISR __REG(0xa090016c) | ||
| 30 | |||
| 31 | #endif /* ifndef __ASM_ARCH_REGSSYSCOMMON_H */ | ||
diff --git a/include/asm-arm/arch-ns9xxx/regs-sys.h b/include/asm-arm/arch-ns9xxx/regs-sys-ns9360.h index 749262f86204..318b6945afb6 100644 --- a/include/asm-arm/arch-ns9xxx/regs-sys.h +++ b/include/asm-arm/arch-ns9xxx/regs-sys-ns9360.h | |||
| @@ -1,15 +1,15 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * include/asm-arm/arch-ns9xxx/regs-sys.h | 2 | * include/asm-arm/arch-ns9xxx/regs-sys-ns9360.h |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2006 by Digi International Inc. | 4 | * Copyright (C) 2006,2007 by Digi International Inc. |
| 5 | * All rights reserved. | 5 | * All rights reserved. |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
| 8 | * under the terms of the GNU General Public License version 2 as published by | 8 | * under the terms of the GNU General Public License version 2 as published by |
| 9 | * the Free Software Foundation. | 9 | * the Free Software Foundation. |
| 10 | */ | 10 | */ |
| 11 | #ifndef __ASM_ARCH_REGSSYS_H | 11 | #ifndef __ASM_ARCH_REGSSYSNS9360_H |
| 12 | #define __ASM_ARCH_REGSSYS_H | 12 | #define __ASM_ARCH_REGSSYSNS9360_H |
| 13 | 13 | ||
| 14 | #include <asm/hardware.h> | 14 | #include <asm/hardware.h> |
| 15 | 15 | ||
| @@ -27,21 +27,6 @@ | |||
| 27 | /* Timer x Read register */ | 27 | /* Timer x Read register */ |
| 28 | #define SYS_TR(x) __REG2(0xa0900084, (x)) | 28 | #define SYS_TR(x) __REG2(0xa0900084, (x)) |
| 29 | 29 | ||
| 30 | /* Interrupt Vector Address Register Level x */ | ||
| 31 | #define SYS_IVA(x) __REG2(0xa09000c4, (x)) | ||
| 32 | |||
| 33 | /* Interrupt Configuration registers */ | ||
| 34 | #define SYS_IC(x) __REG2(0xa0900144, (x)) | ||
| 35 | |||
| 36 | /* ISRADDR */ | ||
| 37 | #define SYS_ISRADDR __REG(0xa0900164) | ||
| 38 | |||
| 39 | /* Interrupt Status Active */ | ||
| 40 | #define SYS_ISA __REG(0xa0900168) | ||
| 41 | |||
| 42 | /* Interrupt Status Raw */ | ||
| 43 | #define SYS_ISR __REG(0xa090016c) | ||
| 44 | |||
| 45 | /* Timer Interrupt Status register */ | 30 | /* Timer Interrupt Status register */ |
| 46 | #define SYS_TIS __REG(0xa0900170) | 31 | #define SYS_TIS __REG(0xa0900170) |
| 47 | 32 | ||
| @@ -160,4 +145,4 @@ | |||
| 160 | #define SYS_EIC_LVEDG_LEVEL __REGVAL(SYS_EIC_LVEDG, 0) | 145 | #define SYS_EIC_LVEDG_LEVEL __REGVAL(SYS_EIC_LVEDG, 0) |
| 161 | #define SYS_EIC_LVEDG_EDGE __REGVAL(SYS_EIC_LVEDG, 1) | 146 | #define SYS_EIC_LVEDG_EDGE __REGVAL(SYS_EIC_LVEDG, 1) |
| 162 | 147 | ||
| 163 | #endif /* ifndef __ASM_ARCH_REGSSYS_H */ | 148 | #endif /* ifndef __ASM_ARCH_REGSSYSNS9360_H */ |
diff --git a/include/asm-arm/arch-ns9xxx/system.h b/include/asm-arm/arch-ns9xxx/system.h index c1082bd8977c..1348073afe48 100644 --- a/include/asm-arm/arch-ns9xxx/system.h +++ b/include/asm-arm/arch-ns9xxx/system.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * include/asm-arm/arch-ns9xxx/system.h | 2 | * include/asm-arm/arch-ns9xxx/system.h |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2006 by Digi International Inc. | 4 | * Copyright (C) 2006,2007 by Digi International Inc. |
| 5 | * All rights reserved. | 5 | * All rights reserved. |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
| @@ -12,8 +12,8 @@ | |||
| 12 | #define __ASM_ARCH_SYSTEM_H | 12 | #define __ASM_ARCH_SYSTEM_H |
| 13 | 13 | ||
| 14 | #include <asm/proc-fns.h> | 14 | #include <asm/proc-fns.h> |
| 15 | #include <asm/arch-ns9xxx/regs-sys.h> | 15 | #include <asm/arch-ns9xxx/processor.h> |
| 16 | #include <asm/mach-types.h> | 16 | #include <asm/arch-ns9xxx/processor-ns9360.h> |
| 17 | 17 | ||
| 18 | static inline void arch_idle(void) | 18 | static inline void arch_idle(void) |
| 19 | { | 19 | { |
| @@ -22,11 +22,12 @@ static inline void arch_idle(void) | |||
| 22 | 22 | ||
| 23 | static inline void arch_reset(char mode) | 23 | static inline void arch_reset(char mode) |
| 24 | { | 24 | { |
| 25 | u32 reg; | 25 | #ifdef CONFIG_PROCESSOR_NS9360 |
| 26 | 26 | if (processor_is_ns9360()) | |
| 27 | reg = __raw_readl(SYS_PLL) >> 16; | 27 | ns9360_reset(mode); |
| 28 | REGSET(reg, SYS_PLL, SWC, YES); | 28 | else |
| 29 | __raw_writel(reg, SYS_PLL); | 29 | #endif |
| 30 | BUG(); | ||
| 30 | 31 | ||
| 31 | BUG(); | 32 | BUG(); |
| 32 | } | 33 | } |
