diff options
Diffstat (limited to 'arch/arm/mach-sa1100')
-rw-r--r-- | arch/arm/mach-sa1100/collie.c | 33 | ||||
-rw-r--r-- | arch/arm/mach-sa1100/h3100.c | 7 | ||||
-rw-r--r-- | arch/arm/mach-sa1100/h3600.c | 7 | ||||
-rw-r--r-- | arch/arm/mach-sa1100/h3xxx.c | 58 | ||||
-rw-r--r-- | arch/arm/mach-sa1100/include/mach/collie.h | 4 | ||||
-rw-r--r-- | arch/arm/mach-sa1100/include/mach/h3xxx.h | 11 | ||||
-rw-r--r-- | arch/arm/mach-sa1100/include/mach/timex.h | 12 | ||||
-rw-r--r-- | arch/arm/mach-sa1100/time.c | 10 |
8 files changed, 70 insertions, 72 deletions
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c index 831a15824ec8..f9874ba60cc8 100644 --- a/arch/arm/mach-sa1100/collie.c +++ b/arch/arm/mach-sa1100/collie.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <asm/mach/arch.h> | 43 | #include <asm/mach/arch.h> |
44 | #include <asm/mach/flash.h> | 44 | #include <asm/mach/flash.h> |
45 | #include <asm/mach/map.h> | 45 | #include <asm/mach/map.h> |
46 | #include <asm/mach/irda.h> | ||
46 | 47 | ||
47 | #include <asm/hardware/scoop.h> | 48 | #include <asm/hardware/scoop.h> |
48 | #include <asm/mach/sharpsl_param.h> | 49 | #include <asm/mach/sharpsl_param.h> |
@@ -96,6 +97,37 @@ static struct mcp_plat_data collie_mcp_data = { | |||
96 | .codec_pdata = &collie_ucb1x00_data, | 97 | .codec_pdata = &collie_ucb1x00_data, |
97 | }; | 98 | }; |
98 | 99 | ||
100 | static int collie_ir_startup(struct device *dev) | ||
101 | { | ||
102 | int rc = gpio_request(COLLIE_GPIO_IR_ON, "IrDA"); | ||
103 | if (rc) | ||
104 | return rc; | ||
105 | rc = gpio_direction_output(COLLIE_GPIO_IR_ON, 1); | ||
106 | |||
107 | if (!rc) | ||
108 | return 0; | ||
109 | |||
110 | gpio_free(COLLIE_GPIO_IR_ON); | ||
111 | return rc; | ||
112 | } | ||
113 | |||
114 | static void collie_ir_shutdown(struct device *dev) | ||
115 | { | ||
116 | gpio_free(COLLIE_GPIO_IR_ON); | ||
117 | } | ||
118 | |||
119 | static int collie_ir_set_power(struct device *dev, unsigned int state) | ||
120 | { | ||
121 | gpio_set_value(COLLIE_GPIO_IR_ON, !state); | ||
122 | return 0; | ||
123 | } | ||
124 | |||
125 | static struct irda_platform_data collie_ir_data = { | ||
126 | .startup = collie_ir_startup, | ||
127 | .shutdown = collie_ir_shutdown, | ||
128 | .set_power = collie_ir_set_power, | ||
129 | }; | ||
130 | |||
99 | /* | 131 | /* |
100 | * Collie AC IN | 132 | * Collie AC IN |
101 | */ | 133 | */ |
@@ -400,6 +432,7 @@ static void __init collie_init(void) | |||
400 | sa11x0_register_mtd(&collie_flash_data, collie_flash_resources, | 432 | sa11x0_register_mtd(&collie_flash_data, collie_flash_resources, |
401 | ARRAY_SIZE(collie_flash_resources)); | 433 | ARRAY_SIZE(collie_flash_resources)); |
402 | sa11x0_register_mcp(&collie_mcp_data); | 434 | sa11x0_register_mcp(&collie_mcp_data); |
435 | sa11x0_register_irda(&collie_ir_data); | ||
403 | 436 | ||
404 | sharpsl_save_param(); | 437 | sharpsl_save_param(); |
405 | } | 438 | } |
diff --git a/arch/arm/mach-sa1100/h3100.c b/arch/arm/mach-sa1100/h3100.c index daa27c474c13..3c43219bc881 100644 --- a/arch/arm/mach-sa1100/h3100.c +++ b/arch/arm/mach-sa1100/h3100.c | |||
@@ -122,15 +122,8 @@ static struct irda_platform_data h3100_irda_data = { | |||
122 | .shutdown = h3100_irda_shutdown, | 122 | .shutdown = h3100_irda_shutdown, |
123 | }; | 123 | }; |
124 | 124 | ||
125 | static struct gpio_default_state h3100_default_gpio[] = { | ||
126 | { H3XXX_GPIO_COM_DCD, GPIO_MODE_IN, "COM DCD" }, | ||
127 | { H3XXX_GPIO_COM_CTS, GPIO_MODE_IN, "COM CTS" }, | ||
128 | { H3XXX_GPIO_COM_RTS, GPIO_MODE_OUT0, "COM RTS" }, | ||
129 | }; | ||
130 | |||
131 | static void __init h3100_mach_init(void) | 125 | static void __init h3100_mach_init(void) |
132 | { | 126 | { |
133 | h3xxx_init_gpio(h3100_default_gpio, ARRAY_SIZE(h3100_default_gpio)); | ||
134 | h3xxx_mach_init(); | 127 | h3xxx_mach_init(); |
135 | 128 | ||
136 | sa11x0_register_lcd(&h3100_lcd_info); | 129 | sa11x0_register_lcd(&h3100_lcd_info); |
diff --git a/arch/arm/mach-sa1100/h3600.c b/arch/arm/mach-sa1100/h3600.c index a663e7230141..5be54c214c7c 100644 --- a/arch/arm/mach-sa1100/h3600.c +++ b/arch/arm/mach-sa1100/h3600.c | |||
@@ -130,15 +130,8 @@ static struct irda_platform_data h3600_irda_data = { | |||
130 | .shutdown = h3600_irda_shutdown, | 130 | .shutdown = h3600_irda_shutdown, |
131 | }; | 131 | }; |
132 | 132 | ||
133 | static struct gpio_default_state h3600_default_gpio[] = { | ||
134 | { H3XXX_GPIO_COM_DCD, GPIO_MODE_IN, "COM DCD" }, | ||
135 | { H3XXX_GPIO_COM_CTS, GPIO_MODE_IN, "COM CTS" }, | ||
136 | { H3XXX_GPIO_COM_RTS, GPIO_MODE_OUT0, "COM RTS" }, | ||
137 | }; | ||
138 | |||
139 | static void __init h3600_mach_init(void) | 133 | static void __init h3600_mach_init(void) |
140 | { | 134 | { |
141 | h3xxx_init_gpio(h3600_default_gpio, ARRAY_SIZE(h3600_default_gpio)); | ||
142 | h3xxx_mach_init(); | 135 | h3xxx_mach_init(); |
143 | 136 | ||
144 | sa11x0_register_lcd(&h3600_lcd_info); | 137 | sa11x0_register_lcd(&h3600_lcd_info); |
diff --git a/arch/arm/mach-sa1100/h3xxx.c b/arch/arm/mach-sa1100/h3xxx.c index f17e7382242a..c79bf467fb7f 100644 --- a/arch/arm/mach-sa1100/h3xxx.c +++ b/arch/arm/mach-sa1100/h3xxx.c | |||
@@ -28,37 +28,6 @@ | |||
28 | 28 | ||
29 | #include "generic.h" | 29 | #include "generic.h" |
30 | 30 | ||
31 | void h3xxx_init_gpio(struct gpio_default_state *s, size_t n) | ||
32 | { | ||
33 | while (n--) { | ||
34 | const char *name = s->name; | ||
35 | int err; | ||
36 | |||
37 | if (!name) | ||
38 | name = "[init]"; | ||
39 | err = gpio_request(s->gpio, name); | ||
40 | if (err) { | ||
41 | printk(KERN_ERR "gpio%u: unable to request: %d\n", | ||
42 | s->gpio, err); | ||
43 | continue; | ||
44 | } | ||
45 | if (s->mode >= 0) { | ||
46 | err = gpio_direction_output(s->gpio, s->mode); | ||
47 | } else { | ||
48 | err = gpio_direction_input(s->gpio); | ||
49 | } | ||
50 | if (err) { | ||
51 | printk(KERN_ERR "gpio%u: unable to set direction: %d\n", | ||
52 | s->gpio, err); | ||
53 | continue; | ||
54 | } | ||
55 | if (!s->name) | ||
56 | gpio_free(s->gpio); | ||
57 | s++; | ||
58 | } | ||
59 | } | ||
60 | |||
61 | |||
62 | /* | 31 | /* |
63 | * H3xxx flash support | 32 | * H3xxx flash support |
64 | */ | 33 | */ |
@@ -116,9 +85,34 @@ static struct resource h3xxx_flash_resource = | |||
116 | /* | 85 | /* |
117 | * H3xxx uart support | 86 | * H3xxx uart support |
118 | */ | 87 | */ |
88 | static struct gpio h3xxx_uart_gpio[] = { | ||
89 | { H3XXX_GPIO_COM_DCD, GPIOF_IN, "COM DCD" }, | ||
90 | { H3XXX_GPIO_COM_CTS, GPIOF_IN, "COM CTS" }, | ||
91 | { H3XXX_GPIO_COM_RTS, GPIOF_OUT_INIT_LOW, "COM RTS" }, | ||
92 | }; | ||
93 | |||
94 | static bool h3xxx_uart_request_gpios(void) | ||
95 | { | ||
96 | static bool h3xxx_uart_gpio_ok; | ||
97 | int rc; | ||
98 | |||
99 | if (h3xxx_uart_gpio_ok) | ||
100 | return true; | ||
101 | |||
102 | rc = gpio_request_array(h3xxx_uart_gpio, ARRAY_SIZE(h3xxx_uart_gpio)); | ||
103 | if (rc) | ||
104 | pr_err("h3xxx_uart_request_gpios: error %d\n", rc); | ||
105 | else | ||
106 | h3xxx_uart_gpio_ok = true; | ||
107 | |||
108 | return h3xxx_uart_gpio_ok; | ||
109 | } | ||
110 | |||
119 | static void h3xxx_uart_set_mctrl(struct uart_port *port, u_int mctrl) | 111 | static void h3xxx_uart_set_mctrl(struct uart_port *port, u_int mctrl) |
120 | { | 112 | { |
121 | if (port->mapbase == _Ser3UTCR0) { | 113 | if (port->mapbase == _Ser3UTCR0) { |
114 | if (!h3xxx_uart_request_gpios()) | ||
115 | return; | ||
122 | gpio_set_value(H3XXX_GPIO_COM_RTS, !(mctrl & TIOCM_RTS)); | 116 | gpio_set_value(H3XXX_GPIO_COM_RTS, !(mctrl & TIOCM_RTS)); |
123 | } | 117 | } |
124 | } | 118 | } |
@@ -128,6 +122,8 @@ static u_int h3xxx_uart_get_mctrl(struct uart_port *port) | |||
128 | u_int ret = TIOCM_CD | TIOCM_CTS | TIOCM_DSR; | 122 | u_int ret = TIOCM_CD | TIOCM_CTS | TIOCM_DSR; |
129 | 123 | ||
130 | if (port->mapbase == _Ser3UTCR0) { | 124 | if (port->mapbase == _Ser3UTCR0) { |
125 | if (!h3xxx_uart_request_gpios()) | ||
126 | return ret; | ||
131 | /* | 127 | /* |
132 | * DCD and CTS bits are inverted in GPLR by RS232 transceiver | 128 | * DCD and CTS bits are inverted in GPLR by RS232 transceiver |
133 | */ | 129 | */ |
diff --git a/arch/arm/mach-sa1100/include/mach/collie.h b/arch/arm/mach-sa1100/include/mach/collie.h index f33679d2d3ee..b478ca180c19 100644 --- a/arch/arm/mach-sa1100/include/mach/collie.h +++ b/arch/arm/mach-sa1100/include/mach/collie.h | |||
@@ -13,6 +13,8 @@ | |||
13 | #ifndef __ASM_ARCH_COLLIE_H | 13 | #ifndef __ASM_ARCH_COLLIE_H |
14 | #define __ASM_ARCH_COLLIE_H | 14 | #define __ASM_ARCH_COLLIE_H |
15 | 15 | ||
16 | #include "hardware.h" /* Gives GPIO_MAX */ | ||
17 | |||
16 | extern void locomolcd_power(int on); | 18 | extern void locomolcd_power(int on); |
17 | 19 | ||
18 | #define COLLIE_SCOOP_GPIO_BASE (GPIO_MAX + 1) | 20 | #define COLLIE_SCOOP_GPIO_BASE (GPIO_MAX + 1) |
@@ -78,7 +80,7 @@ extern void locomolcd_power(int on); | |||
78 | #define COLLIE_TC35143_GPIO_VERSION0 UCB_IO_0 | 80 | #define COLLIE_TC35143_GPIO_VERSION0 UCB_IO_0 |
79 | #define COLLIE_TC35143_GPIO_TBL_CHK UCB_IO_1 | 81 | #define COLLIE_TC35143_GPIO_TBL_CHK UCB_IO_1 |
80 | #define COLLIE_TC35143_GPIO_VPEN_ON UCB_IO_2 | 82 | #define COLLIE_TC35143_GPIO_VPEN_ON UCB_IO_2 |
81 | #define COLLIE_TC35143_GPIO_IR_ON UCB_IO_3 | 83 | #define COLLIE_GPIO_IR_ON (COLLIE_TC35143_GPIO_BASE + 3) |
82 | #define COLLIE_TC35143_GPIO_AMP_ON UCB_IO_4 | 84 | #define COLLIE_TC35143_GPIO_AMP_ON UCB_IO_4 |
83 | #define COLLIE_TC35143_GPIO_VERSION1 UCB_IO_5 | 85 | #define COLLIE_TC35143_GPIO_VERSION1 UCB_IO_5 |
84 | #define COLLIE_TC35143_GPIO_FS8KLPF UCB_IO_5 | 86 | #define COLLIE_TC35143_GPIO_FS8KLPF UCB_IO_5 |
diff --git a/arch/arm/mach-sa1100/include/mach/h3xxx.h b/arch/arm/mach-sa1100/include/mach/h3xxx.h index c810620db53d..603d4343f7f6 100644 --- a/arch/arm/mach-sa1100/include/mach/h3xxx.h +++ b/arch/arm/mach-sa1100/include/mach/h3xxx.h | |||
@@ -79,17 +79,6 @@ | |||
79 | #define H3600_EGPIO_LCD_5V_ON (H3XXX_EGPIO_BASE + 14) /* enable 5V to LCD. active high. */ | 79 | #define H3600_EGPIO_LCD_5V_ON (H3XXX_EGPIO_BASE + 14) /* enable 5V to LCD. active high. */ |
80 | #define H3600_EGPIO_LVDD_ON (H3XXX_EGPIO_BASE + 15) /* enable 9V and -6.5V to LCD. */ | 80 | #define H3600_EGPIO_LVDD_ON (H3XXX_EGPIO_BASE + 15) /* enable 9V and -6.5V to LCD. */ |
81 | 81 | ||
82 | struct gpio_default_state { | ||
83 | int gpio; | ||
84 | int mode; | ||
85 | const char *name; | ||
86 | }; | ||
87 | |||
88 | #define GPIO_MODE_IN -1 | ||
89 | #define GPIO_MODE_OUT0 0 | ||
90 | #define GPIO_MODE_OUT1 1 | ||
91 | |||
92 | void h3xxx_init_gpio(struct gpio_default_state *s, size_t n); | ||
93 | void __init h3xxx_map_io(void); | 82 | void __init h3xxx_map_io(void); |
94 | void __init h3xxx_mach_init(void); | 83 | void __init h3xxx_mach_init(void); |
95 | 84 | ||
diff --git a/arch/arm/mach-sa1100/include/mach/timex.h b/arch/arm/mach-sa1100/include/mach/timex.h deleted file mode 100644 index 7a5d017b58b3..000000000000 --- a/arch/arm/mach-sa1100/include/mach/timex.h +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-sa1100/include/mach/timex.h | ||
3 | * | ||
4 | * SA1100 architecture timex specifications | ||
5 | * | ||
6 | * Copyright (C) 1998 | ||
7 | */ | ||
8 | |||
9 | /* | ||
10 | * SA1100 timer | ||
11 | */ | ||
12 | #define CLOCK_TICK_RATE 3686400 | ||
diff --git a/arch/arm/mach-sa1100/time.c b/arch/arm/mach-sa1100/time.c index 6fd4acb8f187..1dea6cfafb31 100644 --- a/arch/arm/mach-sa1100/time.c +++ b/arch/arm/mach-sa1100/time.c | |||
@@ -9,6 +9,7 @@ | |||
9 | * | 9 | * |
10 | */ | 10 | */ |
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/kernel.h> | ||
12 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
13 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
14 | #include <linux/irq.h> | 15 | #include <linux/irq.h> |
@@ -20,6 +21,9 @@ | |||
20 | #include <mach/hardware.h> | 21 | #include <mach/hardware.h> |
21 | #include <mach/irqs.h> | 22 | #include <mach/irqs.h> |
22 | 23 | ||
24 | #define SA1100_CLOCK_FREQ 3686400 | ||
25 | #define SA1100_LATCH DIV_ROUND_CLOSEST(SA1100_CLOCK_FREQ, HZ) | ||
26 | |||
23 | static u64 notrace sa1100_read_sched_clock(void) | 27 | static u64 notrace sa1100_read_sched_clock(void) |
24 | { | 28 | { |
25 | return readl_relaxed(OSCR); | 29 | return readl_relaxed(OSCR); |
@@ -93,7 +97,7 @@ static void sa1100_timer_resume(struct clock_event_device *cedev) | |||
93 | /* | 97 | /* |
94 | * OSMR0 is the system timer: make sure OSCR is sufficiently behind | 98 | * OSMR0 is the system timer: make sure OSCR is sufficiently behind |
95 | */ | 99 | */ |
96 | writel_relaxed(OSMR0 - LATCH, OSCR); | 100 | writel_relaxed(OSMR0 - SA1100_LATCH, OSCR); |
97 | } | 101 | } |
98 | #else | 102 | #else |
99 | #define sa1100_timer_suspend NULL | 103 | #define sa1100_timer_suspend NULL |
@@ -112,7 +116,7 @@ static struct clock_event_device ckevt_sa1100_osmr0 = { | |||
112 | 116 | ||
113 | static struct irqaction sa1100_timer_irq = { | 117 | static struct irqaction sa1100_timer_irq = { |
114 | .name = "ost0", | 118 | .name = "ost0", |
115 | .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, | 119 | .flags = IRQF_TIMER | IRQF_IRQPOLL, |
116 | .handler = sa1100_ost0_interrupt, | 120 | .handler = sa1100_ost0_interrupt, |
117 | .dev_id = &ckevt_sa1100_osmr0, | 121 | .dev_id = &ckevt_sa1100_osmr0, |
118 | }; | 122 | }; |
@@ -128,7 +132,7 @@ void __init sa1100_timer_init(void) | |||
128 | 132 | ||
129 | setup_irq(IRQ_OST0, &sa1100_timer_irq); | 133 | setup_irq(IRQ_OST0, &sa1100_timer_irq); |
130 | 134 | ||
131 | clocksource_mmio_init(OSCR, "oscr", CLOCK_TICK_RATE, 200, 32, | 135 | clocksource_mmio_init(OSCR, "oscr", SA1100_CLOCK_FREQ, 200, 32, |
132 | clocksource_mmio_readl_up); | 136 | clocksource_mmio_readl_up); |
133 | clockevents_config_and_register(&ckevt_sa1100_osmr0, 3686400, | 137 | clockevents_config_and_register(&ckevt_sa1100_osmr0, 3686400, |
134 | MIN_OSCR_DELTA * 2, 0x7fffffff); | 138 | MIN_OSCR_DELTA * 2, 0x7fffffff); |