Root/
Source at commit df1752a3ca1c25a4627735a04cf79da0fe44e6cd created 13 years 24 days ago. By Peter Zotov, Add RTC platform device support for JZ4750. | |
---|---|
1 | /* |
2 | * Copyright (C) 2011 Peter Zotov <whitequark@whitequark.org> |
3 | * JZ4750 platform devices |
4 | * |
5 | * This program is free software; you can redistribute it and/or modify it |
6 | * under the terms of the GNU General Public License as published by the |
7 | * Free Software Foundation; either version 2 of the License, or (at your |
8 | * option) any later version. |
9 | * |
10 | * You should have received a copy of the GNU General Public License along |
11 | * with this program; if not, write to the Free Software Foundation, Inc., |
12 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
13 | * |
14 | */ |
15 | |
16 | #include <linux/device.h> |
17 | #include <linux/init.h> |
18 | #include <linux/kernel.h> |
19 | #include <linux/platform_device.h> |
20 | #include <linux/resource.h> |
21 | |
22 | #include <linux/dma-mapping.h> |
23 | |
24 | #include <jz4750/platform.h> |
25 | #include <jz4750/irq.h> |
26 | |
27 | #include <asm/mach-jz47xx/base.h> |
28 | |
29 | #include <linux/serial_core.h> |
30 | #include <linux/serial_8250.h> |
31 | |
32 | #include "../serial.h" |
33 | #include "../clock.h" |
34 | |
35 | /* RTC controller */ |
36 | static struct resource jz4750_rtc_resources[] = { |
37 | { |
38 | .start = JZ47XX_RTC_BASE_ADDR, |
39 | .end = JZ47XX_RTC_BASE_ADDR + 0x38 - 1, |
40 | .flags = IORESOURCE_MEM, |
41 | }, |
42 | { |
43 | .start = JZ4750_IRQ_RTC, |
44 | .end = JZ4750_IRQ_RTC, |
45 | .flags = IORESOURCE_IRQ, |
46 | }, |
47 | }; |
48 | |
49 | struct platform_device jz4750_rtc_device = { |
50 | .name = "jz4740-rtc", |
51 | .id = -1, |
52 | .num_resources = ARRAY_SIZE(jz4750_rtc_resources), |
53 | .resource = jz4750_rtc_resources, |
54 | }; |
55 | |
56 | /* Serial */ |
57 | #define JZ4750_UART_DATA(_id) \ |
58 | { \ |
59 | .flags = UPF_SKIP_TEST | UPF_IOREMAP | UPF_FIXED_TYPE, \ |
60 | .iotype = UPIO_MEM, \ |
61 | .regshift = 2, \ |
62 | .serial_out = jz4740_serial_out, \ |
63 | .type = PORT_16550, \ |
64 | .mapbase = JZ47XX_UART ## _id ## _BASE_ADDR, \ |
65 | .irq = JZ4750_IRQ_UART ## _id, \ |
66 | } |
67 | |
68 | static struct plat_serial8250_port jz4750_uart_data[] = { |
69 | JZ4750_UART_DATA(0), |
70 | {}, |
71 | }; |
72 | |
73 | static struct platform_device jz4740_uart_device = { |
74 | .name = "serial8250", |
75 | .id = 0, |
76 | .dev = { |
77 | .platform_data = jz4750_uart_data, |
78 | }, |
79 | }; |
80 | |
81 | void jz4750_serial_device_register(void) |
82 | { |
83 | struct plat_serial8250_port *p; |
84 | |
85 | for (p = jz4750_uart_data; p->flags != 0; ++p) |
86 | p->uartclk = jz4740_clock_bdata.ext_rate; |
87 | |
88 | platform_device_register(&jz4740_uart_device); |
89 | } |
90 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9