diff options
Diffstat (limited to 'arch/mips/alchemy')
52 files changed, 3714 insertions, 2706 deletions
diff --git a/arch/mips/alchemy/Kconfig b/arch/mips/alchemy/Kconfig index 2a68be6a1b97..0faaab24376e 100644 --- a/arch/mips/alchemy/Kconfig +++ b/arch/mips/alchemy/Kconfig | |||
@@ -2,6 +2,10 @@ | |||
2 | config ALCHEMY_GPIOINT_AU1000 | 2 | config ALCHEMY_GPIOINT_AU1000 |
3 | bool | 3 | bool |
4 | 4 | ||
5 | # au1300-style GPIO/INT controller | ||
6 | config ALCHEMY_GPIOINT_AU1300 | ||
7 | bool | ||
8 | |||
5 | # select this in your board config if you don't want to use the gpio | 9 | # select this in your board config if you don't want to use the gpio |
6 | # namespace as documented in the manuals. In this case however you need | 10 | # namespace as documented in the manuals. In this case however you need |
7 | # to create the necessary gpio_* functions in your board code/headers! | 11 | # to create the necessary gpio_* functions in your board code/headers! |
@@ -22,43 +26,29 @@ config MIPS_MTX1 | |||
22 | select SYS_SUPPORTS_LITTLE_ENDIAN | 26 | select SYS_SUPPORTS_LITTLE_ENDIAN |
23 | select SYS_HAS_EARLY_PRINTK | 27 | select SYS_HAS_EARLY_PRINTK |
24 | 28 | ||
25 | config MIPS_BOSPORUS | ||
26 | bool "Alchemy Bosporus board" | ||
27 | select ALCHEMY_GPIOINT_AU1000 | ||
28 | select DMA_NONCOHERENT | ||
29 | select SYS_SUPPORTS_LITTLE_ENDIAN | ||
30 | select SYS_HAS_EARLY_PRINTK | ||
31 | |||
32 | config MIPS_DB1000 | 29 | config MIPS_DB1000 |
33 | bool "Alchemy DB1000 board" | 30 | bool "Alchemy DB1000/DB1500/DB1100 boards" |
34 | select ALCHEMY_GPIOINT_AU1000 | 31 | select ALCHEMY_GPIOINT_AU1000 |
35 | select DMA_NONCOHERENT | 32 | select DMA_NONCOHERENT |
36 | select HW_HAS_PCI | 33 | select HW_HAS_PCI |
37 | select SYS_SUPPORTS_LITTLE_ENDIAN | 34 | select MIPS_DISABLE_OBSOLETE_IDE |
38 | select SYS_HAS_EARLY_PRINTK | 35 | select SYS_SUPPORTS_BIG_ENDIAN |
39 | |||
40 | config MIPS_DB1100 | ||
41 | bool "Alchemy DB1100 board" | ||
42 | select ALCHEMY_GPIOINT_AU1000 | ||
43 | select DMA_NONCOHERENT | ||
44 | select SYS_SUPPORTS_LITTLE_ENDIAN | 36 | select SYS_SUPPORTS_LITTLE_ENDIAN |
45 | select SYS_HAS_EARLY_PRINTK | 37 | select SYS_HAS_EARLY_PRINTK |
46 | 38 | ||
47 | config MIPS_DB1200 | 39 | config MIPS_DB1200 |
48 | bool "Alchemy DB1200 board" | 40 | bool "Alchemy DB1200/PB1200 board" |
49 | select ALCHEMY_GPIOINT_AU1000 | 41 | select ALCHEMY_GPIOINT_AU1000 |
50 | select DMA_COHERENT | 42 | select DMA_COHERENT |
51 | select MIPS_DISABLE_OBSOLETE_IDE | 43 | select MIPS_DISABLE_OBSOLETE_IDE |
52 | select SYS_SUPPORTS_LITTLE_ENDIAN | 44 | select SYS_SUPPORTS_LITTLE_ENDIAN |
53 | select SYS_HAS_EARLY_PRINTK | 45 | select SYS_HAS_EARLY_PRINTK |
54 | 46 | ||
55 | config MIPS_DB1500 | 47 | config MIPS_DB1300 |
56 | bool "Alchemy DB1500 board" | 48 | bool "NetLogic DB1300 board" |
57 | select ALCHEMY_GPIOINT_AU1000 | 49 | select ALCHEMY_GPIOINT_AU1300 |
58 | select DMA_NONCOHERENT | 50 | select DMA_COHERENT |
59 | select HW_HAS_PCI | ||
60 | select MIPS_DISABLE_OBSOLETE_IDE | 51 | select MIPS_DISABLE_OBSOLETE_IDE |
61 | select SYS_SUPPORTS_BIG_ENDIAN | ||
62 | select SYS_SUPPORTS_LITTLE_ENDIAN | 52 | select SYS_SUPPORTS_LITTLE_ENDIAN |
63 | select SYS_HAS_EARLY_PRINTK | 53 | select SYS_HAS_EARLY_PRINTK |
64 | 54 | ||
@@ -66,27 +56,11 @@ config MIPS_DB1550 | |||
66 | bool "Alchemy DB1550 board" | 56 | bool "Alchemy DB1550 board" |
67 | select ALCHEMY_GPIOINT_AU1000 | 57 | select ALCHEMY_GPIOINT_AU1000 |
68 | select HW_HAS_PCI | 58 | select HW_HAS_PCI |
69 | select DMA_NONCOHERENT | 59 | select DMA_COHERENT |
70 | select MIPS_DISABLE_OBSOLETE_IDE | 60 | select MIPS_DISABLE_OBSOLETE_IDE |
71 | select SYS_SUPPORTS_LITTLE_ENDIAN | 61 | select SYS_SUPPORTS_LITTLE_ENDIAN |
72 | select SYS_HAS_EARLY_PRINTK | 62 | select SYS_HAS_EARLY_PRINTK |
73 | 63 | ||
74 | config MIPS_MIRAGE | ||
75 | bool "Alchemy Mirage board" | ||
76 | select DMA_NONCOHERENT | ||
77 | select ALCHEMY_GPIOINT_AU1000 | ||
78 | select SYS_SUPPORTS_LITTLE_ENDIAN | ||
79 | select SYS_HAS_EARLY_PRINTK | ||
80 | |||
81 | config MIPS_PB1000 | ||
82 | bool "Alchemy PB1000 board" | ||
83 | select ALCHEMY_GPIOINT_AU1000 | ||
84 | select DMA_NONCOHERENT | ||
85 | select HW_HAS_PCI | ||
86 | select SWAP_IO_SPACE | ||
87 | select SYS_SUPPORTS_LITTLE_ENDIAN | ||
88 | select SYS_HAS_EARLY_PRINTK | ||
89 | |||
90 | config MIPS_PB1100 | 64 | config MIPS_PB1100 |
91 | bool "Alchemy PB1100 board" | 65 | bool "Alchemy PB1100 board" |
92 | select ALCHEMY_GPIOINT_AU1000 | 66 | select ALCHEMY_GPIOINT_AU1000 |
@@ -96,14 +70,6 @@ config MIPS_PB1100 | |||
96 | select SYS_SUPPORTS_LITTLE_ENDIAN | 70 | select SYS_SUPPORTS_LITTLE_ENDIAN |
97 | select SYS_HAS_EARLY_PRINTK | 71 | select SYS_HAS_EARLY_PRINTK |
98 | 72 | ||
99 | config MIPS_PB1200 | ||
100 | bool "Alchemy PB1200 board" | ||
101 | select ALCHEMY_GPIOINT_AU1000 | ||
102 | select DMA_NONCOHERENT | ||
103 | select MIPS_DISABLE_OBSOLETE_IDE | ||
104 | select SYS_SUPPORTS_LITTLE_ENDIAN | ||
105 | select SYS_HAS_EARLY_PRINTK | ||
106 | |||
107 | config MIPS_PB1500 | 73 | config MIPS_PB1500 |
108 | bool "Alchemy PB1500 board" | 74 | bool "Alchemy PB1500 board" |
109 | select ALCHEMY_GPIOINT_AU1000 | 75 | select ALCHEMY_GPIOINT_AU1000 |
diff --git a/arch/mips/alchemy/Makefile b/arch/mips/alchemy/Makefile new file mode 100644 index 000000000000..aac3b179bbc0 --- /dev/null +++ b/arch/mips/alchemy/Makefile | |||
@@ -0,0 +1,3 @@ | |||
1 | obj-$(CONFIG_MIPS_GPR) += board-gpr.o | ||
2 | obj-$(CONFIG_MIPS_MTX1) += board-mtx1.o | ||
3 | obj-$(CONFIG_MIPS_XXS1500) += board-xxs1500.o | ||
diff --git a/arch/mips/alchemy/Platform b/arch/mips/alchemy/Platform index 96e9e41f1b2a..7956274de15f 100644 --- a/arch/mips/alchemy/Platform +++ b/arch/mips/alchemy/Platform | |||
@@ -5,62 +5,31 @@ platform-$(CONFIG_MIPS_ALCHEMY) += alchemy/common/ | |||
5 | 5 | ||
6 | 6 | ||
7 | # | 7 | # |
8 | # AMD Alchemy Pb1000 eval board | ||
9 | # | ||
10 | platform-$(CONFIG_MIPS_PB1000) += alchemy/devboards/ | ||
11 | cflags-$(CONFIG_MIPS_PB1000) += -I$(srctree)/arch/mips/include/asm/mach-pb1x00 | ||
12 | load-$(CONFIG_MIPS_PB1000) += 0xffffffff80100000 | ||
13 | |||
14 | # | ||
15 | # AMD Alchemy Pb1100 eval board | 8 | # AMD Alchemy Pb1100 eval board |
16 | # | 9 | # |
17 | platform-$(CONFIG_MIPS_PB1100) += alchemy/devboards/ | 10 | platform-$(CONFIG_MIPS_PB1100) += alchemy/devboards/ |
18 | cflags-$(CONFIG_MIPS_PB1100) += -I$(srctree)/arch/mips/include/asm/mach-pb1x00 | ||
19 | load-$(CONFIG_MIPS_PB1100) += 0xffffffff80100000 | 11 | load-$(CONFIG_MIPS_PB1100) += 0xffffffff80100000 |
20 | 12 | ||
21 | # | 13 | # |
22 | # AMD Alchemy Pb1500 eval board | 14 | # AMD Alchemy Pb1500 eval board |
23 | # | 15 | # |
24 | platform-$(CONFIG_MIPS_PB1500) += alchemy/devboards/ | 16 | platform-$(CONFIG_MIPS_PB1500) += alchemy/devboards/ |
25 | cflags-$(CONFIG_MIPS_PB1500) += -I$(srctree)/arch/mips/include/asm/mach-pb1x00 | ||
26 | load-$(CONFIG_MIPS_PB1500) += 0xffffffff80100000 | 17 | load-$(CONFIG_MIPS_PB1500) += 0xffffffff80100000 |
27 | 18 | ||
28 | # | 19 | # |
29 | # AMD Alchemy Pb1550 eval board | 20 | # AMD Alchemy Pb1550 eval board |
30 | # | 21 | # |
31 | platform-$(CONFIG_MIPS_PB1550) += alchemy/devboards/ | 22 | platform-$(CONFIG_MIPS_PB1550) += alchemy/devboards/ |
32 | cflags-$(CONFIG_MIPS_PB1550) += -I$(srctree)/arch/mips/include/asm/mach-pb1x00 | ||
33 | load-$(CONFIG_MIPS_PB1550) += 0xffffffff80100000 | 23 | load-$(CONFIG_MIPS_PB1550) += 0xffffffff80100000 |
34 | 24 | ||
35 | # | 25 | # |
36 | # AMD Alchemy Pb1200 eval board | 26 | # AMD Alchemy Db1000/Db1500/Db1100 eval boards |
37 | # | ||
38 | platform-$(CONFIG_MIPS_PB1200) += alchemy/devboards/ | ||
39 | cflags-$(CONFIG_MIPS_PB1200) += -I$(srctree)/arch/mips/include/asm/mach-pb1x00 | ||
40 | load-$(CONFIG_MIPS_PB1200) += 0xffffffff80100000 | ||
41 | |||
42 | # | ||
43 | # AMD Alchemy Db1000 eval board | ||
44 | # | 27 | # |
45 | platform-$(CONFIG_MIPS_DB1000) += alchemy/devboards/ | 28 | platform-$(CONFIG_MIPS_DB1000) += alchemy/devboards/ |
46 | cflags-$(CONFIG_MIPS_DB1000) += -I$(srctree)/arch/mips/include/asm/mach-db1x00 | 29 | cflags-$(CONFIG_MIPS_DB1000) += -I$(srctree)/arch/mips/include/asm/mach-db1x00 |
47 | load-$(CONFIG_MIPS_DB1000) += 0xffffffff80100000 | 30 | load-$(CONFIG_MIPS_DB1000) += 0xffffffff80100000 |
48 | 31 | ||
49 | # | 32 | # |
50 | # AMD Alchemy Db1100 eval board | ||
51 | # | ||
52 | platform-$(CONFIG_MIPS_DB1100) += alchemy/devboards/ | ||
53 | cflags-$(CONFIG_MIPS_DB1100) += -I$(srctree)/arch/mips/include/asm/mach-db1x00 | ||
54 | load-$(CONFIG_MIPS_DB1100) += 0xffffffff80100000 | ||
55 | |||
56 | # | ||
57 | # AMD Alchemy Db1500 eval board | ||
58 | # | ||
59 | platform-$(CONFIG_MIPS_DB1500) += alchemy/devboards/ | ||
60 | cflags-$(CONFIG_MIPS_DB1500) += -I$(srctree)/arch/mips/include/asm/mach-db1x00 | ||
61 | load-$(CONFIG_MIPS_DB1500) += 0xffffffff80100000 | ||
62 | |||
63 | # | ||
64 | # AMD Alchemy Db1550 eval board | 33 | # AMD Alchemy Db1550 eval board |
65 | # | 34 | # |
66 | platform-$(CONFIG_MIPS_DB1550) += alchemy/devboards/ | 35 | platform-$(CONFIG_MIPS_DB1550) += alchemy/devboards/ |
@@ -68,42 +37,35 @@ cflags-$(CONFIG_MIPS_DB1550) += -I$(srctree)/arch/mips/include/asm/mach-db1x00 | |||
68 | load-$(CONFIG_MIPS_DB1550) += 0xffffffff80100000 | 37 | load-$(CONFIG_MIPS_DB1550) += 0xffffffff80100000 |
69 | 38 | ||
70 | # | 39 | # |
71 | # AMD Alchemy Db1200 eval board | 40 | # AMD Alchemy Db1200/Pb1200 eval boards |
72 | # | 41 | # |
73 | platform-$(CONFIG_MIPS_DB1200) += alchemy/devboards/ | 42 | platform-$(CONFIG_MIPS_DB1200) += alchemy/devboards/ |
74 | cflags-$(CONFIG_MIPS_DB1200) += -I$(srctree)/arch/mips/include/asm/mach-db1x00 | 43 | cflags-$(CONFIG_MIPS_DB1200) += -I$(srctree)/arch/mips/include/asm/mach-db1x00 |
75 | load-$(CONFIG_MIPS_DB1200) += 0xffffffff80100000 | 44 | load-$(CONFIG_MIPS_DB1200) += 0xffffffff80100000 |
76 | 45 | ||
77 | # | 46 | # |
78 | # AMD Alchemy Bosporus eval board | 47 | # NetLogic DBAu1300 development platform |
79 | # | ||
80 | platform-$(CONFIG_MIPS_BOSPORUS) += alchemy/devboards/ | ||
81 | cflags-$(CONFIG_MIPS_BOSPORUS) += -I$(srctree)/arch/mips/include/asm/mach-db1x00 | ||
82 | load-$(CONFIG_MIPS_BOSPORUS) += 0xffffffff80100000 | ||
83 | |||
84 | # | ||
85 | # AMD Alchemy Mirage eval board | ||
86 | # | 48 | # |
87 | platform-$(CONFIG_MIPS_MIRAGE) += alchemy/devboards/ | 49 | platform-$(CONFIG_MIPS_DB1300) += alchemy/devboards/ |
88 | cflags-$(CONFIG_MIPS_MIRAGE) += -I$(srctree)/arch/mips/include/asm/mach-db1x00 | 50 | cflags-$(CONFIG_MIPS_DB1300) += -I$(srctree)/arch/mips/include/asm/mach-db1x00 |
89 | load-$(CONFIG_MIPS_MIRAGE) += 0xffffffff80100000 | 51 | load-$(CONFIG_MIPS_DB1300) += 0xffffffff80100000 |
90 | 52 | ||
91 | # | 53 | # |
92 | # 4G-Systems eval board | 54 | # 4G-Systems MTX-1 "MeshCube" wireless router |
93 | # | 55 | # |
94 | platform-$(CONFIG_MIPS_MTX1) += alchemy/mtx-1/ | 56 | platform-$(CONFIG_MIPS_MTX1) += alchemy/ |
95 | load-$(CONFIG_MIPS_MTX1) += 0xffffffff80100000 | 57 | load-$(CONFIG_MIPS_MTX1) += 0xffffffff80100000 |
96 | 58 | ||
97 | # | 59 | # |
98 | # MyCable eval board | 60 | # MyCable eval board |
99 | # | 61 | # |
100 | platform-$(CONFIG_MIPS_XXS1500) += alchemy/xxs1500/ | 62 | platform-$(CONFIG_MIPS_XXS1500) += alchemy/ |
101 | load-$(CONFIG_MIPS_XXS1500) += 0xffffffff80100000 | 63 | load-$(CONFIG_MIPS_XXS1500) += 0xffffffff80100000 |
102 | 64 | ||
103 | # | 65 | # |
104 | # Trapeze ITS GRP board | 66 | # Trapeze ITS GRP board |
105 | # | 67 | # |
106 | platform-$(CONFIG_MIPS_GPR) += alchemy/gpr/ | 68 | platform-$(CONFIG_MIPS_GPR) += alchemy/ |
107 | load-$(CONFIG_MIPS_GPR) += 0xffffffff80100000 | 69 | load-$(CONFIG_MIPS_GPR) += 0xffffffff80100000 |
108 | 70 | ||
109 | # boards can specify their own <gpio.h> in one of their include dirs. | 71 | # boards can specify their own <gpio.h> in one of their include dirs. |
diff --git a/arch/mips/alchemy/gpr/platform.c b/arch/mips/alchemy/board-gpr.c index 982ce85db60d..ba3259086b9d 100644 --- a/arch/mips/alchemy/gpr/platform.c +++ b/arch/mips/alchemy/board-gpr.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * GPR board platform device registration | 2 | * GPR board platform device registration (Au1550) |
3 | * | 3 | * |
4 | * Copyright (C) 2010 Wolfgang Grandegger <wg@denx.de> | 4 | * Copyright (C) 2010 Wolfgang Grandegger <wg@denx.de> |
5 | * | 5 | * |
@@ -18,16 +18,89 @@ | |||
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/delay.h> | ||
21 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/interrupt.h> | ||
24 | #include <linux/kernel.h> | ||
22 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
26 | #include <linux/pm.h> | ||
23 | #include <linux/mtd/partitions.h> | 27 | #include <linux/mtd/partitions.h> |
24 | #include <linux/mtd/physmap.h> | 28 | #include <linux/mtd/physmap.h> |
25 | #include <linux/leds.h> | 29 | #include <linux/leds.h> |
26 | #include <linux/gpio.h> | 30 | #include <linux/gpio.h> |
27 | #include <linux/i2c.h> | 31 | #include <linux/i2c.h> |
28 | #include <linux/i2c-gpio.h> | 32 | #include <linux/i2c-gpio.h> |
29 | 33 | #include <asm/bootinfo.h> | |
34 | #include <asm/reboot.h> | ||
30 | #include <asm/mach-au1x00/au1000.h> | 35 | #include <asm/mach-au1x00/au1000.h> |
36 | #include <prom.h> | ||
37 | |||
38 | const char *get_system_type(void) | ||
39 | { | ||
40 | return "GPR"; | ||
41 | } | ||
42 | |||
43 | void __init prom_init(void) | ||
44 | { | ||
45 | unsigned char *memsize_str; | ||
46 | unsigned long memsize; | ||
47 | |||
48 | prom_argc = fw_arg0; | ||
49 | prom_argv = (char **)fw_arg1; | ||
50 | prom_envp = (char **)fw_arg2; | ||
51 | |||
52 | prom_init_cmdline(); | ||
53 | |||
54 | memsize_str = prom_getenv("memsize"); | ||
55 | if (!memsize_str) | ||
56 | memsize = 0x04000000; | ||
57 | else | ||
58 | strict_strtoul(memsize_str, 0, &memsize); | ||
59 | add_memory_region(0, memsize, BOOT_MEM_RAM); | ||
60 | } | ||
61 | |||
62 | void prom_putchar(unsigned char c) | ||
63 | { | ||
64 | alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c); | ||
65 | } | ||
66 | |||
67 | static void gpr_reset(char *c) | ||
68 | { | ||
69 | /* switch System-LED to orange (red# and green# on) */ | ||
70 | alchemy_gpio_direction_output(4, 0); | ||
71 | alchemy_gpio_direction_output(5, 0); | ||
72 | |||
73 | /* trigger watchdog to reset board in 200ms */ | ||
74 | printk(KERN_EMERG "Triggering watchdog soft reset...\n"); | ||
75 | raw_local_irq_disable(); | ||
76 | alchemy_gpio_direction_output(1, 0); | ||
77 | udelay(1); | ||
78 | alchemy_gpio_set_value(1, 1); | ||
79 | while (1) | ||
80 | cpu_wait(); | ||
81 | } | ||
82 | |||
83 | static void gpr_power_off(void) | ||
84 | { | ||
85 | while (1) | ||
86 | cpu_wait(); | ||
87 | } | ||
88 | |||
89 | void __init board_setup(void) | ||
90 | { | ||
91 | printk(KERN_INFO "Trapeze ITS GPR board\n"); | ||
92 | |||
93 | pm_power_off = gpr_power_off; | ||
94 | _machine_halt = gpr_power_off; | ||
95 | _machine_restart = gpr_reset; | ||
96 | |||
97 | /* Enable UART1/3 */ | ||
98 | alchemy_uart_enable(AU1000_UART3_PHYS_ADDR); | ||
99 | alchemy_uart_enable(AU1000_UART1_PHYS_ADDR); | ||
100 | |||
101 | /* Take away Reset of UMTS-card */ | ||
102 | alchemy_gpio_direction_output(215, 1); | ||
103 | } | ||
31 | 104 | ||
32 | /* | 105 | /* |
33 | * Watchdog | 106 | * Watchdog |
@@ -152,7 +225,7 @@ static struct i2c_gpio_platform_data gpr_i2c_data = { | |||
152 | .scl_is_open_drain = 1, | 225 | .scl_is_open_drain = 1, |
153 | .udelay = 2, /* ~100 kHz */ | 226 | .udelay = 2, /* ~100 kHz */ |
154 | .timeout = HZ, | 227 | .timeout = HZ, |
155 | }; | 228 | }; |
156 | 229 | ||
157 | static struct platform_device gpr_i2c_device = { | 230 | static struct platform_device gpr_i2c_device = { |
158 | .name = "i2c-gpio", | 231 | .name = "i2c-gpio", |
@@ -184,7 +257,7 @@ static int gpr_map_pci_irq(const struct pci_dev *d, u8 slot, u8 pin) | |||
184 | else if ((slot == 0) && (pin == 2)) | 257 | else if ((slot == 0) && (pin == 2)) |
185 | return AU1550_PCI_INTB; | 258 | return AU1550_PCI_INTB; |
186 | 259 | ||
187 | return -1; | 260 | return 0xff; |
188 | } | 261 | } |
189 | 262 | ||
190 | static struct alchemy_pci_platdata gpr_pci_pd = { | 263 | static struct alchemy_pci_platdata gpr_pci_pd = { |
diff --git a/arch/mips/alchemy/mtx-1/platform.c b/arch/mips/alchemy/board-mtx1.c index cc47b6868ca3..295f1a95f745 100644 --- a/arch/mips/alchemy/mtx-1/platform.c +++ b/arch/mips/alchemy/board-mtx1.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * MTX-1 platform devices registration | 2 | * MTX-1 platform devices registration (Au1500) |
3 | * | 3 | * |
4 | * Copyright (C) 2007-2009, Florian Fainelli <florian@openwrt.org> | 4 | * Copyright (C) 2007-2009, Florian Fainelli <florian@openwrt.org> |
5 | * | 5 | * |
@@ -19,6 +19,8 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/interrupt.h> | ||
23 | #include <linux/kernel.h> | ||
22 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
23 | #include <linux/leds.h> | 25 | #include <linux/leds.h> |
24 | #include <linux/gpio.h> | 26 | #include <linux/gpio.h> |
@@ -27,8 +29,85 @@ | |||
27 | #include <linux/mtd/partitions.h> | 29 | #include <linux/mtd/partitions.h> |
28 | #include <linux/mtd/physmap.h> | 30 | #include <linux/mtd/physmap.h> |
29 | #include <mtd/mtd-abi.h> | 31 | #include <mtd/mtd-abi.h> |
30 | 32 | #include <asm/bootinfo.h> | |
33 | #include <asm/reboot.h> | ||
34 | #include <asm/mach-au1x00/au1000.h> | ||
31 | #include <asm/mach-au1x00/au1xxx_eth.h> | 35 | #include <asm/mach-au1x00/au1xxx_eth.h> |
36 | #include <prom.h> | ||
37 | |||
38 | const char *get_system_type(void) | ||
39 | { | ||
40 | return "MTX-1"; | ||
41 | } | ||
42 | |||
43 | void __init prom_init(void) | ||
44 | { | ||
45 | unsigned char *memsize_str; | ||
46 | unsigned long memsize; | ||
47 | |||
48 | prom_argc = fw_arg0; | ||
49 | prom_argv = (char **)fw_arg1; | ||
50 | prom_envp = (char **)fw_arg2; | ||
51 | |||
52 | prom_init_cmdline(); | ||
53 | |||
54 | memsize_str = prom_getenv("memsize"); | ||
55 | if (!memsize_str) | ||
56 | memsize = 0x04000000; | ||
57 | else | ||
58 | strict_strtoul(memsize_str, 0, &memsize); | ||
59 | add_memory_region(0, memsize, BOOT_MEM_RAM); | ||
60 | } | ||
61 | |||
62 | void prom_putchar(unsigned char c) | ||
63 | { | ||
64 | alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c); | ||
65 | } | ||
66 | |||
67 | static void mtx1_reset(char *c) | ||
68 | { | ||
69 | /* Jump to the reset vector */ | ||
70 | __asm__ __volatile__("jr\t%0" : : "r"(0xbfc00000)); | ||
71 | } | ||
72 | |||
73 | static void mtx1_power_off(void) | ||
74 | { | ||
75 | while (1) | ||
76 | asm volatile ( | ||
77 | " .set mips32 \n" | ||
78 | " wait \n" | ||
79 | " .set mips0 \n"); | ||
80 | } | ||
81 | |||
82 | void __init board_setup(void) | ||
83 | { | ||
84 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | ||
85 | /* Enable USB power switch */ | ||
86 | alchemy_gpio_direction_output(204, 0); | ||
87 | #endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */ | ||
88 | |||
89 | /* Initialize sys_pinfunc */ | ||
90 | au_writel(SYS_PF_NI2, SYS_PINFUNC); | ||
91 | |||
92 | /* Initialize GPIO */ | ||
93 | au_writel(~0, KSEG1ADDR(AU1000_SYS_PHYS_ADDR) + SYS_TRIOUTCLR); | ||
94 | alchemy_gpio_direction_output(0, 0); /* Disable M66EN (PCI 66MHz) */ | ||
95 | alchemy_gpio_direction_output(3, 1); /* Disable PCI CLKRUN# */ | ||
96 | alchemy_gpio_direction_output(1, 1); /* Enable EXT_IO3 */ | ||
97 | alchemy_gpio_direction_output(5, 0); /* Disable eth PHY TX_ER */ | ||
98 | |||
99 | /* Enable LED and set it to green */ | ||
100 | alchemy_gpio_direction_output(211, 1); /* green on */ | ||
101 | alchemy_gpio_direction_output(212, 0); /* red off */ | ||
102 | |||
103 | pm_power_off = mtx1_power_off; | ||
104 | _machine_halt = mtx1_power_off; | ||
105 | _machine_restart = mtx1_reset; | ||
106 | |||
107 | printk(KERN_INFO "4G Systems MTX-1 Board\n"); | ||
108 | } | ||
109 | |||
110 | /******************************************************************************/ | ||
32 | 111 | ||
33 | static struct gpio_keys_button mtx1_gpio_button[] = { | 112 | static struct gpio_keys_button mtx1_gpio_button[] = { |
34 | { | 113 | { |
@@ -195,7 +274,6 @@ static struct platform_device mtx1_pci_host = { | |||
195 | .resource = alchemy_pci_host_res, | 274 | .resource = alchemy_pci_host_res, |
196 | }; | 275 | }; |
197 | 276 | ||
198 | |||
199 | static struct __initdata platform_device * mtx1_devs[] = { | 277 | static struct __initdata platform_device * mtx1_devs[] = { |
200 | &mtx1_pci_host, | 278 | &mtx1_pci_host, |
201 | &mtx1_gpio_leds, | 279 | &mtx1_gpio_leds, |
@@ -206,13 +284,19 @@ static struct __initdata platform_device * mtx1_devs[] = { | |||
206 | 284 | ||
207 | static struct au1000_eth_platform_data mtx1_au1000_eth0_pdata = { | 285 | static struct au1000_eth_platform_data mtx1_au1000_eth0_pdata = { |
208 | .phy_search_highest_addr = 1, | 286 | .phy_search_highest_addr = 1, |
209 | .phy1_search_mac0 = 1, | 287 | .phy1_search_mac0 = 1, |
210 | }; | 288 | }; |
211 | 289 | ||
212 | static int __init mtx1_register_devices(void) | 290 | static int __init mtx1_register_devices(void) |
213 | { | 291 | { |
214 | int rc; | 292 | int rc; |
215 | 293 | ||
294 | irq_set_irq_type(AU1500_GPIO204_INT, IRQ_TYPE_LEVEL_HIGH); | ||
295 | irq_set_irq_type(AU1500_GPIO201_INT, IRQ_TYPE_LEVEL_LOW); | ||
296 | irq_set_irq_type(AU1500_GPIO202_INT, IRQ_TYPE_LEVEL_LOW); | ||
297 | irq_set_irq_type(AU1500_GPIO203_INT, IRQ_TYPE_LEVEL_LOW); | ||
298 | irq_set_irq_type(AU1500_GPIO205_INT, IRQ_TYPE_LEVEL_LOW); | ||
299 | |||
216 | au1xxx_override_eth_cfg(0, &mtx1_au1000_eth0_pdata); | 300 | au1xxx_override_eth_cfg(0, &mtx1_au1000_eth0_pdata); |
217 | 301 | ||
218 | rc = gpio_request(mtx1_gpio_button[0].gpio, | 302 | rc = gpio_request(mtx1_gpio_button[0].gpio, |
@@ -226,5 +310,4 @@ static int __init mtx1_register_devices(void) | |||
226 | out: | 310 | out: |
227 | return platform_add_devices(mtx1_devs, ARRAY_SIZE(mtx1_devs)); | 311 | return platform_add_devices(mtx1_devs, ARRAY_SIZE(mtx1_devs)); |
228 | } | 312 | } |
229 | |||
230 | arch_initcall(mtx1_register_devices); | 313 | arch_initcall(mtx1_register_devices); |
diff --git a/arch/mips/alchemy/board-xxs1500.c b/arch/mips/alchemy/board-xxs1500.c new file mode 100644 index 000000000000..bd5513650293 --- /dev/null +++ b/arch/mips/alchemy/board-xxs1500.c | |||
@@ -0,0 +1,154 @@ | |||
1 | /* | ||
2 | * BRIEF MODULE DESCRIPTION | ||
3 | * MyCable XXS1500 board support | ||
4 | * | ||
5 | * Copyright 2003, 2008 MontaVista Software Inc. | ||
6 | * Author: MontaVista Software, Inc. <source@mvista.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
21 | */ | ||
22 | |||
23 | #include <linux/kernel.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <linux/interrupt.h> | ||
26 | #include <linux/platform_device.h> | ||
27 | #include <linux/gpio.h> | ||
28 | #include <linux/delay.h> | ||
29 | #include <linux/pm.h> | ||
30 | #include <asm/bootinfo.h> | ||
31 | #include <asm/reboot.h> | ||
32 | #include <asm/mach-au1x00/au1000.h> | ||
33 | #include <prom.h> | ||
34 | |||
35 | const char *get_system_type(void) | ||
36 | { | ||
37 | return "XXS1500"; | ||
38 | } | ||
39 | |||
40 | void __init prom_init(void) | ||
41 | { | ||
42 | unsigned char *memsize_str; | ||
43 | unsigned long memsize; | ||
44 | |||
45 | prom_argc = fw_arg0; | ||
46 | prom_argv = (char **)fw_arg1; | ||
47 | prom_envp = (char **)fw_arg2; | ||
48 | |||
49 | prom_init_cmdline(); | ||
50 | |||
51 | memsize_str = prom_getenv("memsize"); | ||
52 | if (!memsize_str || strict_strtoul(memsize_str, 0, &memsize)) | ||
53 | memsize = 0x04000000; | ||
54 | |||
55 | add_memory_region(0, memsize, BOOT_MEM_RAM); | ||
56 | } | ||
57 | |||
58 | void prom_putchar(unsigned char c) | ||
59 | { | ||
60 | alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c); | ||
61 | } | ||
62 | |||
63 | static void xxs1500_reset(char *c) | ||
64 | { | ||
65 | /* Jump to the reset vector */ | ||
66 | __asm__ __volatile__("jr\t%0" : : "r"(0xbfc00000)); | ||
67 | } | ||
68 | |||
69 | static void xxs1500_power_off(void) | ||
70 | { | ||
71 | while (1) | ||
72 | asm volatile ( | ||
73 | " .set mips32 \n" | ||
74 | " wait \n" | ||
75 | " .set mips0 \n"); | ||
76 | } | ||
77 | |||
78 | void __init board_setup(void) | ||
79 | { | ||
80 | u32 pin_func; | ||
81 | |||
82 | pm_power_off = xxs1500_power_off; | ||
83 | _machine_halt = xxs1500_power_off; | ||
84 | _machine_restart = xxs1500_reset; | ||
85 | |||
86 | alchemy_gpio1_input_enable(); | ||
87 | alchemy_gpio2_enable(); | ||
88 | |||
89 | /* Set multiple use pins (UART3/GPIO) to UART (it's used as UART too) */ | ||
90 | pin_func = au_readl(SYS_PINFUNC) & ~SYS_PF_UR3; | ||
91 | pin_func |= SYS_PF_UR3; | ||
92 | au_writel(pin_func, SYS_PINFUNC); | ||
93 | |||
94 | /* Enable UART */ | ||
95 | alchemy_uart_enable(AU1000_UART3_PHYS_ADDR); | ||
96 | /* Enable DTR (MCR bit 0) = USB power up */ | ||
97 | __raw_writel(1, (void __iomem *)KSEG1ADDR(AU1000_UART3_PHYS_ADDR + 0x18)); | ||
98 | wmb(); | ||
99 | } | ||
100 | |||
101 | /******************************************************************************/ | ||
102 | |||
103 | static struct resource xxs1500_pcmcia_res[] = { | ||
104 | { | ||
105 | .name = "pcmcia-io", | ||
106 | .flags = IORESOURCE_MEM, | ||
107 | .start = AU1000_PCMCIA_IO_PHYS_ADDR, | ||
108 | .end = AU1000_PCMCIA_IO_PHYS_ADDR + 0x000400000 - 1, | ||
109 | }, | ||
110 | { | ||
111 | .name = "pcmcia-attr", | ||
112 | .flags = IORESOURCE_MEM, | ||
113 | .start = AU1000_PCMCIA_ATTR_PHYS_ADDR, | ||
114 | .end = AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1, | ||
115 | }, | ||
116 | { | ||
117 | .name = "pcmcia-mem", | ||
118 | .flags = IORESOURCE_MEM, | ||
119 | .start = AU1000_PCMCIA_MEM_PHYS_ADDR, | ||
120 | .end = AU1000_PCMCIA_MEM_PHYS_ADDR + 0x000400000 - 1, | ||
121 | }, | ||
122 | }; | ||
123 | |||
124 | static struct platform_device xxs1500_pcmcia_dev = { | ||
125 | .name = "xxs1500_pcmcia", | ||
126 | .id = -1, | ||
127 | .num_resources = ARRAY_SIZE(xxs1500_pcmcia_res), | ||
128 | .resource = xxs1500_pcmcia_res, | ||
129 | }; | ||
130 | |||
131 | static struct platform_device *xxs1500_devs[] __initdata = { | ||
132 | &xxs1500_pcmcia_dev, | ||
133 | }; | ||
134 | |||
135 | static int __init xxs1500_dev_init(void) | ||
136 | { | ||
137 | irq_set_irq_type(AU1500_GPIO204_INT, IRQ_TYPE_LEVEL_HIGH); | ||
138 | irq_set_irq_type(AU1500_GPIO201_INT, IRQ_TYPE_LEVEL_LOW); | ||
139 | irq_set_irq_type(AU1500_GPIO202_INT, IRQ_TYPE_LEVEL_LOW); | ||
140 | irq_set_irq_type(AU1500_GPIO203_INT, IRQ_TYPE_LEVEL_LOW); | ||
141 | irq_set_irq_type(AU1500_GPIO205_INT, IRQ_TYPE_LEVEL_LOW); | ||
142 | irq_set_irq_type(AU1500_GPIO207_INT, IRQ_TYPE_LEVEL_LOW); | ||
143 | |||
144 | irq_set_irq_type(AU1500_GPIO0_INT, IRQ_TYPE_LEVEL_LOW); | ||
145 | irq_set_irq_type(AU1500_GPIO1_INT, IRQ_TYPE_LEVEL_LOW); | ||
146 | irq_set_irq_type(AU1500_GPIO2_INT, IRQ_TYPE_LEVEL_LOW); | ||
147 | irq_set_irq_type(AU1500_GPIO3_INT, IRQ_TYPE_LEVEL_LOW); | ||
148 | irq_set_irq_type(AU1500_GPIO4_INT, IRQ_TYPE_LEVEL_LOW); /* CF irq */ | ||
149 | irq_set_irq_type(AU1500_GPIO5_INT, IRQ_TYPE_LEVEL_LOW); | ||
150 | |||
151 | return platform_add_devices(xxs1500_devs, | ||
152 | ARRAY_SIZE(xxs1500_devs)); | ||
153 | } | ||
154 | device_initcall(xxs1500_dev_init); | ||
diff --git a/arch/mips/alchemy/common/Makefile b/arch/mips/alchemy/common/Makefile index 811ece7b22e3..407ebc00e661 100644 --- a/arch/mips/alchemy/common/Makefile +++ b/arch/mips/alchemy/common/Makefile | |||
@@ -6,9 +6,7 @@ | |||
6 | # | 6 | # |
7 | 7 | ||
8 | obj-y += prom.o time.o clocks.o platform.o power.o setup.o \ | 8 | obj-y += prom.o time.o clocks.o platform.o power.o setup.o \ |
9 | sleeper.o dma.o dbdma.o | 9 | sleeper.o dma.o dbdma.o vss.o irq.o |
10 | |||
11 | obj-$(CONFIG_ALCHEMY_GPIOINT_AU1000) += irq.o | ||
12 | 10 | ||
13 | # optional gpiolib support | 11 | # optional gpiolib support |
14 | ifeq ($(CONFIG_ALCHEMY_GPIO_INDIRECT),) | 12 | ifeq ($(CONFIG_ALCHEMY_GPIO_INDIRECT),) |
diff --git a/arch/mips/alchemy/common/dbdma.c b/arch/mips/alchemy/common/dbdma.c index 0e63ee487d6d..cf02d7dc2df0 100644 --- a/arch/mips/alchemy/common/dbdma.c +++ b/arch/mips/alchemy/common/dbdma.c | |||
@@ -148,6 +148,50 @@ static dbdev_tab_t au1200_dbdev_tab[] __initdata = { | |||
148 | { DSCR_CMD0_ALWAYS, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 }, | 148 | { DSCR_CMD0_ALWAYS, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 }, |
149 | }; | 149 | }; |
150 | 150 | ||
151 | static dbdev_tab_t au1300_dbdev_tab[] __initdata = { | ||
152 | { AU1300_DSCR_CMD0_UART0_TX, DEV_FLAGS_OUT, 0, 8, 0x10100004, 0, 0 }, | ||
153 | { AU1300_DSCR_CMD0_UART0_RX, DEV_FLAGS_IN, 0, 8, 0x10100000, 0, 0 }, | ||
154 | { AU1300_DSCR_CMD0_UART1_TX, DEV_FLAGS_OUT, 0, 8, 0x10101004, 0, 0 }, | ||
155 | { AU1300_DSCR_CMD0_UART1_RX, DEV_FLAGS_IN, 0, 8, 0x10101000, 0, 0 }, | ||
156 | { AU1300_DSCR_CMD0_UART2_TX, DEV_FLAGS_OUT, 0, 8, 0x10102004, 0, 0 }, | ||
157 | { AU1300_DSCR_CMD0_UART2_RX, DEV_FLAGS_IN, 0, 8, 0x10102000, 0, 0 }, | ||
158 | { AU1300_DSCR_CMD0_UART3_TX, DEV_FLAGS_OUT, 0, 8, 0x10103004, 0, 0 }, | ||
159 | { AU1300_DSCR_CMD0_UART3_RX, DEV_FLAGS_IN, 0, 8, 0x10103000, 0, 0 }, | ||
160 | |||
161 | { AU1300_DSCR_CMD0_SDMS_TX0, DEV_FLAGS_OUT, 4, 8, 0x10600000, 0, 0 }, | ||
162 | { AU1300_DSCR_CMD0_SDMS_RX0, DEV_FLAGS_IN, 4, 8, 0x10600004, 0, 0 }, | ||
163 | { AU1300_DSCR_CMD0_SDMS_TX1, DEV_FLAGS_OUT, 8, 8, 0x10601000, 0, 0 }, | ||
164 | { AU1300_DSCR_CMD0_SDMS_RX1, DEV_FLAGS_IN, 8, 8, 0x10601004, 0, 0 }, | ||
165 | |||
166 | { AU1300_DSCR_CMD0_AES_RX, DEV_FLAGS_IN , 4, 32, 0x10300008, 0, 0 }, | ||
167 | { AU1300_DSCR_CMD0_AES_TX, DEV_FLAGS_OUT, 4, 32, 0x10300004, 0, 0 }, | ||
168 | |||
169 | { AU1300_DSCR_CMD0_PSC0_TX, DEV_FLAGS_OUT, 0, 16, 0x10a0001c, 0, 0 }, | ||
170 | { AU1300_DSCR_CMD0_PSC0_RX, DEV_FLAGS_IN, 0, 16, 0x10a0001c, 0, 0 }, | ||
171 | { AU1300_DSCR_CMD0_PSC1_TX, DEV_FLAGS_OUT, 0, 16, 0x10a0101c, 0, 0 }, | ||
172 | { AU1300_DSCR_CMD0_PSC1_RX, DEV_FLAGS_IN, 0, 16, 0x10a0101c, 0, 0 }, | ||
173 | { AU1300_DSCR_CMD0_PSC2_TX, DEV_FLAGS_OUT, 0, 16, 0x10a0201c, 0, 0 }, | ||
174 | { AU1300_DSCR_CMD0_PSC2_RX, DEV_FLAGS_IN, 0, 16, 0x10a0201c, 0, 0 }, | ||
175 | { AU1300_DSCR_CMD0_PSC3_TX, DEV_FLAGS_OUT, 0, 16, 0x10a0301c, 0, 0 }, | ||
176 | { AU1300_DSCR_CMD0_PSC3_RX, DEV_FLAGS_IN, 0, 16, 0x10a0301c, 0, 0 }, | ||
177 | |||
178 | { AU1300_DSCR_CMD0_LCD, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 }, | ||
179 | { AU1300_DSCR_CMD0_NAND_FLASH, DEV_FLAGS_IN, 0, 0, 0x00000000, 0, 0 }, | ||
180 | |||
181 | { AU1300_DSCR_CMD0_SDMS_TX2, DEV_FLAGS_OUT, 4, 8, 0x10602000, 0, 0 }, | ||
182 | { AU1300_DSCR_CMD0_SDMS_RX2, DEV_FLAGS_IN, 4, 8, 0x10602004, 0, 0 }, | ||
183 | |||
184 | { AU1300_DSCR_CMD0_CIM_SYNC, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 }, | ||
185 | |||
186 | { AU1300_DSCR_CMD0_UDMA, DEV_FLAGS_ANYUSE, 0, 32, 0x14001810, 0, 0 }, | ||
187 | |||
188 | { AU1300_DSCR_CMD0_DMA_REQ0, 0, 0, 0, 0x00000000, 0, 0 }, | ||
189 | { AU1300_DSCR_CMD0_DMA_REQ1, 0, 0, 0, 0x00000000, 0, 0 }, | ||
190 | |||
191 | { DSCR_CMD0_THROTTLE, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 }, | ||
192 | { DSCR_CMD0_ALWAYS, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 }, | ||
193 | }; | ||
194 | |||
151 | /* 32 predefined plus 32 custom */ | 195 | /* 32 predefined plus 32 custom */ |
152 | #define DBDEV_TAB_SIZE 64 | 196 | #define DBDEV_TAB_SIZE 64 |
153 | 197 | ||
@@ -1019,8 +1063,7 @@ static int __init dbdma_setup(unsigned int irq, dbdev_tab_t *idtable) | |||
1019 | dbdma_gptr->ddma_inten = 0xffff; | 1063 | dbdma_gptr->ddma_inten = 0xffff; |
1020 | au_sync(); | 1064 | au_sync(); |
1021 | 1065 | ||
1022 | ret = request_irq(irq, dbdma_interrupt, IRQF_DISABLED, "dbdma", | 1066 | ret = request_irq(irq, dbdma_interrupt, 0, "dbdma", (void *)dbdma_gptr); |
1023 | (void *)dbdma_gptr); | ||
1024 | if (ret) | 1067 | if (ret) |
1025 | printk(KERN_ERR "Cannot grab DBDMA interrupt!\n"); | 1068 | printk(KERN_ERR "Cannot grab DBDMA interrupt!\n"); |
1026 | else { | 1069 | else { |
@@ -1038,6 +1081,8 @@ static int __init alchemy_dbdma_init(void) | |||
1038 | return dbdma_setup(AU1550_DDMA_INT, au1550_dbdev_tab); | 1081 | return dbdma_setup(AU1550_DDMA_INT, au1550_dbdev_tab); |
1039 | case ALCHEMY_CPU_AU1200: | 1082 | case ALCHEMY_CPU_AU1200: |
1040 | return dbdma_setup(AU1200_DDMA_INT, au1200_dbdev_tab); | 1083 | return dbdma_setup(AU1200_DDMA_INT, au1200_dbdev_tab); |
1084 | case ALCHEMY_CPU_AU1300: | ||
1085 | return dbdma_setup(AU1300_DDMA_INT, au1300_dbdev_tab); | ||
1041 | } | 1086 | } |
1042 | return 0; | 1087 | return 0; |
1043 | } | 1088 | } |
diff --git a/arch/mips/alchemy/common/gpiolib.c b/arch/mips/alchemy/common/gpiolib.c index 91fb4d9e30fd..f1b50f0c01db 100644 --- a/arch/mips/alchemy/common/gpiolib.c +++ b/arch/mips/alchemy/common/gpiolib.c | |||
@@ -27,6 +27,7 @@ | |||
27 | * CONFIG_ALCHEMY_GPIO_INDIRECT=n, otherwise compilation will fail! | 27 | * CONFIG_ALCHEMY_GPIO_INDIRECT=n, otherwise compilation will fail! |
28 | * au1000 SoC have only one GPIO block : GPIO1 | 28 | * au1000 SoC have only one GPIO block : GPIO1 |
29 | * Au1100, Au15x0, Au12x0 have a second one : GPIO2 | 29 | * Au1100, Au15x0, Au12x0 have a second one : GPIO2 |
30 | * Au1300 is totally different: 1 block with up to 128 GPIOs | ||
30 | */ | 31 | */ |
31 | 32 | ||
32 | #include <linux/init.h> | 33 | #include <linux/init.h> |
@@ -35,6 +36,7 @@ | |||
35 | #include <linux/types.h> | 36 | #include <linux/types.h> |
36 | #include <linux/gpio.h> | 37 | #include <linux/gpio.h> |
37 | #include <asm/mach-au1x00/gpio-au1000.h> | 38 | #include <asm/mach-au1x00/gpio-au1000.h> |
39 | #include <asm/mach-au1x00/gpio-au1300.h> | ||
38 | 40 | ||
39 | static int gpio2_get(struct gpio_chip *chip, unsigned offset) | 41 | static int gpio2_get(struct gpio_chip *chip, unsigned offset) |
40 | { | 42 | { |
@@ -115,6 +117,43 @@ struct gpio_chip alchemy_gpio_chip[] = { | |||
115 | }, | 117 | }, |
116 | }; | 118 | }; |
117 | 119 | ||
120 | static int alchemy_gpic_get(struct gpio_chip *chip, unsigned int off) | ||
121 | { | ||
122 | return au1300_gpio_get_value(off + AU1300_GPIO_BASE); | ||
123 | } | ||
124 | |||
125 | static void alchemy_gpic_set(struct gpio_chip *chip, unsigned int off, int v) | ||
126 | { | ||
127 | au1300_gpio_set_value(off + AU1300_GPIO_BASE, v); | ||
128 | } | ||
129 | |||
130 | static int alchemy_gpic_dir_input(struct gpio_chip *chip, unsigned int off) | ||
131 | { | ||
132 | return au1300_gpio_direction_input(off + AU1300_GPIO_BASE); | ||
133 | } | ||
134 | |||
135 | static int alchemy_gpic_dir_output(struct gpio_chip *chip, unsigned int off, | ||
136 | int v) | ||
137 | { | ||
138 | return au1300_gpio_direction_output(off + AU1300_GPIO_BASE, v); | ||
139 | } | ||
140 | |||
141 | static int alchemy_gpic_gpio_to_irq(struct gpio_chip *chip, unsigned int off) | ||
142 | { | ||
143 | return au1300_gpio_to_irq(off + AU1300_GPIO_BASE); | ||
144 | } | ||
145 | |||
146 | static struct gpio_chip au1300_gpiochip = { | ||
147 | .label = "alchemy-gpic", | ||
148 | .direction_input = alchemy_gpic_dir_input, | ||
149 | .direction_output = alchemy_gpic_dir_output, | ||
150 | .get = alchemy_gpic_get, | ||
151 | .set = alchemy_gpic_set, | ||
152 | .to_irq = alchemy_gpic_gpio_to_irq, | ||
153 | .base = AU1300_GPIO_BASE, | ||
154 | .ngpio = AU1300_GPIO_NUM, | ||
155 | }; | ||
156 | |||
118 | static int __init alchemy_gpiochip_init(void) | 157 | static int __init alchemy_gpiochip_init(void) |
119 | { | 158 | { |
120 | int ret = 0; | 159 | int ret = 0; |
@@ -127,6 +166,9 @@ static int __init alchemy_gpiochip_init(void) | |||
127 | ret = gpiochip_add(&alchemy_gpio_chip[0]); | 166 | ret = gpiochip_add(&alchemy_gpio_chip[0]); |
128 | ret |= gpiochip_add(&alchemy_gpio_chip[1]); | 167 | ret |= gpiochip_add(&alchemy_gpio_chip[1]); |
129 | break; | 168 | break; |
169 | case ALCHEMY_CPU_AU1300: | ||
170 | ret = gpiochip_add(&au1300_gpiochip); | ||
171 | break; | ||
130 | } | 172 | } |
131 | return ret; | 173 | return ret; |
132 | } | 174 | } |
diff --git a/arch/mips/alchemy/common/irq.c b/arch/mips/alchemy/common/irq.c index 8b60ba0675e2..94fbcd19eb9c 100644 --- a/arch/mips/alchemy/common/irq.c +++ b/arch/mips/alchemy/common/irq.c | |||
@@ -25,19 +25,15 @@ | |||
25 | * 675 Mass Ave, Cambridge, MA 02139, USA. | 25 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <linux/bitops.h> | 28 | #include <linux/export.h> |
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <linux/interrupt.h> | 30 | #include <linux/interrupt.h> |
31 | #include <linux/irq.h> | ||
32 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
33 | #include <linux/syscore_ops.h> | 32 | #include <linux/syscore_ops.h> |
34 | 33 | ||
35 | #include <asm/irq_cpu.h> | 34 | #include <asm/irq_cpu.h> |
36 | #include <asm/mipsregs.h> | ||
37 | #include <asm/mach-au1x00/au1000.h> | 35 | #include <asm/mach-au1x00/au1000.h> |
38 | #ifdef CONFIG_MIPS_PB1000 | 36 | #include <asm/mach-au1x00/gpio-au1300.h> |
39 | #include <asm/mach-pb1x00/pb1000.h> | ||
40 | #endif | ||
41 | 37 | ||
42 | /* Interrupt Controller register offsets */ | 38 | /* Interrupt Controller register offsets */ |
43 | #define IC_CFG0RD 0x40 | 39 | #define IC_CFG0RD 0x40 |
@@ -69,7 +65,17 @@ | |||
69 | #define IC_FALLINGCLR 0x7C | 65 | #define IC_FALLINGCLR 0x7C |
70 | #define IC_TESTBIT 0x80 | 66 | #define IC_TESTBIT 0x80 |
71 | 67 | ||
72 | static int au1x_ic_settype(struct irq_data *d, unsigned int flow_type); | 68 | /* per-processor fixed function irqs */ |
69 | struct alchemy_irqmap { | ||
70 | int irq; /* linux IRQ number */ | ||
71 | int type; /* IRQ_TYPE_ */ | ||
72 | int prio; /* irq priority, 0 highest, 3 lowest */ | ||
73 | int internal; /* GPIC: internal source (no ext. pin)? */ | ||
74 | }; | ||
75 | |||
76 | static int au1x_ic_settype(struct irq_data *d, unsigned int type); | ||
77 | static int au1300_gpic_settype(struct irq_data *d, unsigned int type); | ||
78 | |||
73 | 79 | ||
74 | /* NOTE on interrupt priorities: The original writers of this code said: | 80 | /* NOTE on interrupt priorities: The original writers of this code said: |
75 | * | 81 | * |
@@ -77,176 +83,207 @@ static int au1x_ic_settype(struct irq_data *d, unsigned int flow_type); | |||
77 | * the USB devices-side packet complete interrupt (USB_DEV_REQ_INT) | 83 | * the USB devices-side packet complete interrupt (USB_DEV_REQ_INT) |
78 | * needs the highest priority. | 84 | * needs the highest priority. |
79 | */ | 85 | */ |
80 | 86 | struct alchemy_irqmap au1000_irqmap[] __initdata = { | |
81 | /* per-processor fixed function irqs */ | 87 | { AU1000_UART0_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
82 | struct au1xxx_irqmap { | 88 | { AU1000_UART1_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
83 | int im_irq; | 89 | { AU1000_UART2_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
84 | int im_type; | 90 | { AU1000_UART3_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
85 | int im_request; /* set 1 to get higher priority */ | 91 | { AU1000_SSI0_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
92 | { AU1000_SSI1_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, | ||
93 | { AU1000_DMA_INT_BASE, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, | ||
94 | { AU1000_DMA_INT_BASE+1, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, | ||
95 | { AU1000_DMA_INT_BASE+2, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, | ||
96 | { AU1000_DMA_INT_BASE+3, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, | ||
97 | { AU1000_DMA_INT_BASE+4, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, | ||
98 | { AU1000_DMA_INT_BASE+5, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, | ||
99 | { AU1000_DMA_INT_BASE+6, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, | ||
100 | { AU1000_DMA_INT_BASE+7, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, | ||
101 | { AU1000_TOY_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, | ||
102 | { AU1000_TOY_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, | ||
103 | { AU1000_TOY_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, | ||
104 | { AU1000_TOY_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, | ||
105 | { AU1000_RTC_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, | ||
106 | { AU1000_RTC_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, | ||
107 | { AU1000_RTC_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, | ||
108 | { AU1000_RTC_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 0, 0 }, | ||
109 | { AU1000_IRDA_TX_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, | ||
110 | { AU1000_IRDA_RX_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, | ||
111 | { AU1000_USB_DEV_REQ_INT, IRQ_TYPE_LEVEL_HIGH, 0, 0 }, | ||
112 | { AU1000_USB_DEV_SUS_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, | ||
113 | { AU1000_USB_HOST_INT, IRQ_TYPE_LEVEL_LOW, 1, 0 }, | ||
114 | { AU1000_ACSYNC_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, | ||
115 | { AU1000_MAC0_DMA_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, | ||
116 | { AU1000_MAC1_DMA_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, | ||
117 | { AU1000_AC97C_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, | ||
118 | { -1, }, | ||
86 | }; | 119 | }; |
87 | 120 | ||
88 | struct au1xxx_irqmap au1000_irqmap[] __initdata = { | 121 | struct alchemy_irqmap au1500_irqmap[] __initdata = { |
89 | { AU1000_UART0_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 122 | { AU1500_UART0_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
90 | { AU1000_UART1_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 123 | { AU1500_PCI_INTA, IRQ_TYPE_LEVEL_LOW, 1, 0 }, |
91 | { AU1000_UART2_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 124 | { AU1500_PCI_INTB, IRQ_TYPE_LEVEL_LOW, 1, 0 }, |
92 | { AU1000_UART3_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 125 | { AU1500_UART3_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
93 | { AU1000_SSI0_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 126 | { AU1500_PCI_INTC, IRQ_TYPE_LEVEL_LOW, 1, 0 }, |
94 | { AU1000_SSI1_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 127 | { AU1500_PCI_INTD, IRQ_TYPE_LEVEL_LOW, 1, 0 }, |
95 | { AU1000_DMA_INT_BASE, IRQ_TYPE_LEVEL_HIGH, 0 }, | 128 | { AU1500_DMA_INT_BASE, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
96 | { AU1000_DMA_INT_BASE+1, IRQ_TYPE_LEVEL_HIGH, 0 }, | 129 | { AU1500_DMA_INT_BASE+1, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
97 | { AU1000_DMA_INT_BASE+2, IRQ_TYPE_LEVEL_HIGH, 0 }, | 130 | { AU1500_DMA_INT_BASE+2, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
98 | { AU1000_DMA_INT_BASE+3, IRQ_TYPE_LEVEL_HIGH, 0 }, | 131 | { AU1500_DMA_INT_BASE+3, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
99 | { AU1000_DMA_INT_BASE+4, IRQ_TYPE_LEVEL_HIGH, 0 }, | 132 | { AU1500_DMA_INT_BASE+4, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
100 | { AU1000_DMA_INT_BASE+5, IRQ_TYPE_LEVEL_HIGH, 0 }, | 133 | { AU1500_DMA_INT_BASE+5, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
101 | { AU1000_DMA_INT_BASE+6, IRQ_TYPE_LEVEL_HIGH, 0 }, | 134 | { AU1500_DMA_INT_BASE+6, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
102 | { AU1000_DMA_INT_BASE+7, IRQ_TYPE_LEVEL_HIGH, 0 }, | 135 | { AU1500_DMA_INT_BASE+7, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
103 | { AU1000_TOY_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 136 | { AU1500_TOY_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
104 | { AU1000_TOY_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 137 | { AU1500_TOY_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
105 | { AU1000_TOY_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 138 | { AU1500_TOY_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
106 | { AU1000_TOY_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 139 | { AU1500_TOY_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
107 | { AU1000_RTC_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 140 | { AU1500_RTC_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
108 | { AU1000_RTC_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 141 | { AU1500_RTC_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
109 | { AU1000_RTC_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 142 | { AU1500_RTC_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
110 | { AU1000_RTC_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 1 }, | 143 | { AU1500_RTC_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 0, 0 }, |
111 | { AU1000_IRDA_TX_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 144 | { AU1500_USB_DEV_REQ_INT, IRQ_TYPE_LEVEL_HIGH, 0, 0 }, |
112 | { AU1000_IRDA_RX_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 145 | { AU1500_USB_DEV_SUS_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
113 | { AU1000_USB_DEV_REQ_INT, IRQ_TYPE_LEVEL_HIGH, 1 }, | 146 | { AU1500_USB_HOST_INT, IRQ_TYPE_LEVEL_LOW, 1, 0 }, |
114 | { AU1000_USB_DEV_SUS_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 147 | { AU1500_ACSYNC_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
115 | { AU1000_USB_HOST_INT, IRQ_TYPE_LEVEL_LOW, 0 }, | 148 | { AU1500_MAC0_DMA_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
116 | { AU1000_ACSYNC_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 149 | { AU1500_MAC1_DMA_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
117 | { AU1000_MAC0_DMA_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 150 | { AU1500_AC97C_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
118 | { AU1000_MAC1_DMA_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | ||
119 | { AU1000_AC97C_INT, IRQ_TYPE_EDGE_RISING, 0 }, | ||
120 | { -1, }, | 151 | { -1, }, |
121 | }; | 152 | }; |
122 | 153 | ||
123 | struct au1xxx_irqmap au1500_irqmap[] __initdata = { | 154 | struct alchemy_irqmap au1100_irqmap[] __initdata = { |
124 | { AU1500_UART0_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 155 | { AU1100_UART0_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
125 | { AU1500_PCI_INTA, IRQ_TYPE_LEVEL_LOW, 0 }, | 156 | { AU1100_UART1_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
126 | { AU1500_PCI_INTB, IRQ_TYPE_LEVEL_LOW, 0 }, | 157 | { AU1100_SD_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
127 | { AU1500_UART3_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 158 | { AU1100_UART3_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
128 | { AU1500_PCI_INTC, IRQ_TYPE_LEVEL_LOW, 0 }, | 159 | { AU1100_SSI0_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
129 | { AU1500_PCI_INTD, IRQ_TYPE_LEVEL_LOW, 0 }, | 160 | { AU1100_SSI1_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
130 | { AU1500_DMA_INT_BASE, IRQ_TYPE_LEVEL_HIGH, 0 }, | 161 | { AU1100_DMA_INT_BASE, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
131 | { AU1500_DMA_INT_BASE+1, IRQ_TYPE_LEVEL_HIGH, 0 }, | 162 | { AU1100_DMA_INT_BASE+1, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
132 | { AU1500_DMA_INT_BASE+2, IRQ_TYPE_LEVEL_HIGH, 0 }, | 163 | { AU1100_DMA_INT_BASE+2, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
133 | { AU1500_DMA_INT_BASE+3, IRQ_TYPE_LEVEL_HIGH, 0 }, | 164 | { AU1100_DMA_INT_BASE+3, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
134 | { AU1500_DMA_INT_BASE+4, IRQ_TYPE_LEVEL_HIGH, 0 }, | 165 | { AU1100_DMA_INT_BASE+4, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
135 | { AU1500_DMA_INT_BASE+5, IRQ_TYPE_LEVEL_HIGH, 0 }, | 166 | { AU1100_DMA_INT_BASE+5, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
136 | { AU1500_DMA_INT_BASE+6, IRQ_TYPE_LEVEL_HIGH, 0 }, | 167 | { AU1100_DMA_INT_BASE+6, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
137 | { AU1500_DMA_INT_BASE+7, IRQ_TYPE_LEVEL_HIGH, 0 }, | 168 | { AU1100_DMA_INT_BASE+7, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
138 | { AU1500_TOY_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 169 | { AU1100_TOY_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
139 | { AU1500_TOY_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 170 | { AU1100_TOY_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
140 | { AU1500_TOY_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 171 | { AU1100_TOY_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
141 | { AU1500_TOY_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 172 | { AU1100_TOY_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
142 | { AU1500_RTC_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 173 | { AU1100_RTC_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
143 | { AU1500_RTC_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 174 | { AU1100_RTC_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
144 | { AU1500_RTC_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 175 | { AU1100_RTC_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
145 | { AU1500_RTC_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 1 }, | 176 | { AU1100_RTC_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 0, 0 }, |
146 | { AU1500_USB_DEV_REQ_INT, IRQ_TYPE_LEVEL_HIGH, 1 }, | 177 | { AU1100_IRDA_TX_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
147 | { AU1500_USB_DEV_SUS_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 178 | { AU1100_IRDA_RX_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
148 | { AU1500_USB_HOST_INT, IRQ_TYPE_LEVEL_LOW, 0 }, | 179 | { AU1100_USB_DEV_REQ_INT, IRQ_TYPE_LEVEL_HIGH, 0, 0 }, |
149 | { AU1500_ACSYNC_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 180 | { AU1100_USB_DEV_SUS_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
150 | { AU1500_MAC0_DMA_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 181 | { AU1100_USB_HOST_INT, IRQ_TYPE_LEVEL_LOW, 1, 0 }, |
151 | { AU1500_MAC1_DMA_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 182 | { AU1100_ACSYNC_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
152 | { AU1500_AC97C_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 183 | { AU1100_MAC0_DMA_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
184 | { AU1100_LCD_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, | ||
185 | { AU1100_AC97C_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, | ||
153 | { -1, }, | 186 | { -1, }, |
154 | }; | 187 | }; |
155 | 188 | ||
156 | struct au1xxx_irqmap au1100_irqmap[] __initdata = { | 189 | struct alchemy_irqmap au1550_irqmap[] __initdata = { |
157 | { AU1100_UART0_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 190 | { AU1550_UART0_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
158 | { AU1100_UART1_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 191 | { AU1550_PCI_INTA, IRQ_TYPE_LEVEL_LOW, 1, 0 }, |
159 | { AU1100_SD_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 192 | { AU1550_PCI_INTB, IRQ_TYPE_LEVEL_LOW, 1, 0 }, |
160 | { AU1100_UART3_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 193 | { AU1550_DDMA_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
161 | { AU1100_SSI0_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 194 | { AU1550_CRYPTO_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
162 | { AU1100_SSI1_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 195 | { AU1550_PCI_INTC, IRQ_TYPE_LEVEL_LOW, 1, 0 }, |
163 | { AU1100_DMA_INT_BASE, IRQ_TYPE_LEVEL_HIGH, 0 }, | 196 | { AU1550_PCI_INTD, IRQ_TYPE_LEVEL_LOW, 1, 0 }, |
164 | { AU1100_DMA_INT_BASE+1, IRQ_TYPE_LEVEL_HIGH, 0 }, | 197 | { AU1550_PCI_RST_INT, IRQ_TYPE_LEVEL_LOW, 1, 0 }, |
165 | { AU1100_DMA_INT_BASE+2, IRQ_TYPE_LEVEL_HIGH, 0 }, | 198 | { AU1550_UART1_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
166 | { AU1100_DMA_INT_BASE+3, IRQ_TYPE_LEVEL_HIGH, 0 }, | 199 | { AU1550_UART3_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
167 | { AU1100_DMA_INT_BASE+4, IRQ_TYPE_LEVEL_HIGH, 0 }, | 200 | { AU1550_PSC0_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
168 | { AU1100_DMA_INT_BASE+5, IRQ_TYPE_LEVEL_HIGH, 0 }, | 201 | { AU1550_PSC1_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
169 | { AU1100_DMA_INT_BASE+6, IRQ_TYPE_LEVEL_HIGH, 0 }, | 202 | { AU1550_PSC2_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
170 | { AU1100_DMA_INT_BASE+7, IRQ_TYPE_LEVEL_HIGH, 0 }, | 203 | { AU1550_PSC3_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
171 | { AU1100_TOY_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 204 | { AU1550_TOY_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
172 | { AU1100_TOY_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 205 | { AU1550_TOY_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
173 | { AU1100_TOY_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 206 | { AU1550_TOY_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
174 | { AU1100_TOY_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 207 | { AU1550_TOY_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
175 | { AU1100_RTC_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 208 | { AU1550_RTC_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
176 | { AU1100_RTC_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 209 | { AU1550_RTC_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
177 | { AU1100_RTC_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 210 | { AU1550_RTC_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
178 | { AU1100_RTC_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 1 }, | 211 | { AU1550_RTC_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 0, 0 }, |
179 | { AU1100_IRDA_TX_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 212 | { AU1550_NAND_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
180 | { AU1100_IRDA_RX_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 213 | { AU1550_USB_DEV_REQ_INT, IRQ_TYPE_LEVEL_HIGH, 0, 0 }, |
181 | { AU1100_USB_DEV_REQ_INT, IRQ_TYPE_LEVEL_HIGH, 1 }, | 214 | { AU1550_USB_DEV_SUS_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
182 | { AU1100_USB_DEV_SUS_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 215 | { AU1550_USB_HOST_INT, IRQ_TYPE_LEVEL_LOW, 1, 0 }, |
183 | { AU1100_USB_HOST_INT, IRQ_TYPE_LEVEL_LOW, 0 }, | 216 | { AU1550_MAC0_DMA_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
184 | { AU1100_ACSYNC_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 217 | { AU1550_MAC1_DMA_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
185 | { AU1100_MAC0_DMA_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | ||
186 | { AU1100_LCD_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | ||
187 | { AU1100_AC97C_INT, IRQ_TYPE_EDGE_RISING, 0 }, | ||
188 | { -1, }, | 218 | { -1, }, |
189 | }; | 219 | }; |
190 | 220 | ||
191 | struct au1xxx_irqmap au1550_irqmap[] __initdata = { | 221 | struct alchemy_irqmap au1200_irqmap[] __initdata = { |
192 | { AU1550_UART0_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 222 | { AU1200_UART0_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
193 | { AU1550_PCI_INTA, IRQ_TYPE_LEVEL_LOW, 0 }, | 223 | { AU1200_SWT_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
194 | { AU1550_PCI_INTB, IRQ_TYPE_LEVEL_LOW, 0 }, | 224 | { AU1200_SD_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
195 | { AU1550_DDMA_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 225 | { AU1200_DDMA_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
196 | { AU1550_CRYPTO_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 226 | { AU1200_MAE_BE_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
197 | { AU1550_PCI_INTC, IRQ_TYPE_LEVEL_LOW, 0 }, | 227 | { AU1200_UART1_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
198 | { AU1550_PCI_INTD, IRQ_TYPE_LEVEL_LOW, 0 }, | 228 | { AU1200_MAE_FE_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
199 | { AU1550_PCI_RST_INT, IRQ_TYPE_LEVEL_LOW, 0 }, | 229 | { AU1200_PSC0_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
200 | { AU1550_UART1_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 230 | { AU1200_PSC1_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
201 | { AU1550_UART3_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 231 | { AU1200_AES_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
202 | { AU1550_PSC0_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 232 | { AU1200_CAMERA_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
203 | { AU1550_PSC1_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 233 | { AU1200_TOY_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
204 | { AU1550_PSC2_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 234 | { AU1200_TOY_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
205 | { AU1550_PSC3_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 235 | { AU1200_TOY_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
206 | { AU1550_TOY_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 236 | { AU1200_TOY_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
207 | { AU1550_TOY_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 237 | { AU1200_RTC_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
208 | { AU1550_TOY_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 238 | { AU1200_RTC_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
209 | { AU1550_TOY_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 239 | { AU1200_RTC_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
210 | { AU1550_RTC_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 240 | { AU1200_RTC_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 0, 0 }, |
211 | { AU1550_RTC_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 241 | { AU1200_NAND_INT, IRQ_TYPE_EDGE_RISING, 1, 0 }, |
212 | { AU1550_RTC_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 242 | { AU1200_USB_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
213 | { AU1550_RTC_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 1 }, | 243 | { AU1200_LCD_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
214 | { AU1550_NAND_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 244 | { AU1200_MAE_BOTH_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0 }, |
215 | { AU1550_USB_DEV_REQ_INT, IRQ_TYPE_LEVEL_HIGH, 1 }, | ||
216 | { AU1550_USB_DEV_SUS_INT, IRQ_TYPE_EDGE_RISING, 0 }, | ||
217 | { AU1550_USB_HOST_INT, IRQ_TYPE_LEVEL_LOW, 0 }, | ||
218 | { AU1550_MAC0_DMA_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | ||
219 | { AU1550_MAC1_DMA_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | ||
220 | { -1, }, | 245 | { -1, }, |
221 | }; | 246 | }; |
222 | 247 | ||
223 | struct au1xxx_irqmap au1200_irqmap[] __initdata = { | 248 | static struct alchemy_irqmap au1300_irqmap[] __initdata = { |
224 | { AU1200_UART0_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 249 | /* multifunction: gpio pin or device */ |
225 | { AU1200_SWT_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 250 | { AU1300_UART1_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0, }, |
226 | { AU1200_SD_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 251 | { AU1300_UART2_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0, }, |
227 | { AU1200_DDMA_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 252 | { AU1300_UART3_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0, }, |
228 | { AU1200_MAE_BE_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 253 | { AU1300_SD1_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0, }, |
229 | { AU1200_UART1_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 254 | { AU1300_SD2_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0, }, |
230 | { AU1200_MAE_FE_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 255 | { AU1300_PSC0_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0, }, |
231 | { AU1200_PSC0_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 256 | { AU1300_PSC1_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0, }, |
232 | { AU1200_PSC1_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 257 | { AU1300_PSC2_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0, }, |
233 | { AU1200_AES_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 258 | { AU1300_PSC3_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0, }, |
234 | { AU1200_CAMERA_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 259 | { AU1300_NAND_INT, IRQ_TYPE_LEVEL_HIGH, 1, 0, }, |
235 | { AU1200_TOY_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 260 | /* au1300 internal */ |
236 | { AU1200_TOY_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 261 | { AU1300_DDMA_INT, IRQ_TYPE_LEVEL_HIGH, 1, 1, }, |
237 | { AU1200_TOY_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 262 | { AU1300_MMU_INT, IRQ_TYPE_LEVEL_HIGH, 1, 1, }, |
238 | { AU1200_TOY_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 263 | { AU1300_MPU_INT, IRQ_TYPE_LEVEL_HIGH, 1, 1, }, |
239 | { AU1200_RTC_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 264 | { AU1300_GPU_INT, IRQ_TYPE_LEVEL_HIGH, 1, 1, }, |
240 | { AU1200_RTC_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 265 | { AU1300_UDMA_INT, IRQ_TYPE_LEVEL_HIGH, 1, 1, }, |
241 | { AU1200_RTC_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 266 | { AU1300_TOY_INT, IRQ_TYPE_EDGE_RISING, 1, 1, }, |
242 | { AU1200_RTC_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 1 }, | 267 | { AU1300_TOY_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 1, 1, }, |
243 | { AU1200_NAND_INT, IRQ_TYPE_EDGE_RISING, 0 }, | 268 | { AU1300_TOY_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 1, 1, }, |
244 | { AU1200_USB_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 269 | { AU1300_TOY_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 1, 1, }, |
245 | { AU1200_LCD_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 270 | { AU1300_RTC_INT, IRQ_TYPE_EDGE_RISING, 1, 1, }, |
246 | { AU1200_MAE_BOTH_INT, IRQ_TYPE_LEVEL_HIGH, 0 }, | 271 | { AU1300_RTC_MATCH0_INT, IRQ_TYPE_EDGE_RISING, 1, 1, }, |
247 | { -1, }, | 272 | { AU1300_RTC_MATCH1_INT, IRQ_TYPE_EDGE_RISING, 1, 1, }, |
273 | { AU1300_RTC_MATCH2_INT, IRQ_TYPE_EDGE_RISING, 0, 1, }, | ||
274 | { AU1300_UART0_INT, IRQ_TYPE_LEVEL_HIGH, 1, 1, }, | ||
275 | { AU1300_SD0_INT, IRQ_TYPE_LEVEL_HIGH, 1, 1, }, | ||
276 | { AU1300_USB_INT, IRQ_TYPE_LEVEL_HIGH, 1, 1, }, | ||
277 | { AU1300_LCD_INT, IRQ_TYPE_LEVEL_HIGH, 1, 1, }, | ||
278 | { AU1300_BSA_INT, IRQ_TYPE_LEVEL_HIGH, 1, 1, }, | ||
279 | { AU1300_MPE_INT, IRQ_TYPE_EDGE_RISING, 1, 1, }, | ||
280 | { AU1300_ITE_INT, IRQ_TYPE_LEVEL_HIGH, 1, 1, }, | ||
281 | { AU1300_AES_INT, IRQ_TYPE_LEVEL_HIGH, 1, 1, }, | ||
282 | { AU1300_CIM_INT, IRQ_TYPE_LEVEL_HIGH, 1, 1, }, | ||
283 | { -1, }, /* terminator */ | ||
248 | }; | 284 | }; |
249 | 285 | ||
286 | /******************************************************************************/ | ||
250 | 287 | ||
251 | static void au1x_ic0_unmask(struct irq_data *d) | 288 | static void au1x_ic0_unmask(struct irq_data *d) |
252 | { | 289 | { |
@@ -265,14 +302,6 @@ static void au1x_ic1_unmask(struct irq_data *d) | |||
265 | 302 | ||
266 | __raw_writel(1 << bit, base + IC_MASKSET); | 303 | __raw_writel(1 << bit, base + IC_MASKSET); |
267 | __raw_writel(1 << bit, base + IC_WAKESET); | 304 | __raw_writel(1 << bit, base + IC_WAKESET); |
268 | |||
269 | /* very hacky. does the pb1000 cpld auto-disable this int? | ||
270 | * nowhere in the current kernel sources is it disabled. --mlau | ||
271 | */ | ||
272 | #if defined(CONFIG_MIPS_PB1000) | ||
273 | if (d->irq == AU1000_GPIO15_INT) | ||
274 | __raw_writel(0x4000, (void __iomem *)PB1000_MDR); /* enable int */ | ||
275 | #endif | ||
276 | wmb(); | 305 | wmb(); |
277 | } | 306 | } |
278 | 307 | ||
@@ -470,40 +499,219 @@ static int au1x_ic_settype(struct irq_data *d, unsigned int flow_type) | |||
470 | return ret; | 499 | return ret; |
471 | } | 500 | } |
472 | 501 | ||
473 | asmlinkage void plat_irq_dispatch(void) | 502 | /******************************************************************************/ |
503 | |||
504 | /* | ||
505 | * au1300_gpic_chgcfg - change PIN configuration. | ||
506 | * @gpio: pin to change (0-based GPIO number from datasheet). | ||
507 | * @clr: clear all bits set in 'clr'. | ||
508 | * @set: set these bits. | ||
509 | * | ||
510 | * modifies a pins' configuration register, bits set in @clr will | ||
511 | * be cleared in the register, bits in @set will be set. | ||
512 | */ | ||
513 | static inline void au1300_gpic_chgcfg(unsigned int gpio, | ||
514 | unsigned long clr, | ||
515 | unsigned long set) | ||
516 | { | ||
517 | void __iomem *r = AU1300_GPIC_ADDR; | ||
518 | unsigned long l; | ||
519 | |||
520 | r += gpio * 4; /* offset into pin config array */ | ||
521 | l = __raw_readl(r + AU1300_GPIC_PINCFG); | ||
522 | l &= ~clr; | ||
523 | l |= set; | ||
524 | __raw_writel(l, r + AU1300_GPIC_PINCFG); | ||
525 | wmb(); | ||
526 | } | ||
527 | |||
528 | /* | ||
529 | * au1300_pinfunc_to_gpio - assign a pin as GPIO input (GPIO ctrl). | ||
530 | * @pin: pin (0-based GPIO number from datasheet). | ||
531 | * | ||
532 | * Assigns a GPIO pin to the GPIO controller, so its level can either | ||
533 | * be read or set through the generic GPIO functions. | ||
534 | * If you need a GPOUT, use au1300_gpio_set_value(pin, 0/1). | ||
535 | * REVISIT: is this function really necessary? | ||
536 | */ | ||
537 | void au1300_pinfunc_to_gpio(enum au1300_multifunc_pins gpio) | ||
538 | { | ||
539 | au1300_gpio_direction_input(gpio + AU1300_GPIO_BASE); | ||
540 | } | ||
541 | EXPORT_SYMBOL_GPL(au1300_pinfunc_to_gpio); | ||
542 | |||
543 | /* | ||
544 | * au1300_pinfunc_to_dev - assign a pin to the device function. | ||
545 | * @pin: pin (0-based GPIO number from datasheet). | ||
546 | * | ||
547 | * Assigns a GPIO pin to its associated device function; the pin will be | ||
548 | * driven by the device and not through GPIO functions. | ||
549 | */ | ||
550 | void au1300_pinfunc_to_dev(enum au1300_multifunc_pins gpio) | ||
551 | { | ||
552 | void __iomem *r = AU1300_GPIC_ADDR; | ||
553 | unsigned long bit; | ||
554 | |||
555 | r += GPIC_GPIO_BANKOFF(gpio); | ||
556 | bit = GPIC_GPIO_TO_BIT(gpio); | ||
557 | __raw_writel(bit, r + AU1300_GPIC_DEVSEL); | ||
558 | wmb(); | ||
559 | } | ||
560 | EXPORT_SYMBOL_GPL(au1300_pinfunc_to_dev); | ||
561 | |||
562 | /* | ||
563 | * au1300_set_irq_priority - set internal priority of IRQ. | ||
564 | * @irq: irq to set priority (linux irq number). | ||
565 | * @p: priority (0 = highest, 3 = lowest). | ||
566 | */ | ||
567 | void au1300_set_irq_priority(unsigned int irq, int p) | ||
474 | { | 568 | { |
475 | unsigned int pending = read_c0_status() & read_c0_cause(); | 569 | irq -= ALCHEMY_GPIC_INT_BASE; |
476 | unsigned long s, off; | 570 | au1300_gpic_chgcfg(irq, GPIC_CFG_IL_MASK, GPIC_CFG_IL_SET(p)); |
477 | 571 | } | |
478 | if (pending & CAUSEF_IP7) { | 572 | EXPORT_SYMBOL_GPL(au1300_set_irq_priority); |
479 | off = MIPS_CPU_IRQ_BASE + 7; | 573 | |
480 | goto handle; | 574 | /* |
481 | } else if (pending & CAUSEF_IP2) { | 575 | * au1300_set_dbdma_gpio - assign a gpio to one of the DBDMA triggers. |
482 | s = KSEG1ADDR(AU1000_IC0_PHYS_ADDR) + IC_REQ0INT; | 576 | * @dchan: dbdma trigger select (0, 1). |
483 | off = AU1000_INTC0_INT_BASE; | 577 | * @gpio: pin to assign as trigger. |
484 | } else if (pending & CAUSEF_IP3) { | 578 | * |
485 | s = KSEG1ADDR(AU1000_IC0_PHYS_ADDR) + IC_REQ1INT; | 579 | * DBDMA controller has 2 external trigger sources; this function |
486 | off = AU1000_INTC0_INT_BASE; | 580 | * assigns a GPIO to the selected trigger. |
487 | } else if (pending & CAUSEF_IP4) { | 581 | */ |
488 | s = KSEG1ADDR(AU1000_IC1_PHYS_ADDR) + IC_REQ0INT; | 582 | void au1300_set_dbdma_gpio(int dchan, unsigned int gpio) |
489 | off = AU1000_INTC1_INT_BASE; | 583 | { |
490 | } else if (pending & CAUSEF_IP5) { | 584 | unsigned long r; |
491 | s = KSEG1ADDR(AU1000_IC1_PHYS_ADDR) + IC_REQ1INT; | 585 | |
492 | off = AU1000_INTC1_INT_BASE; | 586 | if ((dchan >= 0) && (dchan <= 1)) { |
493 | } else | 587 | r = __raw_readl(AU1300_GPIC_ADDR + AU1300_GPIC_DMASEL); |
494 | goto spurious; | 588 | r &= ~(0xff << (8 * dchan)); |
495 | 589 | r |= (gpio & 0x7f) << (8 * dchan); | |
496 | s = __raw_readl((void __iomem *)s); | 590 | __raw_writel(r, AU1300_GPIC_ADDR + AU1300_GPIC_DMASEL); |
497 | if (unlikely(!s)) { | 591 | wmb(); |
498 | spurious: | ||
499 | spurious_interrupt(); | ||
500 | return; | ||
501 | } | 592 | } |
502 | off += __ffs(s); | ||
503 | handle: | ||
504 | do_IRQ(off); | ||
505 | } | 593 | } |
506 | 594 | ||
595 | static inline void gpic_pin_set_idlewake(unsigned int gpio, int allow) | ||
596 | { | ||
597 | au1300_gpic_chgcfg(gpio, GPIC_CFG_IDLEWAKE, | ||
598 | allow ? GPIC_CFG_IDLEWAKE : 0); | ||
599 | } | ||
600 | |||
601 | static void au1300_gpic_mask(struct irq_data *d) | ||
602 | { | ||
603 | void __iomem *r = AU1300_GPIC_ADDR; | ||
604 | unsigned long bit, irq = d->irq; | ||
605 | |||
606 | irq -= ALCHEMY_GPIC_INT_BASE; | ||
607 | r += GPIC_GPIO_BANKOFF(irq); | ||
608 | bit = GPIC_GPIO_TO_BIT(irq); | ||
609 | __raw_writel(bit, r + AU1300_GPIC_IDIS); | ||
610 | wmb(); | ||
611 | |||
612 | gpic_pin_set_idlewake(irq, 0); | ||
613 | } | ||
614 | |||
615 | static void au1300_gpic_unmask(struct irq_data *d) | ||
616 | { | ||
617 | void __iomem *r = AU1300_GPIC_ADDR; | ||
618 | unsigned long bit, irq = d->irq; | ||
619 | |||
620 | irq -= ALCHEMY_GPIC_INT_BASE; | ||
621 | |||
622 | gpic_pin_set_idlewake(irq, 1); | ||
623 | |||
624 | r += GPIC_GPIO_BANKOFF(irq); | ||
625 | bit = GPIC_GPIO_TO_BIT(irq); | ||
626 | __raw_writel(bit, r + AU1300_GPIC_IEN); | ||
627 | wmb(); | ||
628 | } | ||
629 | |||
630 | static void au1300_gpic_maskack(struct irq_data *d) | ||
631 | { | ||
632 | void __iomem *r = AU1300_GPIC_ADDR; | ||
633 | unsigned long bit, irq = d->irq; | ||
634 | |||
635 | irq -= ALCHEMY_GPIC_INT_BASE; | ||
636 | r += GPIC_GPIO_BANKOFF(irq); | ||
637 | bit = GPIC_GPIO_TO_BIT(irq); | ||
638 | __raw_writel(bit, r + AU1300_GPIC_IPEND); /* ack */ | ||
639 | __raw_writel(bit, r + AU1300_GPIC_IDIS); /* mask */ | ||
640 | wmb(); | ||
641 | |||
642 | gpic_pin_set_idlewake(irq, 0); | ||
643 | } | ||
644 | |||
645 | static void au1300_gpic_ack(struct irq_data *d) | ||
646 | { | ||
647 | void __iomem *r = AU1300_GPIC_ADDR; | ||
648 | unsigned long bit, irq = d->irq; | ||
649 | |||
650 | irq -= ALCHEMY_GPIC_INT_BASE; | ||
651 | r += GPIC_GPIO_BANKOFF(irq); | ||
652 | bit = GPIC_GPIO_TO_BIT(irq); | ||
653 | __raw_writel(bit, r + AU1300_GPIC_IPEND); /* ack */ | ||
654 | wmb(); | ||
655 | } | ||
656 | |||
657 | static struct irq_chip au1300_gpic = { | ||
658 | .name = "GPIOINT", | ||
659 | .irq_ack = au1300_gpic_ack, | ||
660 | .irq_mask = au1300_gpic_mask, | ||
661 | .irq_mask_ack = au1300_gpic_maskack, | ||
662 | .irq_unmask = au1300_gpic_unmask, | ||
663 | .irq_set_type = au1300_gpic_settype, | ||
664 | }; | ||
665 | |||
666 | static int au1300_gpic_settype(struct irq_data *d, unsigned int type) | ||
667 | { | ||
668 | unsigned long s; | ||
669 | unsigned char *name = NULL; | ||
670 | irq_flow_handler_t hdl = NULL; | ||
671 | |||
672 | switch (type) { | ||
673 | case IRQ_TYPE_LEVEL_HIGH: | ||
674 | s = GPIC_CFG_IC_LEVEL_HIGH; | ||
675 | name = "high"; | ||
676 | hdl = handle_level_irq; | ||
677 | break; | ||
678 | case IRQ_TYPE_LEVEL_LOW: | ||
679 | s = GPIC_CFG_IC_LEVEL_LOW; | ||
680 | name = "low"; | ||
681 | hdl = handle_level_irq; | ||
682 | break; | ||
683 | case IRQ_TYPE_EDGE_RISING: | ||
684 | s = GPIC_CFG_IC_EDGE_RISE; | ||
685 | name = "posedge"; | ||
686 | hdl = handle_edge_irq; | ||
687 | break; | ||
688 | case IRQ_TYPE_EDGE_FALLING: | ||
689 | s = GPIC_CFG_IC_EDGE_FALL; | ||
690 | name = "negedge"; | ||
691 | hdl = handle_edge_irq; | ||
692 | break; | ||
693 | case IRQ_TYPE_EDGE_BOTH: | ||
694 | s = GPIC_CFG_IC_EDGE_BOTH; | ||
695 | name = "bothedge"; | ||
696 | hdl = handle_edge_irq; | ||
697 | break; | ||
698 | case IRQ_TYPE_NONE: | ||
699 | s = GPIC_CFG_IC_OFF; | ||
700 | name = "disabled"; | ||
701 | hdl = handle_level_irq; | ||
702 | break; | ||
703 | default: | ||
704 | return -EINVAL; | ||
705 | } | ||
706 | |||
707 | __irq_set_chip_handler_name_locked(d->irq, &au1300_gpic, hdl, name); | ||
708 | |||
709 | au1300_gpic_chgcfg(d->irq - ALCHEMY_GPIC_INT_BASE, GPIC_CFG_IC_MASK, s); | ||
710 | |||
711 | return 0; | ||
712 | } | ||
713 | |||
714 | /******************************************************************************/ | ||
507 | 715 | ||
508 | static inline void ic_init(void __iomem *base) | 716 | static inline void ic_init(void __iomem *base) |
509 | { | 717 | { |
@@ -521,13 +729,159 @@ static inline void ic_init(void __iomem *base) | |||
521 | wmb(); | 729 | wmb(); |
522 | } | 730 | } |
523 | 731 | ||
524 | static void __init au1000_init_irq(struct au1xxx_irqmap *map) | 732 | static unsigned long alchemy_gpic_pmdata[ALCHEMY_GPIC_INT_NUM + 6]; |
733 | |||
734 | static inline void alchemy_ic_suspend_one(void __iomem *base, unsigned long *d) | ||
735 | { | ||
736 | d[0] = __raw_readl(base + IC_CFG0RD); | ||
737 | d[1] = __raw_readl(base + IC_CFG1RD); | ||
738 | d[2] = __raw_readl(base + IC_CFG2RD); | ||
739 | d[3] = __raw_readl(base + IC_SRCRD); | ||
740 | d[4] = __raw_readl(base + IC_ASSIGNRD); | ||
741 | d[5] = __raw_readl(base + IC_WAKERD); | ||
742 | d[6] = __raw_readl(base + IC_MASKRD); | ||
743 | ic_init(base); /* shut it up too while at it */ | ||
744 | } | ||
745 | |||
746 | static inline void alchemy_ic_resume_one(void __iomem *base, unsigned long *d) | ||
747 | { | ||
748 | ic_init(base); | ||
749 | |||
750 | __raw_writel(d[0], base + IC_CFG0SET); | ||
751 | __raw_writel(d[1], base + IC_CFG1SET); | ||
752 | __raw_writel(d[2], base + IC_CFG2SET); | ||
753 | __raw_writel(d[3], base + IC_SRCSET); | ||
754 | __raw_writel(d[4], base + IC_ASSIGNSET); | ||
755 | __raw_writel(d[5], base + IC_WAKESET); | ||
756 | wmb(); | ||
757 | |||
758 | __raw_writel(d[6], base + IC_MASKSET); | ||
759 | wmb(); | ||
760 | } | ||
761 | |||
762 | static int alchemy_ic_suspend(void) | ||
763 | { | ||
764 | alchemy_ic_suspend_one((void __iomem *)KSEG1ADDR(AU1000_IC0_PHYS_ADDR), | ||
765 | alchemy_gpic_pmdata); | ||
766 | alchemy_ic_suspend_one((void __iomem *)KSEG1ADDR(AU1000_IC1_PHYS_ADDR), | ||
767 | &alchemy_gpic_pmdata[7]); | ||
768 | return 0; | ||
769 | } | ||
770 | |||
771 | static void alchemy_ic_resume(void) | ||
772 | { | ||
773 | alchemy_ic_resume_one((void __iomem *)KSEG1ADDR(AU1000_IC1_PHYS_ADDR), | ||
774 | &alchemy_gpic_pmdata[7]); | ||
775 | alchemy_ic_resume_one((void __iomem *)KSEG1ADDR(AU1000_IC0_PHYS_ADDR), | ||
776 | alchemy_gpic_pmdata); | ||
777 | } | ||
778 | |||
779 | static int alchemy_gpic_suspend(void) | ||
780 | { | ||
781 | void __iomem *base = (void __iomem *)KSEG1ADDR(AU1300_GPIC_PHYS_ADDR); | ||
782 | int i; | ||
783 | |||
784 | /* save 4 interrupt mask status registers */ | ||
785 | alchemy_gpic_pmdata[0] = __raw_readl(base + AU1300_GPIC_IEN + 0x0); | ||
786 | alchemy_gpic_pmdata[1] = __raw_readl(base + AU1300_GPIC_IEN + 0x4); | ||
787 | alchemy_gpic_pmdata[2] = __raw_readl(base + AU1300_GPIC_IEN + 0x8); | ||
788 | alchemy_gpic_pmdata[3] = __raw_readl(base + AU1300_GPIC_IEN + 0xc); | ||
789 | |||
790 | /* save misc register(s) */ | ||
791 | alchemy_gpic_pmdata[4] = __raw_readl(base + AU1300_GPIC_DMASEL); | ||
792 | |||
793 | /* molto silenzioso */ | ||
794 | __raw_writel(~0UL, base + AU1300_GPIC_IDIS + 0x0); | ||
795 | __raw_writel(~0UL, base + AU1300_GPIC_IDIS + 0x4); | ||
796 | __raw_writel(~0UL, base + AU1300_GPIC_IDIS + 0x8); | ||
797 | __raw_writel(~0UL, base + AU1300_GPIC_IDIS + 0xc); | ||
798 | wmb(); | ||
799 | |||
800 | /* save pin/int-type configuration */ | ||
801 | base += AU1300_GPIC_PINCFG; | ||
802 | for (i = 0; i < ALCHEMY_GPIC_INT_NUM; i++) | ||
803 | alchemy_gpic_pmdata[i + 5] = __raw_readl(base + (i << 2)); | ||
804 | |||
805 | wmb(); | ||
806 | |||
807 | return 0; | ||
808 | } | ||
809 | |||
810 | static void alchemy_gpic_resume(void) | ||
811 | { | ||
812 | void __iomem *base = (void __iomem *)KSEG1ADDR(AU1300_GPIC_PHYS_ADDR); | ||
813 | int i; | ||
814 | |||
815 | /* disable all first */ | ||
816 | __raw_writel(~0UL, base + AU1300_GPIC_IDIS + 0x0); | ||
817 | __raw_writel(~0UL, base + AU1300_GPIC_IDIS + 0x4); | ||
818 | __raw_writel(~0UL, base + AU1300_GPIC_IDIS + 0x8); | ||
819 | __raw_writel(~0UL, base + AU1300_GPIC_IDIS + 0xc); | ||
820 | wmb(); | ||
821 | |||
822 | /* restore pin/int-type configurations */ | ||
823 | base += AU1300_GPIC_PINCFG; | ||
824 | for (i = 0; i < ALCHEMY_GPIC_INT_NUM; i++) | ||
825 | __raw_writel(alchemy_gpic_pmdata[i + 5], base + (i << 2)); | ||
826 | wmb(); | ||
827 | |||
828 | /* restore misc register(s) */ | ||
829 | base = (void __iomem *)KSEG1ADDR(AU1300_GPIC_PHYS_ADDR); | ||
830 | __raw_writel(alchemy_gpic_pmdata[4], base + AU1300_GPIC_DMASEL); | ||
831 | wmb(); | ||
832 | |||
833 | /* finally restore masks */ | ||
834 | __raw_writel(alchemy_gpic_pmdata[0], base + AU1300_GPIC_IEN + 0x0); | ||
835 | __raw_writel(alchemy_gpic_pmdata[1], base + AU1300_GPIC_IEN + 0x4); | ||
836 | __raw_writel(alchemy_gpic_pmdata[2], base + AU1300_GPIC_IEN + 0x8); | ||
837 | __raw_writel(alchemy_gpic_pmdata[3], base + AU1300_GPIC_IEN + 0xc); | ||
838 | wmb(); | ||
839 | } | ||
840 | |||
841 | static struct syscore_ops alchemy_ic_pmops = { | ||
842 | .suspend = alchemy_ic_suspend, | ||
843 | .resume = alchemy_ic_resume, | ||
844 | }; | ||
845 | |||
846 | static struct syscore_ops alchemy_gpic_pmops = { | ||
847 | .suspend = alchemy_gpic_suspend, | ||
848 | .resume = alchemy_gpic_resume, | ||
849 | }; | ||
850 | |||
851 | /******************************************************************************/ | ||
852 | |||
853 | /* create chained handlers for the 4 IC requests to the MIPS IRQ ctrl */ | ||
854 | #define DISP(name, base, addr) \ | ||
855 | static void au1000_##name##_dispatch(unsigned int irq, struct irq_desc *d) \ | ||
856 | { \ | ||
857 | unsigned long r = __raw_readl((void __iomem *)KSEG1ADDR(addr)); \ | ||
858 | if (likely(r)) \ | ||
859 | generic_handle_irq(base + __ffs(r)); \ | ||
860 | else \ | ||
861 | spurious_interrupt(); \ | ||
862 | } | ||
863 | |||
864 | DISP(ic0r0, AU1000_INTC0_INT_BASE, AU1000_IC0_PHYS_ADDR + IC_REQ0INT) | ||
865 | DISP(ic0r1, AU1000_INTC0_INT_BASE, AU1000_IC0_PHYS_ADDR + IC_REQ1INT) | ||
866 | DISP(ic1r0, AU1000_INTC1_INT_BASE, AU1000_IC1_PHYS_ADDR + IC_REQ0INT) | ||
867 | DISP(ic1r1, AU1000_INTC1_INT_BASE, AU1000_IC1_PHYS_ADDR + IC_REQ1INT) | ||
868 | |||
869 | static void alchemy_gpic_dispatch(unsigned int irq, struct irq_desc *d) | ||
870 | { | ||
871 | int i = __raw_readl(AU1300_GPIC_ADDR + AU1300_GPIC_PRIENC); | ||
872 | generic_handle_irq(ALCHEMY_GPIC_INT_BASE + i); | ||
873 | } | ||
874 | |||
875 | /******************************************************************************/ | ||
876 | |||
877 | static void __init au1000_init_irq(struct alchemy_irqmap *map) | ||
525 | { | 878 | { |
526 | unsigned int bit, irq_nr; | 879 | unsigned int bit, irq_nr; |
527 | void __iomem *base; | 880 | void __iomem *base; |
528 | 881 | ||
529 | ic_init((void __iomem *)KSEG1ADDR(AU1000_IC0_PHYS_ADDR)); | 882 | ic_init((void __iomem *)KSEG1ADDR(AU1000_IC0_PHYS_ADDR)); |
530 | ic_init((void __iomem *)KSEG1ADDR(AU1000_IC1_PHYS_ADDR)); | 883 | ic_init((void __iomem *)KSEG1ADDR(AU1000_IC1_PHYS_ADDR)); |
884 | register_syscore_ops(&alchemy_ic_pmops); | ||
531 | mips_cpu_irq_init(); | 885 | mips_cpu_irq_init(); |
532 | 886 | ||
533 | /* register all 64 possible IC0+IC1 irq sources as type "none". | 887 | /* register all 64 possible IC0+IC1 irq sources as type "none". |
@@ -544,8 +898,8 @@ static void __init au1000_init_irq(struct au1xxx_irqmap *map) | |||
544 | /* | 898 | /* |
545 | * Initialize IC0, which is fixed per processor. | 899 | * Initialize IC0, which is fixed per processor. |
546 | */ | 900 | */ |
547 | while (map->im_irq != -1) { | 901 | while (map->irq != -1) { |
548 | irq_nr = map->im_irq; | 902 | irq_nr = map->irq; |
549 | 903 | ||
550 | if (irq_nr >= AU1000_INTC1_INT_BASE) { | 904 | if (irq_nr >= AU1000_INTC1_INT_BASE) { |
551 | bit = irq_nr - AU1000_INTC1_INT_BASE; | 905 | bit = irq_nr - AU1000_INTC1_INT_BASE; |
@@ -554,16 +908,61 @@ static void __init au1000_init_irq(struct au1xxx_irqmap *map) | |||
554 | bit = irq_nr - AU1000_INTC0_INT_BASE; | 908 | bit = irq_nr - AU1000_INTC0_INT_BASE; |
555 | base = (void __iomem *)KSEG1ADDR(AU1000_IC0_PHYS_ADDR); | 909 | base = (void __iomem *)KSEG1ADDR(AU1000_IC0_PHYS_ADDR); |
556 | } | 910 | } |
557 | if (map->im_request) | 911 | if (map->prio == 0) |
558 | __raw_writel(1 << bit, base + IC_ASSIGNSET); | 912 | __raw_writel(1 << bit, base + IC_ASSIGNSET); |
559 | 913 | ||
560 | au1x_ic_settype(irq_get_irq_data(irq_nr), map->im_type); | 914 | au1x_ic_settype(irq_get_irq_data(irq_nr), map->type); |
561 | ++map; | 915 | ++map; |
562 | } | 916 | } |
563 | 917 | ||
564 | set_c0_status(IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3); | 918 | irq_set_chained_handler(MIPS_CPU_IRQ_BASE + 2, au1000_ic0r0_dispatch); |
919 | irq_set_chained_handler(MIPS_CPU_IRQ_BASE + 3, au1000_ic0r1_dispatch); | ||
920 | irq_set_chained_handler(MIPS_CPU_IRQ_BASE + 4, au1000_ic1r0_dispatch); | ||
921 | irq_set_chained_handler(MIPS_CPU_IRQ_BASE + 5, au1000_ic1r1_dispatch); | ||
922 | } | ||
923 | |||
924 | static void __init alchemy_gpic_init_irq(const struct alchemy_irqmap *dints) | ||
925 | { | ||
926 | int i; | ||
927 | void __iomem *bank_base; | ||
928 | |||
929 | register_syscore_ops(&alchemy_gpic_pmops); | ||
930 | mips_cpu_irq_init(); | ||
931 | |||
932 | /* disable & ack all possible interrupt sources */ | ||
933 | for (i = 0; i < 4; i++) { | ||
934 | bank_base = AU1300_GPIC_ADDR + (i * 4); | ||
935 | __raw_writel(~0UL, bank_base + AU1300_GPIC_IDIS); | ||
936 | wmb(); | ||
937 | __raw_writel(~0UL, bank_base + AU1300_GPIC_IPEND); | ||
938 | wmb(); | ||
939 | } | ||
940 | |||
941 | /* register an irq_chip for them, with 2nd highest priority */ | ||
942 | for (i = ALCHEMY_GPIC_INT_BASE; i <= ALCHEMY_GPIC_INT_LAST; i++) { | ||
943 | au1300_set_irq_priority(i, 1); | ||
944 | au1300_gpic_settype(irq_get_irq_data(i), IRQ_TYPE_NONE); | ||
945 | } | ||
946 | |||
947 | /* setup known on-chip sources */ | ||
948 | while ((i = dints->irq) != -1) { | ||
949 | au1300_gpic_settype(irq_get_irq_data(i), dints->type); | ||
950 | au1300_set_irq_priority(i, dints->prio); | ||
951 | |||
952 | if (dints->internal) | ||
953 | au1300_pinfunc_to_dev(i - ALCHEMY_GPIC_INT_BASE); | ||
954 | |||
955 | dints++; | ||
956 | } | ||
957 | |||
958 | irq_set_chained_handler(MIPS_CPU_IRQ_BASE + 2, alchemy_gpic_dispatch); | ||
959 | irq_set_chained_handler(MIPS_CPU_IRQ_BASE + 3, alchemy_gpic_dispatch); | ||
960 | irq_set_chained_handler(MIPS_CPU_IRQ_BASE + 4, alchemy_gpic_dispatch); | ||
961 | irq_set_chained_handler(MIPS_CPU_IRQ_BASE + 5, alchemy_gpic_dispatch); | ||
565 | } | 962 | } |
566 | 963 | ||
964 | /******************************************************************************/ | ||
965 | |||
567 | void __init arch_init_irq(void) | 966 | void __init arch_init_irq(void) |
568 | { | 967 | { |
569 | switch (alchemy_get_cputype()) { | 968 | switch (alchemy_get_cputype()) { |
@@ -582,65 +981,17 @@ void __init arch_init_irq(void) | |||
582 | case ALCHEMY_CPU_AU1200: | 981 | case ALCHEMY_CPU_AU1200: |
583 | au1000_init_irq(au1200_irqmap); | 982 | au1000_init_irq(au1200_irqmap); |
584 | break; | 983 | break; |
984 | case ALCHEMY_CPU_AU1300: | ||
985 | alchemy_gpic_init_irq(au1300_irqmap); | ||
986 | break; | ||
987 | default: | ||
988 | pr_err("unknown Alchemy IRQ core\n"); | ||
989 | break; | ||
585 | } | 990 | } |
586 | } | 991 | } |
587 | 992 | ||
588 | 993 | asmlinkage void plat_irq_dispatch(void) | |
589 | static unsigned long alchemy_ic_pmdata[7 * 2]; | ||
590 | |||
591 | static inline void alchemy_ic_suspend_one(void __iomem *base, unsigned long *d) | ||
592 | { | ||
593 | d[0] = __raw_readl(base + IC_CFG0RD); | ||
594 | d[1] = __raw_readl(base + IC_CFG1RD); | ||
595 | d[2] = __raw_readl(base + IC_CFG2RD); | ||
596 | d[3] = __raw_readl(base + IC_SRCRD); | ||
597 | d[4] = __raw_readl(base + IC_ASSIGNRD); | ||
598 | d[5] = __raw_readl(base + IC_WAKERD); | ||
599 | d[6] = __raw_readl(base + IC_MASKRD); | ||
600 | ic_init(base); /* shut it up too while at it */ | ||
601 | } | ||
602 | |||
603 | static inline void alchemy_ic_resume_one(void __iomem *base, unsigned long *d) | ||
604 | { | ||
605 | ic_init(base); | ||
606 | |||
607 | __raw_writel(d[0], base + IC_CFG0SET); | ||
608 | __raw_writel(d[1], base + IC_CFG1SET); | ||
609 | __raw_writel(d[2], base + IC_CFG2SET); | ||
610 | __raw_writel(d[3], base + IC_SRCSET); | ||
611 | __raw_writel(d[4], base + IC_ASSIGNSET); | ||
612 | __raw_writel(d[5], base + IC_WAKESET); | ||
613 | wmb(); | ||
614 | |||
615 | __raw_writel(d[6], base + IC_MASKSET); | ||
616 | wmb(); | ||
617 | } | ||
618 | |||
619 | static int alchemy_ic_suspend(void) | ||
620 | { | ||
621 | alchemy_ic_suspend_one((void __iomem *)KSEG1ADDR(AU1000_IC0_PHYS_ADDR), | ||
622 | alchemy_ic_pmdata); | ||
623 | alchemy_ic_suspend_one((void __iomem *)KSEG1ADDR(AU1000_IC1_PHYS_ADDR), | ||
624 | &alchemy_ic_pmdata[7]); | ||
625 | return 0; | ||
626 | } | ||
627 | |||
628 | static void alchemy_ic_resume(void) | ||
629 | { | ||
630 | alchemy_ic_resume_one((void __iomem *)KSEG1ADDR(AU1000_IC1_PHYS_ADDR), | ||
631 | &alchemy_ic_pmdata[7]); | ||
632 | alchemy_ic_resume_one((void __iomem *)KSEG1ADDR(AU1000_IC0_PHYS_ADDR), | ||
633 | alchemy_ic_pmdata); | ||
634 | } | ||
635 | |||
636 | static struct syscore_ops alchemy_ic_syscore_ops = { | ||
637 | .suspend = alchemy_ic_suspend, | ||
638 | .resume = alchemy_ic_resume, | ||
639 | }; | ||
640 | |||
641 | static int __init alchemy_ic_pm_init(void) | ||
642 | { | 994 | { |
643 | register_syscore_ops(&alchemy_ic_syscore_ops); | 995 | unsigned long r = (read_c0_status() & read_c0_cause()) >> 8; |
644 | return 0; | 996 | do_IRQ(MIPS_CPU_IRQ_BASE + __ffs(r & 0xff)); |
645 | } | 997 | } |
646 | device_initcall(alchemy_ic_pm_init); | ||
diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c index c8e5d72a5826..95cb9113b12c 100644 --- a/arch/mips/alchemy/common/platform.c +++ b/arch/mips/alchemy/common/platform.c | |||
@@ -82,6 +82,12 @@ static struct plat_serial8250_port au1x00_uart_data[][4] __initdata = { | |||
82 | PORT(AU1000_UART0_PHYS_ADDR, AU1200_UART0_INT), | 82 | PORT(AU1000_UART0_PHYS_ADDR, AU1200_UART0_INT), |
83 | PORT(AU1000_UART1_PHYS_ADDR, AU1200_UART1_INT), | 83 | PORT(AU1000_UART1_PHYS_ADDR, AU1200_UART1_INT), |
84 | }, | 84 | }, |
85 | [ALCHEMY_CPU_AU1300] = { | ||
86 | PORT(AU1300_UART0_PHYS_ADDR, AU1300_UART0_INT), | ||
87 | PORT(AU1300_UART1_PHYS_ADDR, AU1300_UART1_INT), | ||
88 | PORT(AU1300_UART2_PHYS_ADDR, AU1300_UART2_INT), | ||
89 | PORT(AU1300_UART3_PHYS_ADDR, AU1300_UART3_INT), | ||
90 | }, | ||
85 | }; | 91 | }; |
86 | 92 | ||
87 | static struct platform_device au1xx0_uart_device = { | 93 | static struct platform_device au1xx0_uart_device = { |
@@ -122,10 +128,12 @@ static unsigned long alchemy_ohci_data[][2] __initdata = { | |||
122 | [ALCHEMY_CPU_AU1100] = { AU1000_USB_OHCI_PHYS_ADDR, AU1100_USB_HOST_INT }, | 128 | [ALCHEMY_CPU_AU1100] = { AU1000_USB_OHCI_PHYS_ADDR, AU1100_USB_HOST_INT }, |
123 | [ALCHEMY_CPU_AU1550] = { AU1550_USB_OHCI_PHYS_ADDR, AU1550_USB_HOST_INT }, | 129 | [ALCHEMY_CPU_AU1550] = { AU1550_USB_OHCI_PHYS_ADDR, AU1550_USB_HOST_INT }, |
124 | [ALCHEMY_CPU_AU1200] = { AU1200_USB_OHCI_PHYS_ADDR, AU1200_USB_INT }, | 130 | [ALCHEMY_CPU_AU1200] = { AU1200_USB_OHCI_PHYS_ADDR, AU1200_USB_INT }, |
131 | [ALCHEMY_CPU_AU1300] = { AU1300_USB_OHCI0_PHYS_ADDR, AU1300_USB_INT }, | ||
125 | }; | 132 | }; |
126 | 133 | ||
127 | static unsigned long alchemy_ehci_data[][2] __initdata = { | 134 | static unsigned long alchemy_ehci_data[][2] __initdata = { |
128 | [ALCHEMY_CPU_AU1200] = { AU1200_USB_EHCI_PHYS_ADDR, AU1200_USB_INT }, | 135 | [ALCHEMY_CPU_AU1200] = { AU1200_USB_EHCI_PHYS_ADDR, AU1200_USB_INT }, |
136 | [ALCHEMY_CPU_AU1300] = { AU1300_USB_EHCI_PHYS_ADDR, AU1300_USB_INT }, | ||
129 | }; | 137 | }; |
130 | 138 | ||
131 | static int __init _new_usbres(struct resource **r, struct platform_device **d) | 139 | static int __init _new_usbres(struct resource **r, struct platform_device **d) |
@@ -169,8 +177,8 @@ static void __init alchemy_setup_usb(int ctype) | |||
169 | printk(KERN_INFO "Alchemy USB: cannot add OHCI0\n"); | 177 | printk(KERN_INFO "Alchemy USB: cannot add OHCI0\n"); |
170 | 178 | ||
171 | 179 | ||
172 | /* setup EHCI0: Au1200 */ | 180 | /* setup EHCI0: Au1200/Au1300 */ |
173 | if (ctype == ALCHEMY_CPU_AU1200) { | 181 | if ((ctype == ALCHEMY_CPU_AU1200) || (ctype == ALCHEMY_CPU_AU1300)) { |
174 | if (_new_usbres(&res, &pdev)) | 182 | if (_new_usbres(&res, &pdev)) |
175 | return; | 183 | return; |
176 | 184 | ||
@@ -187,6 +195,25 @@ static void __init alchemy_setup_usb(int ctype) | |||
187 | if (platform_device_register(pdev)) | 195 | if (platform_device_register(pdev)) |
188 | printk(KERN_INFO "Alchemy USB: cannot add EHCI0\n"); | 196 | printk(KERN_INFO "Alchemy USB: cannot add EHCI0\n"); |
189 | } | 197 | } |
198 | |||
199 | /* Au1300: OHCI1 */ | ||
200 | if (ctype == ALCHEMY_CPU_AU1300) { | ||
201 | if (_new_usbres(&res, &pdev)) | ||
202 | return; | ||
203 | |||
204 | res[0].start = AU1300_USB_OHCI1_PHYS_ADDR; | ||
205 | res[0].end = res[0].start + 0x100 - 1; | ||
206 | res[0].flags = IORESOURCE_MEM; | ||
207 | res[1].start = AU1300_USB_INT; | ||
208 | res[1].end = res[1].start; | ||
209 | res[1].flags = IORESOURCE_IRQ; | ||
210 | pdev->name = "au1xxx-ohci"; | ||
211 | pdev->id = 1; | ||
212 | pdev->dev.dma_mask = &alchemy_ohci_dmamask; | ||
213 | |||
214 | if (platform_device_register(pdev)) | ||
215 | printk(KERN_INFO "Alchemy USB: cannot add OHCI1\n"); | ||
216 | } | ||
190 | } | 217 | } |
191 | 218 | ||
192 | /* Macro to help defining the Ethernet MAC resources */ | 219 | /* Macro to help defining the Ethernet MAC resources */ |
diff --git a/arch/mips/alchemy/common/power.c b/arch/mips/alchemy/common/power.c index bdd6651e9a4f..0c7fce2a3c12 100644 --- a/arch/mips/alchemy/common/power.c +++ b/arch/mips/alchemy/common/power.c | |||
@@ -126,6 +126,9 @@ void au_sleep(void) | |||
126 | case ALCHEMY_CPU_AU1200: | 126 | case ALCHEMY_CPU_AU1200: |
127 | alchemy_sleep_au1550(); | 127 | alchemy_sleep_au1550(); |
128 | break; | 128 | break; |
129 | case ALCHEMY_CPU_AU1300: | ||
130 | alchemy_sleep_au1300(); | ||
131 | break; | ||
129 | } | 132 | } |
130 | 133 | ||
131 | restore_core_regs(); | 134 | restore_core_regs(); |
diff --git a/arch/mips/alchemy/common/sleeper.S b/arch/mips/alchemy/common/sleeper.S index 77f3c743b716..c7bcc7e5c822 100644 --- a/arch/mips/alchemy/common/sleeper.S +++ b/arch/mips/alchemy/common/sleeper.S | |||
@@ -153,6 +153,79 @@ LEAF(alchemy_sleep_au1550) | |||
153 | 153 | ||
154 | END(alchemy_sleep_au1550) | 154 | END(alchemy_sleep_au1550) |
155 | 155 | ||
156 | /* sleepcode for Au1300 memory controller type */ | ||
157 | LEAF(alchemy_sleep_au1300) | ||
158 | |||
159 | SETUP_SLEEP | ||
160 | |||
161 | /* cache following instructions, as memory gets put to sleep */ | ||
162 | la t0, 2f | ||
163 | la t1, 4f | ||
164 | subu t2, t1, t0 | ||
165 | |||
166 | .set mips3 | ||
167 | |||
168 | 1: cache 0x14, 0(t0) | ||
169 | subu t2, t2, 32 | ||
170 | bgez t2, 1b | ||
171 | addu t0, t0, 32 | ||
172 | |||
173 | .set mips0 | ||
174 | |||
175 | 2: lui a0, 0xb400 /* mem_xxx */ | ||
176 | |||
177 | /* disable all ports in mem_sdportcfga */ | ||
178 | sw zero, 0x868(a0) /* mem_sdportcfga */ | ||
179 | sync | ||
180 | |||
181 | /* disable ODT */ | ||
182 | li t0, 0x03010000 | ||
183 | sw t0, 0x08d8(a0) /* mem_sdcmd0 */ | ||
184 | sw t0, 0x08dc(a0) /* mem_sdcmd1 */ | ||
185 | sync | ||
186 | |||
187 | /* precharge */ | ||
188 | li t0, 0x23000400 | ||
189 | sw t0, 0x08dc(a0) /* mem_sdcmd1 */ | ||
190 | sw t0, 0x08d8(a0) /* mem_sdcmd0 */ | ||
191 | sync | ||
192 | |||
193 | /* auto refresh */ | ||
194 | sw zero, 0x08c8(a0) /* mem_sdautoref */ | ||
195 | sync | ||
196 | |||
197 | /* block access to the DDR */ | ||
198 | lw t0, 0x0848(a0) /* mem_sdconfigb */ | ||
199 | li t1, (1 << 7 | 0x3F) | ||
200 | or t0, t0, t1 | ||
201 | sw t0, 0x0848(a0) /* mem_sdconfigb */ | ||
202 | sync | ||
203 | |||
204 | /* issue the Self Refresh command */ | ||
205 | li t0, 0x10000000 | ||
206 | sw t0, 0x08dc(a0) /* mem_sdcmd1 */ | ||
207 | sw t0, 0x08d8(a0) /* mem_sdcmd0 */ | ||
208 | sync | ||
209 | |||
210 | /* wait for sdram to enter self-refresh mode */ | ||
211 | lui t0, 0x0300 | ||
212 | 3: lw t1, 0x0850(a0) /* mem_sdstat */ | ||
213 | and t2, t1, t0 | ||
214 | bne t2, t0, 3b | ||
215 | nop | ||
216 | |||
217 | /* disable SDRAM clocks */ | ||
218 | li t0, ~(3<<28) | ||
219 | lw t1, 0x0840(a0) /* mem_sdconfiga */ | ||
220 | and t1, t1, t0 /* clear CE[1:0] */ | ||
221 | sw t1, 0x0840(a0) /* mem_sdconfiga */ | ||
222 | sync | ||
223 | |||
224 | DO_SLEEP | ||
225 | 4: | ||
226 | |||
227 | END(alchemy_sleep_au1300) | ||
228 | |||
156 | 229 | ||
157 | /* This is where we return upon wakeup. | 230 | /* This is where we return upon wakeup. |
158 | * Reload all of the registers and return. | 231 | * Reload all of the registers and return. |
diff --git a/arch/mips/alchemy/common/time.c b/arch/mips/alchemy/common/time.c index d5da6adbf634..7da4d0081487 100644 --- a/arch/mips/alchemy/common/time.c +++ b/arch/mips/alchemy/common/time.c | |||
@@ -92,7 +92,7 @@ static struct clock_event_device au1x_rtcmatch2_clockdev = { | |||
92 | 92 | ||
93 | static struct irqaction au1x_rtcmatch2_irqaction = { | 93 | static struct irqaction au1x_rtcmatch2_irqaction = { |
94 | .handler = au1x_rtcmatch2_irq, | 94 | .handler = au1x_rtcmatch2_irq, |
95 | .flags = IRQF_DISABLED | IRQF_TIMER, | 95 | .flags = IRQF_TIMER, |
96 | .name = "timer", | 96 | .name = "timer", |
97 | .dev_id = &au1x_rtcmatch2_clockdev, | 97 | .dev_id = &au1x_rtcmatch2_clockdev, |
98 | }; | 98 | }; |
@@ -178,6 +178,7 @@ static int alchemy_m2inttab[] __initdata = { | |||
178 | AU1100_RTC_MATCH2_INT, | 178 | AU1100_RTC_MATCH2_INT, |
179 | AU1550_RTC_MATCH2_INT, | 179 | AU1550_RTC_MATCH2_INT, |
180 | AU1200_RTC_MATCH2_INT, | 180 | AU1200_RTC_MATCH2_INT, |
181 | AU1300_RTC_MATCH2_INT, | ||
181 | }; | 182 | }; |
182 | 183 | ||
183 | void __init plat_time_init(void) | 184 | void __init plat_time_init(void) |
diff --git a/arch/mips/alchemy/common/vss.c b/arch/mips/alchemy/common/vss.c new file mode 100644 index 000000000000..d23b1444d365 --- /dev/null +++ b/arch/mips/alchemy/common/vss.c | |||
@@ -0,0 +1,84 @@ | |||
1 | /* | ||
2 | * Au1300 media block power gating (VSS) | ||
3 | * | ||
4 | * This is a stop-gap solution until I have the clock framework integration | ||
5 | * ready. This stuff here really must be handled transparently when clocks | ||
6 | * for various media blocks are enabled/disabled. | ||
7 | */ | ||
8 | |||
9 | #include <linux/module.h> | ||
10 | #include <linux/spinlock.h> | ||
11 | #include <asm/mach-au1x00/au1000.h> | ||
12 | |||
13 | #define VSS_GATE 0x00 /* gate wait timers */ | ||
14 | #define VSS_CLKRST 0x04 /* clock/block control */ | ||
15 | #define VSS_FTR 0x08 /* footers */ | ||
16 | |||
17 | #define VSS_ADDR(blk) (KSEG1ADDR(AU1300_VSS_PHYS_ADDR) + (blk * 0x0c)) | ||
18 | |||
19 | static DEFINE_SPINLOCK(au1300_vss_lock); | ||
20 | |||
21 | /* enable a block as outlined in the databook */ | ||
22 | static inline void __enable_block(int block) | ||
23 | { | ||
24 | void __iomem *base = (void __iomem *)VSS_ADDR(block); | ||
25 | |||
26 | __raw_writel(3, base + VSS_CLKRST); /* enable clock, assert reset */ | ||
27 | wmb(); | ||
28 | |||
29 | __raw_writel(0x01fffffe, base + VSS_GATE); /* maximum setup time */ | ||
30 | wmb(); | ||
31 | |||
32 | /* enable footers in sequence */ | ||
33 | __raw_writel(0x01, base + VSS_FTR); | ||
34 | wmb(); | ||
35 | __raw_writel(0x03, base + VSS_FTR); | ||
36 | wmb(); | ||
37 | __raw_writel(0x07, base + VSS_FTR); | ||
38 | wmb(); | ||
39 | __raw_writel(0x0f, base + VSS_FTR); | ||
40 | wmb(); | ||
41 | |||
42 | __raw_writel(0x01ffffff, base + VSS_GATE); /* start FSM too */ | ||
43 | wmb(); | ||
44 | |||
45 | __raw_writel(2, base + VSS_CLKRST); /* deassert reset */ | ||
46 | wmb(); | ||
47 | |||
48 | __raw_writel(0x1f, base + VSS_FTR); /* enable isolation cells */ | ||
49 | wmb(); | ||
50 | } | ||
51 | |||
52 | /* disable a block as outlined in the databook */ | ||
53 | static inline void __disable_block(int block) | ||
54 | { | ||
55 | void __iomem *base = (void __iomem *)VSS_ADDR(block); | ||
56 | |||
57 | __raw_writel(0x0f, base + VSS_FTR); /* disable isolation cells */ | ||
58 | wmb(); | ||
59 | __raw_writel(0, base + VSS_GATE); /* disable FSM */ | ||
60 | wmb(); | ||
61 | __raw_writel(3, base + VSS_CLKRST); /* assert reset */ | ||
62 | wmb(); | ||
63 | __raw_writel(1, base + VSS_CLKRST); /* disable clock */ | ||
64 | wmb(); | ||
65 | __raw_writel(0, base + VSS_FTR); /* disable all footers */ | ||
66 | wmb(); | ||
67 | } | ||
68 | |||
69 | void au1300_vss_block_control(int block, int enable) | ||
70 | { | ||
71 | unsigned long flags; | ||
72 | |||
73 | if (alchemy_get_cputype() != ALCHEMY_CPU_AU1300) | ||
74 | return; | ||
75 | |||
76 | /* only one block at a time */ | ||
77 | spin_lock_irqsave(&au1300_vss_lock, flags); | ||
78 | if (enable) | ||
79 | __enable_block(block); | ||
80 | else | ||
81 | __disable_block(block); | ||
82 | spin_unlock_irqrestore(&au1300_vss_lock, flags); | ||
83 | } | ||
84 | EXPORT_SYMBOL_GPL(au1300_vss_block_control); | ||
diff --git a/arch/mips/alchemy/devboards/Makefile b/arch/mips/alchemy/devboards/Makefile index 826449c817c3..3c37fb303364 100644 --- a/arch/mips/alchemy/devboards/Makefile +++ b/arch/mips/alchemy/devboards/Makefile | |||
@@ -4,15 +4,10 @@ | |||
4 | 4 | ||
5 | obj-y += prom.o bcsr.o platform.o | 5 | obj-y += prom.o bcsr.o platform.o |
6 | obj-$(CONFIG_PM) += pm.o | 6 | obj-$(CONFIG_PM) += pm.o |
7 | obj-$(CONFIG_MIPS_PB1000) += pb1000/ | 7 | obj-$(CONFIG_MIPS_PB1100) += pb1100.o |
8 | obj-$(CONFIG_MIPS_PB1100) += pb1100/ | 8 | obj-$(CONFIG_MIPS_PB1500) += pb1500.o |
9 | obj-$(CONFIG_MIPS_PB1200) += pb1200/ | 9 | obj-$(CONFIG_MIPS_PB1550) += pb1550.o |
10 | obj-$(CONFIG_MIPS_PB1500) += pb1500/ | 10 | obj-$(CONFIG_MIPS_DB1000) += db1000.o |
11 | obj-$(CONFIG_MIPS_PB1550) += pb1550/ | 11 | obj-$(CONFIG_MIPS_DB1200) += db1200.o |
12 | obj-$(CONFIG_MIPS_DB1000) += db1x00/ | 12 | obj-$(CONFIG_MIPS_DB1300) += db1300.o |
13 | obj-$(CONFIG_MIPS_DB1100) += db1x00/ | 13 | obj-$(CONFIG_MIPS_DB1550) += db1550.o |
14 | obj-$(CONFIG_MIPS_DB1200) += db1200/ | ||
15 | obj-$(CONFIG_MIPS_DB1500) += db1x00/ | ||
16 | obj-$(CONFIG_MIPS_DB1550) += db1x00/ | ||
17 | obj-$(CONFIG_MIPS_BOSPORUS) += db1x00/ | ||
18 | obj-$(CONFIG_MIPS_MIRAGE) += db1x00/ | ||
diff --git a/arch/mips/alchemy/devboards/bcsr.c b/arch/mips/alchemy/devboards/bcsr.c index 463d2c4d9441..1e83ce2e1147 100644 --- a/arch/mips/alchemy/devboards/bcsr.c +++ b/arch/mips/alchemy/devboards/bcsr.c | |||
@@ -97,14 +97,9 @@ static void bcsr_csc_handler(unsigned int irq, struct irq_desc *d) | |||
97 | enable_irq(irq); | 97 | enable_irq(irq); |
98 | } | 98 | } |
99 | 99 | ||
100 | /* NOTE: both the enable and mask bits must be cleared, otherwise the | ||
101 | * CPLD generates tons of spurious interrupts (at least on my DB1200). | ||
102 | * -- mlau | ||
103 | */ | ||
104 | static void bcsr_irq_mask(struct irq_data *d) | 100 | static void bcsr_irq_mask(struct irq_data *d) |
105 | { | 101 | { |
106 | unsigned short v = 1 << (d->irq - bcsr_csc_base); | 102 | unsigned short v = 1 << (d->irq - bcsr_csc_base); |
107 | __raw_writew(v, bcsr_virt + BCSR_REG_INTCLR); | ||
108 | __raw_writew(v, bcsr_virt + BCSR_REG_MASKCLR); | 103 | __raw_writew(v, bcsr_virt + BCSR_REG_MASKCLR); |
109 | wmb(); | 104 | wmb(); |
110 | } | 105 | } |
@@ -112,7 +107,6 @@ static void bcsr_irq_mask(struct irq_data *d) | |||
112 | static void bcsr_irq_maskack(struct irq_data *d) | 107 | static void bcsr_irq_maskack(struct irq_data *d) |
113 | { | 108 | { |
114 | unsigned short v = 1 << (d->irq - bcsr_csc_base); | 109 | unsigned short v = 1 << (d->irq - bcsr_csc_base); |
115 | __raw_writew(v, bcsr_virt + BCSR_REG_INTCLR); | ||
116 | __raw_writew(v, bcsr_virt + BCSR_REG_MASKCLR); | 110 | __raw_writew(v, bcsr_virt + BCSR_REG_MASKCLR); |
117 | __raw_writew(v, bcsr_virt + BCSR_REG_INTSTAT); /* ack */ | 111 | __raw_writew(v, bcsr_virt + BCSR_REG_INTSTAT); /* ack */ |
118 | wmb(); | 112 | wmb(); |
@@ -121,7 +115,6 @@ static void bcsr_irq_maskack(struct irq_data *d) | |||
121 | static void bcsr_irq_unmask(struct irq_data *d) | 115 | static void bcsr_irq_unmask(struct irq_data *d) |
122 | { | 116 | { |
123 | unsigned short v = 1 << (d->irq - bcsr_csc_base); | 117 | unsigned short v = 1 << (d->irq - bcsr_csc_base); |
124 | __raw_writew(v, bcsr_virt + BCSR_REG_INTSET); | ||
125 | __raw_writew(v, bcsr_virt + BCSR_REG_MASKSET); | 118 | __raw_writew(v, bcsr_virt + BCSR_REG_MASKSET); |
126 | wmb(); | 119 | wmb(); |
127 | } | 120 | } |
@@ -137,9 +130,9 @@ void __init bcsr_init_irq(int csc_start, int csc_end, int hook_irq) | |||
137 | { | 130 | { |
138 | unsigned int irq; | 131 | unsigned int irq; |
139 | 132 | ||
140 | /* mask & disable & ack all */ | 133 | /* mask & enable & ack all */ |
141 | __raw_writew(0xffff, bcsr_virt + BCSR_REG_INTCLR); | ||
142 | __raw_writew(0xffff, bcsr_virt + BCSR_REG_MASKCLR); | 134 | __raw_writew(0xffff, bcsr_virt + BCSR_REG_MASKCLR); |
135 | __raw_writew(0xffff, bcsr_virt + BCSR_REG_INTSET); | ||
143 | __raw_writew(0xffff, bcsr_virt + BCSR_REG_INTSTAT); | 136 | __raw_writew(0xffff, bcsr_virt + BCSR_REG_INTSTAT); |
144 | wmb(); | 137 | wmb(); |
145 | 138 | ||
diff --git a/arch/mips/alchemy/devboards/db1000.c b/arch/mips/alchemy/devboards/db1000.c new file mode 100644 index 000000000000..1b81dbf6b804 --- /dev/null +++ b/arch/mips/alchemy/devboards/db1000.c | |||
@@ -0,0 +1,565 @@ | |||
1 | /* | ||
2 | * DBAu1000/1500/1100 board support | ||
3 | * | ||
4 | * Copyright 2000, 2008 MontaVista Software Inc. | ||
5 | * Author: MontaVista Software, Inc. <source@mvista.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
20 | */ | ||
21 | |||
22 | #include <linux/dma-mapping.h> | ||
23 | #include <linux/gpio.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <linux/interrupt.h> | ||
26 | #include <linux/leds.h> | ||
27 | #include <linux/mmc/host.h> | ||
28 | #include <linux/module.h> | ||
29 | #include <linux/platform_device.h> | ||
30 | #include <linux/pm.h> | ||
31 | #include <linux/spi/spi.h> | ||
32 | #include <linux/spi/spi_gpio.h> | ||
33 | #include <linux/spi/ads7846.h> | ||
34 | #include <asm/mach-au1x00/au1000.h> | ||
35 | #include <asm/mach-au1x00/au1000_dma.h> | ||
36 | #include <asm/mach-au1x00/au1100_mmc.h> | ||
37 | #include <asm/mach-db1x00/bcsr.h> | ||
38 | #include <asm/reboot.h> | ||
39 | #include <prom.h> | ||
40 | #include "platform.h" | ||
41 | |||
42 | #define F_SWAPPED (bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1000_SWAPBOOT) | ||
43 | |||
44 | struct pci_dev; | ||
45 | |||
46 | static const char *board_type_str(void) | ||
47 | { | ||
48 | switch (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI))) { | ||
49 | case BCSR_WHOAMI_DB1000: | ||
50 | return "DB1000"; | ||
51 | case BCSR_WHOAMI_DB1500: | ||
52 | return "DB1500"; | ||
53 | case BCSR_WHOAMI_DB1100: | ||
54 | return "DB1100"; | ||
55 | default: | ||
56 | return "(unknown)"; | ||
57 | } | ||
58 | } | ||
59 | |||
60 | const char *get_system_type(void) | ||
61 | { | ||
62 | return board_type_str(); | ||
63 | } | ||
64 | |||
65 | void __init board_setup(void) | ||
66 | { | ||
67 | /* initialize board register space */ | ||
68 | bcsr_init(DB1000_BCSR_PHYS_ADDR, | ||
69 | DB1000_BCSR_PHYS_ADDR + DB1000_BCSR_HEXLED_OFS); | ||
70 | |||
71 | printk(KERN_INFO "AMD Alchemy %s Board\n", board_type_str()); | ||
72 | } | ||
73 | |||
74 | |||
75 | static int db1500_map_pci_irq(const struct pci_dev *d, u8 slot, u8 pin) | ||
76 | { | ||
77 | if ((slot < 12) || (slot > 13) || pin == 0) | ||
78 | return -1; | ||
79 | if (slot == 12) | ||
80 | return (pin == 1) ? AU1500_PCI_INTA : 0xff; | ||
81 | if (slot == 13) { | ||
82 | switch (pin) { | ||
83 | case 1: return AU1500_PCI_INTA; | ||
84 | case 2: return AU1500_PCI_INTB; | ||
85 | case 3: return AU1500_PCI_INTC; | ||
86 | case 4: return AU1500_PCI_INTD; | ||
87 | } | ||
88 | } | ||
89 | return -1; | ||
90 | } | ||
91 | |||
92 | static struct resource alchemy_pci_host_res[] = { | ||
93 | [0] = { | ||
94 | .start = AU1500_PCI_PHYS_ADDR, | ||
95 | .end = AU1500_PCI_PHYS_ADDR + 0xfff, | ||
96 | .flags = IORESOURCE_MEM, | ||
97 | }, | ||
98 | }; | ||
99 | |||
100 | static struct alchemy_pci_platdata db1500_pci_pd = { | ||
101 | .board_map_irq = db1500_map_pci_irq, | ||
102 | }; | ||
103 | |||
104 | static struct platform_device db1500_pci_host_dev = { | ||
105 | .dev.platform_data = &db1500_pci_pd, | ||
106 | .name = "alchemy-pci", | ||
107 | .id = 0, | ||
108 | .num_resources = ARRAY_SIZE(alchemy_pci_host_res), | ||
109 | .resource = alchemy_pci_host_res, | ||
110 | }; | ||
111 | |||
112 | static int __init db1500_pci_init(void) | ||
113 | { | ||
114 | if (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)) == BCSR_WHOAMI_DB1500) | ||
115 | return platform_device_register(&db1500_pci_host_dev); | ||
116 | return 0; | ||
117 | } | ||
118 | /* must be arch_initcall; MIPS PCI scans busses in a subsys_initcall */ | ||
119 | arch_initcall(db1500_pci_init); | ||
120 | |||
121 | |||
122 | static struct resource au1100_lcd_resources[] = { | ||
123 | [0] = { | ||
124 | .start = AU1100_LCD_PHYS_ADDR, | ||
125 | .end = AU1100_LCD_PHYS_ADDR + 0x800 - 1, | ||
126 | .flags = IORESOURCE_MEM, | ||
127 | }, | ||
128 | [1] = { | ||
129 | .start = AU1100_LCD_INT, | ||
130 | .end = AU1100_LCD_INT, | ||
131 | .flags = IORESOURCE_IRQ, | ||
132 | } | ||
133 | }; | ||
134 | |||
135 | static u64 au1100_lcd_dmamask = DMA_BIT_MASK(32); | ||
136 | |||
137 | static struct platform_device au1100_lcd_device = { | ||
138 | .name = "au1100-lcd", | ||
139 | .id = 0, | ||
140 | .dev = { | ||
141 | .dma_mask = &au1100_lcd_dmamask, | ||
142 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
143 | }, | ||
144 | .num_resources = ARRAY_SIZE(au1100_lcd_resources), | ||
145 | .resource = au1100_lcd_resources, | ||
146 | }; | ||
147 | |||
148 | static struct resource alchemy_ac97c_res[] = { | ||
149 | [0] = { | ||
150 | .start = AU1000_AC97_PHYS_ADDR, | ||
151 | .end = AU1000_AC97_PHYS_ADDR + 0xfff, | ||
152 | .flags = IORESOURCE_MEM, | ||
153 | }, | ||
154 | [1] = { | ||
155 | .start = DMA_ID_AC97C_TX, | ||
156 | .end = DMA_ID_AC97C_TX, | ||
157 | .flags = IORESOURCE_DMA, | ||
158 | }, | ||
159 | [2] = { | ||
160 | .start = DMA_ID_AC97C_RX, | ||
161 | .end = DMA_ID_AC97C_RX, | ||
162 | .flags = IORESOURCE_DMA, | ||
163 | }, | ||
164 | }; | ||
165 | |||
166 | static struct platform_device alchemy_ac97c_dev = { | ||
167 | .name = "alchemy-ac97c", | ||
168 | .id = -1, | ||
169 | .resource = alchemy_ac97c_res, | ||
170 | .num_resources = ARRAY_SIZE(alchemy_ac97c_res), | ||
171 | }; | ||
172 | |||
173 | static struct platform_device alchemy_ac97c_dma_dev = { | ||
174 | .name = "alchemy-pcm-dma", | ||
175 | .id = 0, | ||
176 | }; | ||
177 | |||
178 | static struct platform_device db1x00_codec_dev = { | ||
179 | .name = "ac97-codec", | ||
180 | .id = -1, | ||
181 | }; | ||
182 | |||
183 | static struct platform_device db1x00_audio_dev = { | ||
184 | .name = "db1000-audio", | ||
185 | }; | ||
186 | |||
187 | /******************************************************************************/ | ||
188 | |||
189 | static irqreturn_t db1100_mmc_cd(int irq, void *ptr) | ||
190 | { | ||
191 | void (*mmc_cd)(struct mmc_host *, unsigned long); | ||
192 | /* link against CONFIG_MMC=m */ | ||
193 | mmc_cd = symbol_get(mmc_detect_change); | ||
194 | mmc_cd(ptr, msecs_to_jiffies(500)); | ||
195 | symbol_put(mmc_detect_change); | ||
196 | |||
197 | return IRQ_HANDLED; | ||
198 | } | ||
199 | |||
200 | static int db1100_mmc_cd_setup(void *mmc_host, int en) | ||
201 | { | ||
202 | int ret = 0; | ||
203 | |||
204 | if (en) { | ||
205 | irq_set_irq_type(AU1100_GPIO19_INT, IRQ_TYPE_EDGE_BOTH); | ||
206 | ret = request_irq(AU1100_GPIO19_INT, db1100_mmc_cd, 0, | ||
207 | "sd0_cd", mmc_host); | ||
208 | } else | ||
209 | free_irq(AU1100_GPIO19_INT, mmc_host); | ||
210 | return ret; | ||
211 | } | ||
212 | |||
213 | static int db1100_mmc1_cd_setup(void *mmc_host, int en) | ||
214 | { | ||
215 | int ret = 0; | ||
216 | |||
217 | if (en) { | ||
218 | irq_set_irq_type(AU1100_GPIO20_INT, IRQ_TYPE_EDGE_BOTH); | ||
219 | ret = request_irq(AU1100_GPIO20_INT, db1100_mmc_cd, 0, | ||
220 | "sd1_cd", mmc_host); | ||
221 | } else | ||
222 | free_irq(AU1100_GPIO20_INT, mmc_host); | ||
223 | return ret; | ||
224 | } | ||
225 | |||
226 | static int db1100_mmc_card_readonly(void *mmc_host) | ||
227 | { | ||
228 | /* testing suggests that this bit is inverted */ | ||
229 | return (bcsr_read(BCSR_STATUS) & BCSR_STATUS_SD0WP) ? 0 : 1; | ||
230 | } | ||
231 | |||
232 | static int db1100_mmc_card_inserted(void *mmc_host) | ||
233 | { | ||
234 | return !alchemy_gpio_get_value(19); | ||
235 | } | ||
236 | |||
237 | static void db1100_mmc_set_power(void *mmc_host, int state) | ||
238 | { | ||
239 | if (state) { | ||
240 | bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_SD0PWR); | ||
241 | msleep(400); /* stabilization time */ | ||
242 | } else | ||
243 | bcsr_mod(BCSR_BOARD, BCSR_BOARD_SD0PWR, 0); | ||
244 | } | ||
245 | |||
246 | static void db1100_mmcled_set(struct led_classdev *led, enum led_brightness b) | ||
247 | { | ||
248 | if (b != LED_OFF) | ||
249 | bcsr_mod(BCSR_LEDS, BCSR_LEDS_LED0, 0); | ||
250 | else | ||
251 | bcsr_mod(BCSR_LEDS, 0, BCSR_LEDS_LED0); | ||
252 | } | ||
253 | |||
254 | static struct led_classdev db1100_mmc_led = { | ||
255 | .brightness_set = db1100_mmcled_set, | ||
256 | }; | ||
257 | |||
258 | static int db1100_mmc1_card_readonly(void *mmc_host) | ||
259 | { | ||
260 | return (bcsr_read(BCSR_BOARD) & BCSR_BOARD_SD1WP) ? 1 : 0; | ||
261 | } | ||
262 | |||
263 | static int db1100_mmc1_card_inserted(void *mmc_host) | ||
264 | { | ||
265 | return !alchemy_gpio_get_value(20); | ||
266 | } | ||
267 | |||
268 | static void db1100_mmc1_set_power(void *mmc_host, int state) | ||
269 | { | ||
270 | if (state) { | ||
271 | bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_SD1PWR); | ||
272 | msleep(400); /* stabilization time */ | ||
273 | } else | ||
274 | bcsr_mod(BCSR_BOARD, BCSR_BOARD_SD1PWR, 0); | ||
275 | } | ||
276 | |||
277 | static void db1100_mmc1led_set(struct led_classdev *led, enum led_brightness b) | ||
278 | { | ||
279 | if (b != LED_OFF) | ||
280 | bcsr_mod(BCSR_LEDS, BCSR_LEDS_LED1, 0); | ||
281 | else | ||
282 | bcsr_mod(BCSR_LEDS, 0, BCSR_LEDS_LED1); | ||
283 | } | ||
284 | |||
285 | static struct led_classdev db1100_mmc1_led = { | ||
286 | .brightness_set = db1100_mmc1led_set, | ||
287 | }; | ||
288 | |||
289 | static struct au1xmmc_platform_data db1100_mmc_platdata[2] = { | ||
290 | [0] = { | ||
291 | .cd_setup = db1100_mmc_cd_setup, | ||
292 | .set_power = db1100_mmc_set_power, | ||
293 | .card_inserted = db1100_mmc_card_inserted, | ||
294 | .card_readonly = db1100_mmc_card_readonly, | ||
295 | .led = &db1100_mmc_led, | ||
296 | }, | ||
297 | [1] = { | ||
298 | .cd_setup = db1100_mmc1_cd_setup, | ||
299 | .set_power = db1100_mmc1_set_power, | ||
300 | .card_inserted = db1100_mmc1_card_inserted, | ||
301 | .card_readonly = db1100_mmc1_card_readonly, | ||
302 | .led = &db1100_mmc1_led, | ||
303 | }, | ||
304 | }; | ||
305 | |||
306 | static struct resource au1100_mmc0_resources[] = { | ||
307 | [0] = { | ||
308 | .start = AU1100_SD0_PHYS_ADDR, | ||
309 | .end = AU1100_SD0_PHYS_ADDR + 0xfff, | ||
310 | .flags = IORESOURCE_MEM, | ||
311 | }, | ||
312 | [1] = { | ||
313 | .start = AU1100_SD_INT, | ||
314 | .end = AU1100_SD_INT, | ||
315 | .flags = IORESOURCE_IRQ, | ||
316 | }, | ||
317 | [2] = { | ||
318 | .start = DMA_ID_SD0_TX, | ||
319 | .end = DMA_ID_SD0_TX, | ||
320 | .flags = IORESOURCE_DMA, | ||
321 | }, | ||
322 | [3] = { | ||
323 | .start = DMA_ID_SD0_RX, | ||
324 | .end = DMA_ID_SD0_RX, | ||
325 | .flags = IORESOURCE_DMA, | ||
326 | } | ||
327 | }; | ||
328 | |||
329 | static u64 au1xxx_mmc_dmamask = DMA_BIT_MASK(32); | ||
330 | |||
331 | static struct platform_device db1100_mmc0_dev = { | ||
332 | .name = "au1xxx-mmc", | ||
333 | .id = 0, | ||
334 | .dev = { | ||
335 | .dma_mask = &au1xxx_mmc_dmamask, | ||
336 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
337 | .platform_data = &db1100_mmc_platdata[0], | ||
338 | }, | ||
339 | .num_resources = ARRAY_SIZE(au1100_mmc0_resources), | ||
340 | .resource = au1100_mmc0_resources, | ||
341 | }; | ||
342 | |||
343 | static struct resource au1100_mmc1_res[] = { | ||
344 | [0] = { | ||
345 | .start = AU1100_SD1_PHYS_ADDR, | ||
346 | .end = AU1100_SD1_PHYS_ADDR + 0xfff, | ||
347 | .flags = IORESOURCE_MEM, | ||
348 | }, | ||
349 | [1] = { | ||
350 | .start = AU1100_SD_INT, | ||
351 | .end = AU1100_SD_INT, | ||
352 | .flags = IORESOURCE_IRQ, | ||
353 | }, | ||
354 | [2] = { | ||
355 | .start = DMA_ID_SD1_TX, | ||
356 | .end = DMA_ID_SD1_TX, | ||
357 | .flags = IORESOURCE_DMA, | ||
358 | }, | ||
359 | [3] = { | ||
360 | .start = DMA_ID_SD1_RX, | ||
361 | .end = DMA_ID_SD1_RX, | ||
362 | .flags = IORESOURCE_DMA, | ||
363 | } | ||
364 | }; | ||
365 | |||
366 | static struct platform_device db1100_mmc1_dev = { | ||
367 | .name = "au1xxx-mmc", | ||
368 | .id = 1, | ||
369 | .dev = { | ||
370 | .dma_mask = &au1xxx_mmc_dmamask, | ||
371 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
372 | .platform_data = &db1100_mmc_platdata[1], | ||
373 | }, | ||
374 | .num_resources = ARRAY_SIZE(au1100_mmc1_res), | ||
375 | .resource = au1100_mmc1_res, | ||
376 | }; | ||
377 | |||
378 | /******************************************************************************/ | ||
379 | |||
380 | static void db1000_irda_set_phy_mode(int mode) | ||
381 | { | ||
382 | unsigned short mask = BCSR_RESETS_IRDA_MODE_MASK | BCSR_RESETS_FIR_SEL; | ||
383 | |||
384 | switch (mode) { | ||
385 | case AU1000_IRDA_PHY_MODE_OFF: | ||
386 | bcsr_mod(BCSR_RESETS, mask, BCSR_RESETS_IRDA_MODE_OFF); | ||
387 | break; | ||
388 | case AU1000_IRDA_PHY_MODE_SIR: | ||
389 | bcsr_mod(BCSR_RESETS, mask, BCSR_RESETS_IRDA_MODE_FULL); | ||
390 | break; | ||
391 | case AU1000_IRDA_PHY_MODE_FIR: | ||
392 | bcsr_mod(BCSR_RESETS, mask, BCSR_RESETS_IRDA_MODE_FULL | | ||
393 | BCSR_RESETS_FIR_SEL); | ||
394 | break; | ||
395 | } | ||
396 | } | ||
397 | |||
398 | static struct au1k_irda_platform_data db1000_irda_platdata = { | ||
399 | .set_phy_mode = db1000_irda_set_phy_mode, | ||
400 | }; | ||
401 | |||
402 | static struct resource au1000_irda_res[] = { | ||
403 | [0] = { | ||
404 | .start = AU1000_IRDA_PHYS_ADDR, | ||
405 | .end = AU1000_IRDA_PHYS_ADDR + 0x0fff, | ||
406 | .flags = IORESOURCE_MEM, | ||
407 | }, | ||
408 | [1] = { | ||
409 | .start = AU1000_IRDA_TX_INT, | ||
410 | .end = AU1000_IRDA_TX_INT, | ||
411 | .flags = IORESOURCE_IRQ, | ||
412 | }, | ||
413 | [2] = { | ||
414 | .start = AU1000_IRDA_RX_INT, | ||
415 | .end = AU1000_IRDA_RX_INT, | ||
416 | .flags = IORESOURCE_IRQ, | ||
417 | }, | ||
418 | }; | ||
419 | |||
420 | static struct platform_device db1000_irda_dev = { | ||
421 | .name = "au1000-irda", | ||
422 | .id = -1, | ||
423 | .dev = { | ||
424 | .platform_data = &db1000_irda_platdata, | ||
425 | }, | ||
426 | .resource = au1000_irda_res, | ||
427 | .num_resources = ARRAY_SIZE(au1000_irda_res), | ||
428 | }; | ||
429 | |||
430 | /******************************************************************************/ | ||
431 | |||
432 | static struct ads7846_platform_data db1100_touch_pd = { | ||
433 | .model = 7846, | ||
434 | .vref_mv = 3300, | ||
435 | .gpio_pendown = 21, | ||
436 | }; | ||
437 | |||
438 | static struct spi_gpio_platform_data db1100_spictl_pd = { | ||
439 | .sck = 209, | ||
440 | .mosi = 208, | ||
441 | .miso = 207, | ||
442 | .num_chipselect = 1, | ||
443 | }; | ||
444 | |||
445 | static struct spi_board_info db1100_spi_info[] __initdata = { | ||
446 | [0] = { | ||
447 | .modalias = "ads7846", | ||
448 | .max_speed_hz = 3250000, | ||
449 | .bus_num = 0, | ||
450 | .chip_select = 0, | ||
451 | .mode = 0, | ||
452 | .irq = AU1100_GPIO21_INT, | ||
453 | .platform_data = &db1100_touch_pd, | ||
454 | .controller_data = (void *)210, /* for spi_gpio: CS# GPIO210 */ | ||
455 | }, | ||
456 | }; | ||
457 | |||
458 | static struct platform_device db1100_spi_dev = { | ||
459 | .name = "spi_gpio", | ||
460 | .id = 0, | ||
461 | .dev = { | ||
462 | .platform_data = &db1100_spictl_pd, | ||
463 | }, | ||
464 | }; | ||
465 | |||
466 | |||
467 | static struct platform_device *db1x00_devs[] = { | ||
468 | &db1x00_codec_dev, | ||
469 | &alchemy_ac97c_dma_dev, | ||
470 | &alchemy_ac97c_dev, | ||
471 | &db1x00_audio_dev, | ||
472 | }; | ||
473 | |||
474 | static struct platform_device *db1000_devs[] = { | ||
475 | &db1000_irda_dev, | ||
476 | }; | ||
477 | |||
478 | static struct platform_device *db1100_devs[] = { | ||
479 | &au1100_lcd_device, | ||
480 | &db1100_mmc0_dev, | ||
481 | &db1100_mmc1_dev, | ||
482 | &db1000_irda_dev, | ||
483 | &db1100_spi_dev, | ||
484 | }; | ||
485 | |||
486 | static int __init db1000_dev_init(void) | ||
487 | { | ||
488 | int board = BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)); | ||
489 | int c0, c1, d0, d1, s0, s1; | ||
490 | unsigned long pfc; | ||
491 | |||
492 | if (board == BCSR_WHOAMI_DB1500) { | ||
493 | c0 = AU1500_GPIO2_INT; | ||
494 | c1 = AU1500_GPIO5_INT; | ||
495 | d0 = AU1500_GPIO0_INT; | ||
496 | d1 = AU1500_GPIO3_INT; | ||
497 | s0 = AU1500_GPIO1_INT; | ||
498 | s1 = AU1500_GPIO4_INT; | ||
499 | } else if (board == BCSR_WHOAMI_DB1100) { | ||
500 | c0 = AU1100_GPIO2_INT; | ||
501 | c1 = AU1100_GPIO5_INT; | ||
502 | d0 = AU1100_GPIO0_INT; | ||
503 | d1 = AU1100_GPIO3_INT; | ||
504 | s0 = AU1100_GPIO1_INT; | ||
505 | s1 = AU1100_GPIO4_INT; | ||
506 | |||
507 | gpio_direction_input(19); /* sd0 cd# */ | ||
508 | gpio_direction_input(20); /* sd1 cd# */ | ||
509 | gpio_direction_input(21); /* touch pendown# */ | ||
510 | gpio_direction_input(207); /* SPI MISO */ | ||
511 | gpio_direction_output(208, 0); /* SPI MOSI */ | ||
512 | gpio_direction_output(209, 1); /* SPI SCK */ | ||
513 | gpio_direction_output(210, 1); /* SPI CS# */ | ||
514 | |||
515 | /* spi_gpio on SSI0 pins */ | ||
516 | pfc = __raw_readl((void __iomem *)SYS_PINFUNC); | ||
517 | pfc |= (1 << 0); /* SSI0 pins as GPIOs */ | ||
518 | __raw_writel(pfc, (void __iomem *)SYS_PINFUNC); | ||
519 | wmb(); | ||
520 | |||
521 | spi_register_board_info(db1100_spi_info, | ||
522 | ARRAY_SIZE(db1100_spi_info)); | ||
523 | |||
524 | platform_add_devices(db1100_devs, ARRAY_SIZE(db1100_devs)); | ||
525 | } else if (board == BCSR_WHOAMI_DB1000) { | ||
526 | c0 = AU1000_GPIO2_INT; | ||
527 | c1 = AU1000_GPIO5_INT; | ||
528 | d0 = AU1000_GPIO0_INT; | ||
529 | d1 = AU1000_GPIO3_INT; | ||
530 | s0 = AU1000_GPIO1_INT; | ||
531 | s1 = AU1000_GPIO4_INT; | ||
532 | platform_add_devices(db1000_devs, ARRAY_SIZE(db1000_devs)); | ||
533 | } else | ||
534 | return 0; /* unknown board, no further dev setup to do */ | ||
535 | |||
536 | irq_set_irq_type(d0, IRQ_TYPE_EDGE_BOTH); | ||
537 | irq_set_irq_type(d1, IRQ_TYPE_EDGE_BOTH); | ||
538 | irq_set_irq_type(c0, IRQ_TYPE_LEVEL_LOW); | ||
539 | irq_set_irq_type(c1, IRQ_TYPE_LEVEL_LOW); | ||
540 | irq_set_irq_type(s0, IRQ_TYPE_LEVEL_LOW); | ||
541 | irq_set_irq_type(s1, IRQ_TYPE_LEVEL_LOW); | ||
542 | |||
543 | db1x_register_pcmcia_socket( | ||
544 | AU1000_PCMCIA_ATTR_PHYS_ADDR, | ||
545 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1, | ||
546 | AU1000_PCMCIA_MEM_PHYS_ADDR, | ||
547 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x000400000 - 1, | ||
548 | AU1000_PCMCIA_IO_PHYS_ADDR, | ||
549 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x000010000 - 1, | ||
550 | c0, d0, /*s0*/0, 0, 0); | ||
551 | |||
552 | db1x_register_pcmcia_socket( | ||
553 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004000000, | ||
554 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004400000 - 1, | ||
555 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x004000000, | ||
556 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x004400000 - 1, | ||
557 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x004000000, | ||
558 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x004010000 - 1, | ||
559 | c1, d1, /*s1*/0, 0, 1); | ||
560 | |||
561 | platform_add_devices(db1x00_devs, ARRAY_SIZE(db1x00_devs)); | ||
562 | db1x_register_norflash(32 << 20, 4 /* 32bit */, F_SWAPPED); | ||
563 | return 0; | ||
564 | } | ||
565 | device_initcall(db1000_dev_init); | ||
diff --git a/arch/mips/alchemy/devboards/db1200/platform.c b/arch/mips/alchemy/devboards/db1200.c index c61867c93c4a..a83302b96c01 100644 --- a/arch/mips/alchemy/devboards/db1200/platform.c +++ b/arch/mips/alchemy/devboards/db1200.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * DBAu1200 board platform device registration | 2 | * DBAu1200/PBAu1200 board platform device registration |
3 | * | 3 | * |
4 | * Copyright (C) 2008-2009 Manuel Lauss | 4 | * Copyright (C) 2008-2011 Manuel Lauss |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/gpio.h> | 22 | #include <linux/gpio.h> |
23 | #include <linux/i2c.h> | 23 | #include <linux/i2c.h> |
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/interrupt.h> | ||
25 | #include <linux/io.h> | 26 | #include <linux/io.h> |
26 | #include <linux/leds.h> | 27 | #include <linux/leds.h> |
27 | #include <linux/mmc/host.h> | 28 | #include <linux/mmc/host.h> |
@@ -33,18 +34,116 @@ | |||
33 | #include <linux/spi/spi.h> | 34 | #include <linux/spi/spi.h> |
34 | #include <linux/spi/flash.h> | 35 | #include <linux/spi/flash.h> |
35 | #include <linux/smc91x.h> | 36 | #include <linux/smc91x.h> |
36 | 37 | #include <asm/mach-au1x00/au1000.h> | |
37 | #include <asm/mach-au1x00/au1100_mmc.h> | 38 | #include <asm/mach-au1x00/au1100_mmc.h> |
38 | #include <asm/mach-au1x00/au1xxx_dbdma.h> | 39 | #include <asm/mach-au1x00/au1xxx_dbdma.h> |
40 | #include <asm/mach-au1x00/au1200fb.h> | ||
39 | #include <asm/mach-au1x00/au1550_spi.h> | 41 | #include <asm/mach-au1x00/au1550_spi.h> |
40 | #include <asm/mach-db1x00/bcsr.h> | 42 | #include <asm/mach-db1x00/bcsr.h> |
41 | #include <asm/mach-db1x00/db1200.h> | 43 | #include <asm/mach-db1x00/db1200.h> |
42 | 44 | ||
43 | #include "../platform.h" | 45 | #include "platform.h" |
46 | |||
47 | static const char *board_type_str(void) | ||
48 | { | ||
49 | switch (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI))) { | ||
50 | case BCSR_WHOAMI_PB1200_DDR1: | ||
51 | case BCSR_WHOAMI_PB1200_DDR2: | ||
52 | return "PB1200"; | ||
53 | case BCSR_WHOAMI_DB1200: | ||
54 | return "DB1200"; | ||
55 | default: | ||
56 | return "(unknown)"; | ||
57 | } | ||
58 | } | ||
59 | |||
60 | const char *get_system_type(void) | ||
61 | { | ||
62 | return board_type_str(); | ||
63 | } | ||
64 | |||
65 | static int __init detect_board(void) | ||
66 | { | ||
67 | int bid; | ||
68 | |||
69 | /* try the DB1200 first */ | ||
70 | bcsr_init(DB1200_BCSR_PHYS_ADDR, | ||
71 | DB1200_BCSR_PHYS_ADDR + DB1200_BCSR_HEXLED_OFS); | ||
72 | if (BCSR_WHOAMI_DB1200 == BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI))) { | ||
73 | unsigned short t = bcsr_read(BCSR_HEXLEDS); | ||
74 | bcsr_write(BCSR_HEXLEDS, ~t); | ||
75 | if (bcsr_read(BCSR_HEXLEDS) != t) { | ||
76 | bcsr_write(BCSR_HEXLEDS, t); | ||
77 | return 0; | ||
78 | } | ||
79 | } | ||
80 | |||
81 | /* okay, try the PB1200 then */ | ||
82 | bcsr_init(PB1200_BCSR_PHYS_ADDR, | ||
83 | PB1200_BCSR_PHYS_ADDR + PB1200_BCSR_HEXLED_OFS); | ||
84 | bid = BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)); | ||
85 | if ((bid == BCSR_WHOAMI_PB1200_DDR1) || | ||
86 | (bid == BCSR_WHOAMI_PB1200_DDR2)) { | ||
87 | unsigned short t = bcsr_read(BCSR_HEXLEDS); | ||
88 | bcsr_write(BCSR_HEXLEDS, ~t); | ||
89 | if (bcsr_read(BCSR_HEXLEDS) != t) { | ||
90 | bcsr_write(BCSR_HEXLEDS, t); | ||
91 | return 0; | ||
92 | } | ||
93 | } | ||
94 | |||
95 | return 1; /* it's neither */ | ||
96 | } | ||
97 | |||
98 | void __init board_setup(void) | ||
99 | { | ||
100 | unsigned long freq0, clksrc, div, pfc; | ||
101 | unsigned short whoami; | ||
102 | |||
103 | if (detect_board()) { | ||
104 | printk(KERN_ERR "NOT running on a DB1200/PB1200 board!\n"); | ||
105 | return; | ||
106 | } | ||
107 | |||
108 | whoami = bcsr_read(BCSR_WHOAMI); | ||
109 | printk(KERN_INFO "Alchemy/AMD/RMI %s Board, CPLD Rev %d" | ||
110 | " Board-ID %d Daughtercard ID %d\n", board_type_str(), | ||
111 | (whoami >> 4) & 0xf, (whoami >> 8) & 0xf, whoami & 0xf); | ||
112 | |||
113 | /* SMBus/SPI on PSC0, Audio on PSC1 */ | ||
114 | pfc = __raw_readl((void __iomem *)SYS_PINFUNC); | ||
115 | pfc &= ~(SYS_PINFUNC_P0A | SYS_PINFUNC_P0B); | ||
116 | pfc &= ~(SYS_PINFUNC_P1A | SYS_PINFUNC_P1B | SYS_PINFUNC_FS3); | ||
117 | pfc |= SYS_PINFUNC_P1C; /* SPI is configured later */ | ||
118 | __raw_writel(pfc, (void __iomem *)SYS_PINFUNC); | ||
119 | wmb(); | ||
120 | |||
121 | /* Clock configurations: PSC0: ~50MHz via Clkgen0, derived from | ||
122 | * CPU clock; all other clock generators off/unused. | ||
123 | */ | ||
124 | div = (get_au1x00_speed() + 25000000) / 50000000; | ||
125 | if (div & 1) | ||
126 | div++; | ||
127 | div = ((div >> 1) - 1) & 0xff; | ||
128 | |||
129 | freq0 = div << SYS_FC_FRDIV0_BIT; | ||
130 | __raw_writel(freq0, (void __iomem *)SYS_FREQCTRL0); | ||
131 | wmb(); | ||
132 | freq0 |= SYS_FC_FE0; /* enable F0 */ | ||
133 | __raw_writel(freq0, (void __iomem *)SYS_FREQCTRL0); | ||
134 | wmb(); | ||
135 | |||
136 | /* psc0_intclk comes 1:1 from F0 */ | ||
137 | clksrc = SYS_CS_MUX_FQ0 << SYS_CS_ME0_BIT; | ||
138 | __raw_writel(clksrc, (void __iomem *)SYS_CLKSRC); | ||
139 | wmb(); | ||
140 | } | ||
141 | |||
142 | /******************************************************************************/ | ||
44 | 143 | ||
45 | static struct mtd_partition db1200_spiflash_parts[] = { | 144 | static struct mtd_partition db1200_spiflash_parts[] = { |
46 | { | 145 | { |
47 | .name = "DB1200 SPI flash", | 146 | .name = "spi_flash", |
48 | .offset = 0, | 147 | .offset = 0, |
49 | .size = MTDPART_SIZ_FULL, | 148 | .size = MTDPART_SIZ_FULL, |
50 | }, | 149 | }, |
@@ -78,18 +177,9 @@ static struct spi_board_info db1200_spi_devs[] __initdata = { | |||
78 | }; | 177 | }; |
79 | 178 | ||
80 | static struct i2c_board_info db1200_i2c_devs[] __initdata = { | 179 | static struct i2c_board_info db1200_i2c_devs[] __initdata = { |
81 | { | 180 | { I2C_BOARD_INFO("24c04", 0x52), }, /* AT24C04-10 I2C eeprom */ |
82 | /* AT24C04-10 I2C eeprom */ | 181 | { I2C_BOARD_INFO("ne1619", 0x2d), }, /* adm1025-compat hwmon */ |
83 | I2C_BOARD_INFO("24c04", 0x52), | 182 | { I2C_BOARD_INFO("wm8731", 0x1b), }, /* I2S audio codec WM8731 */ |
84 | }, | ||
85 | { | ||
86 | /* Philips NE1619 temp/voltage sensor (adm1025 drv) */ | ||
87 | I2C_BOARD_INFO("ne1619", 0x2d), | ||
88 | }, | ||
89 | { | ||
90 | /* I2S audio codec WM8731 */ | ||
91 | I2C_BOARD_INFO("wm8731", 0x1b), | ||
92 | }, | ||
93 | }; | 183 | }; |
94 | 184 | ||
95 | /**********************************************************************/ | 185 | /**********************************************************************/ |
@@ -206,7 +296,7 @@ static struct platform_device db1200_eth_dev = { | |||
206 | static struct resource db1200_ide_res[] = { | 296 | static struct resource db1200_ide_res[] = { |
207 | [0] = { | 297 | [0] = { |
208 | .start = DB1200_IDE_PHYS_ADDR, | 298 | .start = DB1200_IDE_PHYS_ADDR, |
209 | .end = DB1200_IDE_PHYS_ADDR + DB1200_IDE_PHYS_LEN - 1, | 299 | .end = DB1200_IDE_PHYS_ADDR + DB1200_IDE_PHYS_LEN - 1, |
210 | .flags = IORESOURCE_MEM, | 300 | .flags = IORESOURCE_MEM, |
211 | }, | 301 | }, |
212 | [1] = { | 302 | [1] = { |
@@ -221,13 +311,13 @@ static struct resource db1200_ide_res[] = { | |||
221 | }, | 311 | }, |
222 | }; | 312 | }; |
223 | 313 | ||
224 | static u64 ide_dmamask = DMA_BIT_MASK(32); | 314 | static u64 au1200_ide_dmamask = DMA_BIT_MASK(32); |
225 | 315 | ||
226 | static struct platform_device db1200_ide_dev = { | 316 | static struct platform_device db1200_ide_dev = { |
227 | .name = "au1200-ide", | 317 | .name = "au1200-ide", |
228 | .id = 0, | 318 | .id = 0, |
229 | .dev = { | 319 | .dev = { |
230 | .dma_mask = &ide_dmamask, | 320 | .dma_mask = &au1200_ide_dmamask, |
231 | .coherent_dma_mask = DMA_BIT_MASK(32), | 321 | .coherent_dma_mask = DMA_BIT_MASK(32), |
232 | }, | 322 | }, |
233 | .num_resources = ARRAY_SIZE(db1200_ide_res), | 323 | .num_resources = ARRAY_SIZE(db1200_ide_res), |
@@ -236,13 +326,6 @@ static struct platform_device db1200_ide_dev = { | |||
236 | 326 | ||
237 | /**********************************************************************/ | 327 | /**********************************************************************/ |
238 | 328 | ||
239 | static struct platform_device db1200_rtc_dev = { | ||
240 | .name = "rtc-au1xxx", | ||
241 | .id = -1, | ||
242 | }; | ||
243 | |||
244 | /**********************************************************************/ | ||
245 | |||
246 | /* SD carddetects: they're supposed to be edge-triggered, but ack | 329 | /* SD carddetects: they're supposed to be edge-triggered, but ack |
247 | * doesn't seem to work (CPLD Rev 2). Instead, the screaming one | 330 | * doesn't seem to work (CPLD Rev 2). Instead, the screaming one |
248 | * is disabled and its counterpart enabled. The 500ms timeout is | 331 | * is disabled and its counterpart enabled. The 500ms timeout is |
@@ -276,12 +359,12 @@ static int db1200_mmc_cd_setup(void *mmc_host, int en) | |||
276 | 359 | ||
277 | if (en) { | 360 | if (en) { |
278 | ret = request_irq(DB1200_SD0_INSERT_INT, db1200_mmc_cd, | 361 | ret = request_irq(DB1200_SD0_INSERT_INT, db1200_mmc_cd, |
279 | IRQF_DISABLED, "sd_insert", mmc_host); | 362 | 0, "sd_insert", mmc_host); |
280 | if (ret) | 363 | if (ret) |
281 | goto out; | 364 | goto out; |
282 | 365 | ||
283 | ret = request_irq(DB1200_SD0_EJECT_INT, db1200_mmc_cd, | 366 | ret = request_irq(DB1200_SD0_EJECT_INT, db1200_mmc_cd, |
284 | IRQF_DISABLED, "sd_eject", mmc_host); | 367 | 0, "sd_eject", mmc_host); |
285 | if (ret) { | 368 | if (ret) { |
286 | free_irq(DB1200_SD0_INSERT_INT, mmc_host); | 369 | free_irq(DB1200_SD0_INSERT_INT, mmc_host); |
287 | goto out; | 370 | goto out; |
@@ -333,12 +416,109 @@ static struct led_classdev db1200_mmc_led = { | |||
333 | .brightness_set = db1200_mmcled_set, | 416 | .brightness_set = db1200_mmcled_set, |
334 | }; | 417 | }; |
335 | 418 | ||
336 | static struct au1xmmc_platform_data db1200mmc_platdata = { | 419 | /* -- */ |
337 | .cd_setup = db1200_mmc_cd_setup, | 420 | |
338 | .set_power = db1200_mmc_set_power, | 421 | static irqreturn_t pb1200_mmc1_cd(int irq, void *ptr) |
339 | .card_inserted = db1200_mmc_card_inserted, | 422 | { |
340 | .card_readonly = db1200_mmc_card_readonly, | 423 | void(*mmc_cd)(struct mmc_host *, unsigned long); |
341 | .led = &db1200_mmc_led, | 424 | |
425 | if (irq == PB1200_SD1_INSERT_INT) { | ||
426 | disable_irq_nosync(PB1200_SD1_INSERT_INT); | ||
427 | enable_irq(PB1200_SD1_EJECT_INT); | ||
428 | } else { | ||
429 | disable_irq_nosync(PB1200_SD1_EJECT_INT); | ||
430 | enable_irq(PB1200_SD1_INSERT_INT); | ||
431 | } | ||
432 | |||
433 | /* link against CONFIG_MMC=m */ | ||
434 | mmc_cd = symbol_get(mmc_detect_change); | ||
435 | if (mmc_cd) { | ||
436 | mmc_cd(ptr, msecs_to_jiffies(500)); | ||
437 | symbol_put(mmc_detect_change); | ||
438 | } | ||
439 | |||
440 | return IRQ_HANDLED; | ||
441 | } | ||
442 | |||
443 | static int pb1200_mmc1_cd_setup(void *mmc_host, int en) | ||
444 | { | ||
445 | int ret; | ||
446 | |||
447 | if (en) { | ||
448 | ret = request_irq(PB1200_SD1_INSERT_INT, pb1200_mmc1_cd, 0, | ||
449 | "sd1_insert", mmc_host); | ||
450 | if (ret) | ||
451 | goto out; | ||
452 | |||
453 | ret = request_irq(PB1200_SD1_EJECT_INT, pb1200_mmc1_cd, 0, | ||
454 | "sd1_eject", mmc_host); | ||
455 | if (ret) { | ||
456 | free_irq(PB1200_SD1_INSERT_INT, mmc_host); | ||
457 | goto out; | ||
458 | } | ||
459 | |||
460 | if (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD1INSERT) | ||
461 | enable_irq(PB1200_SD1_EJECT_INT); | ||
462 | else | ||
463 | enable_irq(PB1200_SD1_INSERT_INT); | ||
464 | |||
465 | } else { | ||
466 | free_irq(PB1200_SD1_INSERT_INT, mmc_host); | ||
467 | free_irq(PB1200_SD1_EJECT_INT, mmc_host); | ||
468 | } | ||
469 | ret = 0; | ||
470 | out: | ||
471 | return ret; | ||
472 | } | ||
473 | |||
474 | static void pb1200_mmc1led_set(struct led_classdev *led, | ||
475 | enum led_brightness brightness) | ||
476 | { | ||
477 | if (brightness != LED_OFF) | ||
478 | bcsr_mod(BCSR_LEDS, BCSR_LEDS_LED1, 0); | ||
479 | else | ||
480 | bcsr_mod(BCSR_LEDS, 0, BCSR_LEDS_LED1); | ||
481 | } | ||
482 | |||
483 | static struct led_classdev pb1200_mmc1_led = { | ||
484 | .brightness_set = pb1200_mmc1led_set, | ||
485 | }; | ||
486 | |||
487 | static void pb1200_mmc1_set_power(void *mmc_host, int state) | ||
488 | { | ||
489 | if (state) { | ||
490 | bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_SD1PWR); | ||
491 | msleep(400); /* stabilization time */ | ||
492 | } else | ||
493 | bcsr_mod(BCSR_BOARD, BCSR_BOARD_SD1PWR, 0); | ||
494 | } | ||
495 | |||
496 | static int pb1200_mmc1_card_readonly(void *mmc_host) | ||
497 | { | ||
498 | return (bcsr_read(BCSR_STATUS) & BCSR_STATUS_SD1WP) ? 1 : 0; | ||
499 | } | ||
500 | |||
501 | static int pb1200_mmc1_card_inserted(void *mmc_host) | ||
502 | { | ||
503 | return (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD1INSERT) ? 1 : 0; | ||
504 | } | ||
505 | |||
506 | |||
507 | static struct au1xmmc_platform_data db1200_mmc_platdata[2] = { | ||
508 | [0] = { | ||
509 | .cd_setup = db1200_mmc_cd_setup, | ||
510 | .set_power = db1200_mmc_set_power, | ||
511 | .card_inserted = db1200_mmc_card_inserted, | ||
512 | .card_readonly = db1200_mmc_card_readonly, | ||
513 | .led = &db1200_mmc_led, | ||
514 | }, | ||
515 | [1] = { | ||
516 | .cd_setup = pb1200_mmc1_cd_setup, | ||
517 | .set_power = pb1200_mmc1_set_power, | ||
518 | .card_inserted = pb1200_mmc1_card_inserted, | ||
519 | .card_readonly = pb1200_mmc1_card_readonly, | ||
520 | .led = &pb1200_mmc1_led, | ||
521 | }, | ||
342 | }; | 522 | }; |
343 | 523 | ||
344 | static struct resource au1200_mmc0_resources[] = { | 524 | static struct resource au1200_mmc0_resources[] = { |
@@ -372,14 +552,76 @@ static struct platform_device db1200_mmc0_dev = { | |||
372 | .dev = { | 552 | .dev = { |
373 | .dma_mask = &au1xxx_mmc_dmamask, | 553 | .dma_mask = &au1xxx_mmc_dmamask, |
374 | .coherent_dma_mask = DMA_BIT_MASK(32), | 554 | .coherent_dma_mask = DMA_BIT_MASK(32), |
375 | .platform_data = &db1200mmc_platdata, | 555 | .platform_data = &db1200_mmc_platdata[0], |
376 | }, | 556 | }, |
377 | .num_resources = ARRAY_SIZE(au1200_mmc0_resources), | 557 | .num_resources = ARRAY_SIZE(au1200_mmc0_resources), |
378 | .resource = au1200_mmc0_resources, | 558 | .resource = au1200_mmc0_resources, |
379 | }; | 559 | }; |
380 | 560 | ||
561 | static struct resource au1200_mmc1_res[] = { | ||
562 | [0] = { | ||
563 | .start = AU1100_SD1_PHYS_ADDR, | ||
564 | .end = AU1100_SD1_PHYS_ADDR + 0xfff, | ||
565 | .flags = IORESOURCE_MEM, | ||
566 | }, | ||
567 | [1] = { | ||
568 | .start = AU1200_SD_INT, | ||
569 | .end = AU1200_SD_INT, | ||
570 | .flags = IORESOURCE_IRQ, | ||
571 | }, | ||
572 | [2] = { | ||
573 | .start = AU1200_DSCR_CMD0_SDMS_TX1, | ||
574 | .end = AU1200_DSCR_CMD0_SDMS_TX1, | ||
575 | .flags = IORESOURCE_DMA, | ||
576 | }, | ||
577 | [3] = { | ||
578 | .start = AU1200_DSCR_CMD0_SDMS_RX1, | ||
579 | .end = AU1200_DSCR_CMD0_SDMS_RX1, | ||
580 | .flags = IORESOURCE_DMA, | ||
581 | } | ||
582 | }; | ||
583 | |||
584 | static struct platform_device pb1200_mmc1_dev = { | ||
585 | .name = "au1xxx-mmc", | ||
586 | .id = 1, | ||
587 | .dev = { | ||
588 | .dma_mask = &au1xxx_mmc_dmamask, | ||
589 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
590 | .platform_data = &db1200_mmc_platdata[1], | ||
591 | }, | ||
592 | .num_resources = ARRAY_SIZE(au1200_mmc1_res), | ||
593 | .resource = au1200_mmc1_res, | ||
594 | }; | ||
595 | |||
381 | /**********************************************************************/ | 596 | /**********************************************************************/ |
382 | 597 | ||
598 | static int db1200fb_panel_index(void) | ||
599 | { | ||
600 | return (bcsr_read(BCSR_SWITCHES) >> 8) & 0x0f; | ||
601 | } | ||
602 | |||
603 | static int db1200fb_panel_init(void) | ||
604 | { | ||
605 | /* Apply power */ | ||
606 | bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD | | ||
607 | BCSR_BOARD_LCDBL); | ||
608 | return 0; | ||
609 | } | ||
610 | |||
611 | static int db1200fb_panel_shutdown(void) | ||
612 | { | ||
613 | /* Remove power */ | ||
614 | bcsr_mod(BCSR_BOARD, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD | | ||
615 | BCSR_BOARD_LCDBL, 0); | ||
616 | return 0; | ||
617 | } | ||
618 | |||
619 | static struct au1200fb_platdata db1200fb_pd = { | ||
620 | .panel_index = db1200fb_panel_index, | ||
621 | .panel_init = db1200fb_panel_init, | ||
622 | .panel_shutdown = db1200fb_panel_shutdown, | ||
623 | }; | ||
624 | |||
383 | static struct resource au1200_lcd_res[] = { | 625 | static struct resource au1200_lcd_res[] = { |
384 | [0] = { | 626 | [0] = { |
385 | .start = AU1200_LCD_PHYS_ADDR, | 627 | .start = AU1200_LCD_PHYS_ADDR, |
@@ -401,6 +643,7 @@ static struct platform_device au1200_lcd_dev = { | |||
401 | .dev = { | 643 | .dev = { |
402 | .dma_mask = &au1200_lcd_dmamask, | 644 | .dma_mask = &au1200_lcd_dmamask, |
403 | .coherent_dma_mask = DMA_BIT_MASK(32), | 645 | .coherent_dma_mask = DMA_BIT_MASK(32), |
646 | .platform_data = &db1200fb_pd, | ||
404 | }, | 647 | }, |
405 | .num_resources = ARRAY_SIZE(au1200_lcd_res), | 648 | .num_resources = ARRAY_SIZE(au1200_lcd_res), |
406 | .resource = au1200_lcd_res, | 649 | .resource = au1200_lcd_res, |
@@ -519,7 +762,6 @@ static struct platform_device *db1200_devs[] __initdata = { | |||
519 | &db1200_mmc0_dev, | 762 | &db1200_mmc0_dev, |
520 | &au1200_lcd_dev, | 763 | &au1200_lcd_dev, |
521 | &db1200_eth_dev, | 764 | &db1200_eth_dev, |
522 | &db1200_rtc_dev, | ||
523 | &db1200_nand_dev, | 765 | &db1200_nand_dev, |
524 | &db1200_audiodma_dev, | 766 | &db1200_audiodma_dev, |
525 | &db1200_audio_dev, | 767 | &db1200_audio_dev, |
@@ -527,11 +769,62 @@ static struct platform_device *db1200_devs[] __initdata = { | |||
527 | &db1200_sound_dev, | 769 | &db1200_sound_dev, |
528 | }; | 770 | }; |
529 | 771 | ||
772 | static struct platform_device *pb1200_devs[] __initdata = { | ||
773 | &pb1200_mmc1_dev, | ||
774 | }; | ||
775 | |||
776 | /* Some peripheral base addresses differ on the PB1200 */ | ||
777 | static int __init pb1200_res_fixup(void) | ||
778 | { | ||
779 | /* CPLD Revs earlier than 4 cause problems */ | ||
780 | if (BCSR_WHOAMI_CPLD(bcsr_read(BCSR_WHOAMI)) <= 3) { | ||
781 | printk(KERN_ERR "WARNING!!!\n"); | ||
782 | printk(KERN_ERR "WARNING!!!\n"); | ||
783 | printk(KERN_ERR "PB1200 must be at CPLD rev 4. Please have\n"); | ||
784 | printk(KERN_ERR "the board updated to latest revisions.\n"); | ||
785 | printk(KERN_ERR "This software will not work reliably\n"); | ||
786 | printk(KERN_ERR "on anything older than CPLD rev 4.!\n"); | ||
787 | printk(KERN_ERR "WARNING!!!\n"); | ||
788 | printk(KERN_ERR "WARNING!!!\n"); | ||
789 | return 1; | ||
790 | } | ||
791 | |||
792 | db1200_nand_res[0].start = PB1200_NAND_PHYS_ADDR; | ||
793 | db1200_nand_res[0].end = PB1200_NAND_PHYS_ADDR + 0xff; | ||
794 | db1200_ide_res[0].start = PB1200_IDE_PHYS_ADDR; | ||
795 | db1200_ide_res[0].end = PB1200_IDE_PHYS_ADDR + DB1200_IDE_PHYS_LEN - 1; | ||
796 | db1200_eth_res[0].start = PB1200_ETH_PHYS_ADDR; | ||
797 | db1200_eth_res[0].end = PB1200_ETH_PHYS_ADDR + 0xff; | ||
798 | return 0; | ||
799 | } | ||
800 | |||
530 | static int __init db1200_dev_init(void) | 801 | static int __init db1200_dev_init(void) |
531 | { | 802 | { |
532 | unsigned long pfc; | 803 | unsigned long pfc; |
533 | unsigned short sw; | 804 | unsigned short sw; |
534 | int swapped; | 805 | int swapped, bid; |
806 | |||
807 | bid = BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)); | ||
808 | if ((bid == BCSR_WHOAMI_PB1200_DDR1) || | ||
809 | (bid == BCSR_WHOAMI_PB1200_DDR2)) { | ||
810 | if (pb1200_res_fixup()) | ||
811 | return -ENODEV; | ||
812 | } | ||
813 | |||
814 | /* GPIO7 is low-level triggered CPLD cascade */ | ||
815 | irq_set_irq_type(AU1200_GPIO7_INT, IRQ_TYPE_LEVEL_LOW); | ||
816 | bcsr_init_irq(DB1200_INT_BEGIN, DB1200_INT_END, AU1200_GPIO7_INT); | ||
817 | |||
818 | /* insert/eject pairs: one of both is always screaming. To avoid | ||
819 | * issues they must not be automatically enabled when initially | ||
820 | * requested. | ||
821 | */ | ||
822 | irq_set_status_flags(DB1200_SD0_INSERT_INT, IRQ_NOAUTOEN); | ||
823 | irq_set_status_flags(DB1200_SD0_EJECT_INT, IRQ_NOAUTOEN); | ||
824 | irq_set_status_flags(DB1200_PC0_INSERT_INT, IRQ_NOAUTOEN); | ||
825 | irq_set_status_flags(DB1200_PC0_EJECT_INT, IRQ_NOAUTOEN); | ||
826 | irq_set_status_flags(DB1200_PC1_INSERT_INT, IRQ_NOAUTOEN); | ||
827 | irq_set_status_flags(DB1200_PC1_EJECT_INT, IRQ_NOAUTOEN); | ||
535 | 828 | ||
536 | i2c_register_board_info(0, db1200_i2c_devs, | 829 | i2c_register_board_info(0, db1200_i2c_devs, |
537 | ARRAY_SIZE(db1200_i2c_devs)); | 830 | ARRAY_SIZE(db1200_i2c_devs)); |
@@ -540,6 +833,7 @@ static int __init db1200_dev_init(void) | |||
540 | 833 | ||
541 | /* SWITCHES: S6.8 I2C/SPI selector (OFF=I2C ON=SPI) | 834 | /* SWITCHES: S6.8 I2C/SPI selector (OFF=I2C ON=SPI) |
542 | * S6.7 AC97/I2S selector (OFF=AC97 ON=I2S) | 835 | * S6.7 AC97/I2S selector (OFF=AC97 ON=I2S) |
836 | * or S12 on the PB1200. | ||
543 | */ | 837 | */ |
544 | 838 | ||
545 | /* NOTE: GPIO215 controls OTG VBUS supply. In SPI mode however | 839 | /* NOTE: GPIO215 controls OTG VBUS supply. In SPI mode however |
@@ -554,7 +848,7 @@ static int __init db1200_dev_init(void) | |||
554 | gpio_request(215, "otg-vbus"); | 848 | gpio_request(215, "otg-vbus"); |
555 | gpio_direction_output(215, 1); | 849 | gpio_direction_output(215, 1); |
556 | 850 | ||
557 | printk(KERN_INFO "DB1200 device configuration:\n"); | 851 | printk(KERN_INFO "%s device configuration:\n", board_type_str()); |
558 | 852 | ||
559 | sw = bcsr_read(BCSR_SWITCHES); | 853 | sw = bcsr_read(BCSR_SWITCHES); |
560 | if (sw & BCSR_SWITCHES_DIP_8) { | 854 | if (sw & BCSR_SWITCHES_DIP_8) { |
@@ -595,7 +889,7 @@ static int __init db1200_dev_init(void) | |||
595 | 889 | ||
596 | /* Audio PSC clock is supplied externally. (FIXME: platdata!!) */ | 890 | /* Audio PSC clock is supplied externally. (FIXME: platdata!!) */ |
597 | __raw_writel(PSC_SEL_CLK_SERCLK, | 891 | __raw_writel(PSC_SEL_CLK_SERCLK, |
598 | (void __iomem *)KSEG1ADDR(AU1550_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET); | 892 | (void __iomem *)KSEG1ADDR(AU1550_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET); |
599 | wmb(); | 893 | wmb(); |
600 | 894 | ||
601 | db1x_register_pcmcia_socket( | 895 | db1x_register_pcmcia_socket( |
@@ -621,28 +915,13 @@ static int __init db1200_dev_init(void) | |||
621 | swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1200_SWAPBOOT; | 915 | swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1200_SWAPBOOT; |
622 | db1x_register_norflash(64 << 20, 2, swapped); | 916 | db1x_register_norflash(64 << 20, 2, swapped); |
623 | 917 | ||
624 | return platform_add_devices(db1200_devs, ARRAY_SIZE(db1200_devs)); | 918 | platform_add_devices(db1200_devs, ARRAY_SIZE(db1200_devs)); |
625 | } | ||
626 | device_initcall(db1200_dev_init); | ||
627 | |||
628 | /* au1200fb calls these: STERBT EINEN TRAGISCHEN TOD!!! */ | ||
629 | int board_au1200fb_panel(void) | ||
630 | { | ||
631 | return (bcsr_read(BCSR_SWITCHES) >> 8) & 0x0f; | ||
632 | } | ||
633 | 919 | ||
634 | int board_au1200fb_panel_init(void) | 920 | /* PB1200 is a DB1200 with a 2nd MMC and Camera connector */ |
635 | { | 921 | if ((bid == BCSR_WHOAMI_PB1200_DDR1) || |
636 | /* Apply power */ | 922 | (bid == BCSR_WHOAMI_PB1200_DDR2)) |
637 | bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD | | 923 | platform_add_devices(pb1200_devs, ARRAY_SIZE(pb1200_devs)); |
638 | BCSR_BOARD_LCDBL); | ||
639 | return 0; | ||
640 | } | ||
641 | 924 | ||
642 | int board_au1200fb_panel_shutdown(void) | ||
643 | { | ||
644 | /* Remove power */ | ||
645 | bcsr_mod(BCSR_BOARD, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD | | ||
646 | BCSR_BOARD_LCDBL, 0); | ||
647 | return 0; | 925 | return 0; |
648 | } | 926 | } |
927 | device_initcall(db1200_dev_init); | ||
diff --git a/arch/mips/alchemy/devboards/db1200/Makefile b/arch/mips/alchemy/devboards/db1200/Makefile deleted file mode 100644 index 17840a5e2738..000000000000 --- a/arch/mips/alchemy/devboards/db1200/Makefile +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | obj-y += setup.o platform.o | ||
diff --git a/arch/mips/alchemy/devboards/db1200/setup.c b/arch/mips/alchemy/devboards/db1200/setup.c deleted file mode 100644 index 4a8980027ecf..000000000000 --- a/arch/mips/alchemy/devboards/db1200/setup.c +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | /* | ||
2 | * Alchemy/AMD/RMI DB1200 board setup. | ||
3 | * | ||
4 | * Licensed under the terms outlined in the file COPYING in the root of | ||
5 | * this source archive. | ||
6 | */ | ||
7 | |||
8 | #include <linux/init.h> | ||
9 | #include <linux/interrupt.h> | ||
10 | #include <linux/io.h> | ||
11 | #include <linux/kernel.h> | ||
12 | #include <asm/mach-au1x00/au1000.h> | ||
13 | #include <asm/mach-db1x00/bcsr.h> | ||
14 | #include <asm/mach-db1x00/db1200.h> | ||
15 | |||
16 | const char *get_system_type(void) | ||
17 | { | ||
18 | return "Alchemy Db1200"; | ||
19 | } | ||
20 | |||
21 | void __init board_setup(void) | ||
22 | { | ||
23 | unsigned long freq0, clksrc, div, pfc; | ||
24 | unsigned short whoami; | ||
25 | |||
26 | bcsr_init(DB1200_BCSR_PHYS_ADDR, | ||
27 | DB1200_BCSR_PHYS_ADDR + DB1200_BCSR_HEXLED_OFS); | ||
28 | |||
29 | whoami = bcsr_read(BCSR_WHOAMI); | ||
30 | printk(KERN_INFO "Alchemy/AMD/RMI DB1200 Board, CPLD Rev %d" | ||
31 | " Board-ID %d Daughtercard ID %d\n", | ||
32 | (whoami >> 4) & 0xf, (whoami >> 8) & 0xf, whoami & 0xf); | ||
33 | |||
34 | /* SMBus/SPI on PSC0, Audio on PSC1 */ | ||
35 | pfc = __raw_readl((void __iomem *)SYS_PINFUNC); | ||
36 | pfc &= ~(SYS_PINFUNC_P0A | SYS_PINFUNC_P0B); | ||
37 | pfc &= ~(SYS_PINFUNC_P1A | SYS_PINFUNC_P1B | SYS_PINFUNC_FS3); | ||
38 | pfc |= SYS_PINFUNC_P1C; /* SPI is configured later */ | ||
39 | __raw_writel(pfc, (void __iomem *)SYS_PINFUNC); | ||
40 | wmb(); | ||
41 | |||
42 | /* Clock configurations: PSC0: ~50MHz via Clkgen0, derived from | ||
43 | * CPU clock; all other clock generators off/unused. | ||
44 | */ | ||
45 | div = (get_au1x00_speed() + 25000000) / 50000000; | ||
46 | if (div & 1) | ||
47 | div++; | ||
48 | div = ((div >> 1) - 1) & 0xff; | ||
49 | |||
50 | freq0 = div << SYS_FC_FRDIV0_BIT; | ||
51 | __raw_writel(freq0, (void __iomem *)SYS_FREQCTRL0); | ||
52 | wmb(); | ||
53 | freq0 |= SYS_FC_FE0; /* enable F0 */ | ||
54 | __raw_writel(freq0, (void __iomem *)SYS_FREQCTRL0); | ||
55 | wmb(); | ||
56 | |||
57 | /* psc0_intclk comes 1:1 from F0 */ | ||
58 | clksrc = SYS_CS_MUX_FQ0 << SYS_CS_ME0_BIT; | ||
59 | __raw_writel(clksrc, (void __iomem *)SYS_CLKSRC); | ||
60 | wmb(); | ||
61 | } | ||
62 | |||
63 | static int __init db1200_arch_init(void) | ||
64 | { | ||
65 | /* GPIO7 is low-level triggered CPLD cascade */ | ||
66 | irq_set_irq_type(AU1200_GPIO7_INT, IRQF_TRIGGER_LOW); | ||
67 | bcsr_init_irq(DB1200_INT_BEGIN, DB1200_INT_END, AU1200_GPIO7_INT); | ||
68 | |||
69 | /* insert/eject pairs: one of both is always screaming. To avoid | ||
70 | * issues they must not be automatically enabled when initially | ||
71 | * requested. | ||
72 | */ | ||
73 | irq_set_status_flags(DB1200_SD0_INSERT_INT, IRQ_NOAUTOEN); | ||
74 | irq_set_status_flags(DB1200_SD0_EJECT_INT, IRQ_NOAUTOEN); | ||
75 | irq_set_status_flags(DB1200_PC0_INSERT_INT, IRQ_NOAUTOEN); | ||
76 | irq_set_status_flags(DB1200_PC0_EJECT_INT, IRQ_NOAUTOEN); | ||
77 | irq_set_status_flags(DB1200_PC1_INSERT_INT, IRQ_NOAUTOEN); | ||
78 | irq_set_status_flags(DB1200_PC1_EJECT_INT, IRQ_NOAUTOEN); | ||
79 | return 0; | ||
80 | } | ||
81 | arch_initcall(db1200_arch_init); | ||
diff --git a/arch/mips/alchemy/devboards/db1300.c b/arch/mips/alchemy/devboards/db1300.c new file mode 100644 index 000000000000..0893f2af0d01 --- /dev/null +++ b/arch/mips/alchemy/devboards/db1300.c | |||
@@ -0,0 +1,785 @@ | |||
1 | /* | ||
2 | * DBAu1300 init and platform device setup. | ||
3 | * | ||
4 | * (c) 2009 Manuel Lauss <manuel.lauss@googlemail.com> | ||
5 | */ | ||
6 | |||
7 | #include <linux/dma-mapping.h> | ||
8 | #include <linux/gpio.h> | ||
9 | #include <linux/gpio_keys.h> | ||
10 | #include <linux/init.h> | ||
11 | #include <linux/input.h> /* KEY_* codes */ | ||
12 | #include <linux/i2c.h> | ||
13 | #include <linux/io.h> | ||
14 | #include <linux/leds.h> | ||
15 | #include <linux/ata_platform.h> | ||
16 | #include <linux/mmc/host.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/mtd/mtd.h> | ||
19 | #include <linux/mtd/nand.h> | ||
20 | #include <linux/mtd/partitions.h> | ||
21 | #include <linux/platform_device.h> | ||
22 | #include <linux/smsc911x.h> | ||
23 | |||
24 | #include <asm/mach-au1x00/au1000.h> | ||
25 | #include <asm/mach-au1x00/au1100_mmc.h> | ||
26 | #include <asm/mach-au1x00/au1200fb.h> | ||
27 | #include <asm/mach-au1x00/au1xxx_dbdma.h> | ||
28 | #include <asm/mach-au1x00/au1xxx_psc.h> | ||
29 | #include <asm/mach-db1x00/db1300.h> | ||
30 | #include <asm/mach-db1x00/bcsr.h> | ||
31 | #include <asm/mach-au1x00/prom.h> | ||
32 | |||
33 | #include "platform.h" | ||
34 | |||
35 | static struct i2c_board_info db1300_i2c_devs[] __initdata = { | ||
36 | { I2C_BOARD_INFO("wm8731", 0x1b), }, /* I2S audio codec */ | ||
37 | { I2C_BOARD_INFO("ne1619", 0x2d), }, /* adm1025-compat hwmon */ | ||
38 | }; | ||
39 | |||
40 | /* multifunction pins to assign to GPIO controller */ | ||
41 | static int db1300_gpio_pins[] __initdata = { | ||
42 | AU1300_PIN_LCDPWM0, AU1300_PIN_PSC2SYNC1, AU1300_PIN_WAKE1, | ||
43 | AU1300_PIN_WAKE2, AU1300_PIN_WAKE3, AU1300_PIN_FG3AUX, | ||
44 | AU1300_PIN_EXTCLK1, | ||
45 | -1, /* terminator */ | ||
46 | }; | ||
47 | |||
48 | /* multifunction pins to assign to device functions */ | ||
49 | static int db1300_dev_pins[] __initdata = { | ||
50 | /* wake-from-str pins 0-3 */ | ||
51 | AU1300_PIN_WAKE0, | ||
52 | /* external clock sources for PSC0 */ | ||
53 | AU1300_PIN_EXTCLK0, | ||
54 | /* 8bit MMC interface on SD0: 6-9 */ | ||
55 | AU1300_PIN_SD0DAT4, AU1300_PIN_SD0DAT5, AU1300_PIN_SD0DAT6, | ||
56 | AU1300_PIN_SD0DAT7, | ||
57 | /* UART1 pins: 11-18 */ | ||
58 | AU1300_PIN_U1RI, AU1300_PIN_U1DCD, AU1300_PIN_U1DSR, | ||
59 | AU1300_PIN_U1CTS, AU1300_PIN_U1RTS, AU1300_PIN_U1DTR, | ||
60 | AU1300_PIN_U1RX, AU1300_PIN_U1TX, | ||
61 | /* UART0 pins: 19-24 */ | ||
62 | AU1300_PIN_U0RI, AU1300_PIN_U0DCD, AU1300_PIN_U0DSR, | ||
63 | AU1300_PIN_U0CTS, AU1300_PIN_U0RTS, AU1300_PIN_U0DTR, | ||
64 | /* UART2: 25-26 */ | ||
65 | AU1300_PIN_U2RX, AU1300_PIN_U2TX, | ||
66 | /* UART3: 27-28 */ | ||
67 | AU1300_PIN_U3RX, AU1300_PIN_U3TX, | ||
68 | /* LCD controller PWMs, ext pixclock: 30-31 */ | ||
69 | AU1300_PIN_LCDPWM1, AU1300_PIN_LCDCLKIN, | ||
70 | /* SD1 interface: 32-37 */ | ||
71 | AU1300_PIN_SD1DAT0, AU1300_PIN_SD1DAT1, AU1300_PIN_SD1DAT2, | ||
72 | AU1300_PIN_SD1DAT3, AU1300_PIN_SD1CMD, AU1300_PIN_SD1CLK, | ||
73 | /* SD2 interface: 38-43 */ | ||
74 | AU1300_PIN_SD2DAT0, AU1300_PIN_SD2DAT1, AU1300_PIN_SD2DAT2, | ||
75 | AU1300_PIN_SD2DAT3, AU1300_PIN_SD2CMD, AU1300_PIN_SD2CLK, | ||
76 | /* PSC0/1 clocks: 44-45 */ | ||
77 | AU1300_PIN_PSC0CLK, AU1300_PIN_PSC1CLK, | ||
78 | /* PSCs: 46-49/50-53/54-57/58-61 */ | ||
79 | AU1300_PIN_PSC0SYNC0, AU1300_PIN_PSC0SYNC1, AU1300_PIN_PSC0D0, | ||
80 | AU1300_PIN_PSC0D1, | ||
81 | AU1300_PIN_PSC1SYNC0, AU1300_PIN_PSC1SYNC1, AU1300_PIN_PSC1D0, | ||
82 | AU1300_PIN_PSC1D1, | ||
83 | AU1300_PIN_PSC2SYNC0, AU1300_PIN_PSC2D0, | ||
84 | AU1300_PIN_PSC2D1, | ||
85 | AU1300_PIN_PSC3SYNC0, AU1300_PIN_PSC3SYNC1, AU1300_PIN_PSC3D0, | ||
86 | AU1300_PIN_PSC3D1, | ||
87 | /* PCMCIA interface: 62-70 */ | ||
88 | AU1300_PIN_PCE2, AU1300_PIN_PCE1, AU1300_PIN_PIOS16, | ||
89 | AU1300_PIN_PIOR, AU1300_PIN_PWE, AU1300_PIN_PWAIT, | ||
90 | AU1300_PIN_PREG, AU1300_PIN_POE, AU1300_PIN_PIOW, | ||
91 | /* camera interface H/V sync inputs: 71-72 */ | ||
92 | AU1300_PIN_CIMLS, AU1300_PIN_CIMFS, | ||
93 | /* PSC2/3 clocks: 73-74 */ | ||
94 | AU1300_PIN_PSC2CLK, AU1300_PIN_PSC3CLK, | ||
95 | -1, /* terminator */ | ||
96 | }; | ||
97 | |||
98 | static void __init db1300_gpio_config(void) | ||
99 | { | ||
100 | int *i; | ||
101 | |||
102 | i = &db1300_dev_pins[0]; | ||
103 | while (*i != -1) | ||
104 | au1300_pinfunc_to_dev(*i++); | ||
105 | |||
106 | i = &db1300_gpio_pins[0]; | ||
107 | while (*i != -1) | ||
108 | au1300_gpio_direction_input(*i++);/* implies pin_to_gpio */ | ||
109 | |||
110 | au1300_set_dbdma_gpio(1, AU1300_PIN_FG3AUX); | ||
111 | } | ||
112 | |||
113 | char *get_system_type(void) | ||
114 | { | ||
115 | return "DB1300"; | ||
116 | } | ||
117 | |||
118 | /**********************************************************************/ | ||
119 | |||
120 | static void au1300_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, | ||
121 | unsigned int ctrl) | ||
122 | { | ||
123 | struct nand_chip *this = mtd->priv; | ||
124 | unsigned long ioaddr = (unsigned long)this->IO_ADDR_W; | ||
125 | |||
126 | ioaddr &= 0xffffff00; | ||
127 | |||
128 | if (ctrl & NAND_CLE) { | ||
129 | ioaddr += MEM_STNAND_CMD; | ||
130 | } else if (ctrl & NAND_ALE) { | ||
131 | ioaddr += MEM_STNAND_ADDR; | ||
132 | } else { | ||
133 | /* assume we want to r/w real data by default */ | ||
134 | ioaddr += MEM_STNAND_DATA; | ||
135 | } | ||
136 | this->IO_ADDR_R = this->IO_ADDR_W = (void __iomem *)ioaddr; | ||
137 | if (cmd != NAND_CMD_NONE) { | ||
138 | __raw_writeb(cmd, this->IO_ADDR_W); | ||
139 | wmb(); | ||
140 | } | ||
141 | } | ||
142 | |||
143 | static int au1300_nand_device_ready(struct mtd_info *mtd) | ||
144 | { | ||
145 | return __raw_readl((void __iomem *)MEM_STSTAT) & 1; | ||
146 | } | ||
147 | |||
148 | static const char *db1300_part_probes[] = { "cmdlinepart", NULL }; | ||
149 | |||
150 | static struct mtd_partition db1300_nand_parts[] = { | ||
151 | { | ||
152 | .name = "NAND FS 0", | ||
153 | .offset = 0, | ||
154 | .size = 8 * 1024 * 1024, | ||
155 | }, | ||
156 | { | ||
157 | .name = "NAND FS 1", | ||
158 | .offset = MTDPART_OFS_APPEND, | ||
159 | .size = MTDPART_SIZ_FULL | ||
160 | }, | ||
161 | }; | ||
162 | |||
163 | struct platform_nand_data db1300_nand_platdata = { | ||
164 | .chip = { | ||
165 | .nr_chips = 1, | ||
166 | .chip_offset = 0, | ||
167 | .nr_partitions = ARRAY_SIZE(db1300_nand_parts), | ||
168 | .partitions = db1300_nand_parts, | ||
169 | .chip_delay = 20, | ||
170 | .part_probe_types = db1300_part_probes, | ||
171 | }, | ||
172 | .ctrl = { | ||
173 | .dev_ready = au1300_nand_device_ready, | ||
174 | .cmd_ctrl = au1300_nand_cmd_ctrl, | ||
175 | }, | ||
176 | }; | ||
177 | |||
178 | static struct resource db1300_nand_res[] = { | ||
179 | [0] = { | ||
180 | .start = DB1300_NAND_PHYS_ADDR, | ||
181 | .end = DB1300_NAND_PHYS_ADDR + 0xff, | ||
182 | .flags = IORESOURCE_MEM, | ||
183 | }, | ||
184 | }; | ||
185 | |||
186 | static struct platform_device db1300_nand_dev = { | ||
187 | .name = "gen_nand", | ||
188 | .num_resources = ARRAY_SIZE(db1300_nand_res), | ||
189 | .resource = db1300_nand_res, | ||
190 | .id = -1, | ||
191 | .dev = { | ||
192 | .platform_data = &db1300_nand_platdata, | ||
193 | } | ||
194 | }; | ||
195 | |||
196 | /**********************************************************************/ | ||
197 | |||
198 | static struct resource db1300_eth_res[] = { | ||
199 | [0] = { | ||
200 | .start = DB1300_ETH_PHYS_ADDR, | ||
201 | .end = DB1300_ETH_PHYS_END, | ||
202 | .flags = IORESOURCE_MEM, | ||
203 | }, | ||
204 | [1] = { | ||
205 | .start = DB1300_ETH_INT, | ||
206 | .end = DB1300_ETH_INT, | ||
207 | .flags = IORESOURCE_IRQ, | ||
208 | }, | ||
209 | }; | ||
210 | |||
211 | static struct smsc911x_platform_config db1300_eth_config = { | ||
212 | .phy_interface = PHY_INTERFACE_MODE_MII, | ||
213 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, | ||
214 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, | ||
215 | .flags = SMSC911X_USE_32BIT, | ||
216 | }; | ||
217 | |||
218 | static struct platform_device db1300_eth_dev = { | ||
219 | .name = "smsc911x", | ||
220 | .id = -1, | ||
221 | .num_resources = ARRAY_SIZE(db1300_eth_res), | ||
222 | .resource = db1300_eth_res, | ||
223 | .dev = { | ||
224 | .platform_data = &db1300_eth_config, | ||
225 | }, | ||
226 | }; | ||
227 | |||
228 | /**********************************************************************/ | ||
229 | |||
230 | static struct resource au1300_psc1_res[] = { | ||
231 | [0] = { | ||
232 | .start = AU1300_PSC1_PHYS_ADDR, | ||
233 | .end = AU1300_PSC1_PHYS_ADDR + 0x0fff, | ||
234 | .flags = IORESOURCE_MEM, | ||
235 | }, | ||
236 | [1] = { | ||
237 | .start = AU1300_PSC1_INT, | ||
238 | .end = AU1300_PSC1_INT, | ||
239 | .flags = IORESOURCE_IRQ, | ||
240 | }, | ||
241 | [2] = { | ||
242 | .start = AU1300_DSCR_CMD0_PSC1_TX, | ||
243 | .end = AU1300_DSCR_CMD0_PSC1_TX, | ||
244 | .flags = IORESOURCE_DMA, | ||
245 | }, | ||
246 | [3] = { | ||
247 | .start = AU1300_DSCR_CMD0_PSC1_RX, | ||
248 | .end = AU1300_DSCR_CMD0_PSC1_RX, | ||
249 | .flags = IORESOURCE_DMA, | ||
250 | }, | ||
251 | }; | ||
252 | |||
253 | static struct platform_device db1300_ac97_dev = { | ||
254 | .name = "au1xpsc_ac97", | ||
255 | .id = 1, /* PSC ID. match with AC97 codec ID! */ | ||
256 | .num_resources = ARRAY_SIZE(au1300_psc1_res), | ||
257 | .resource = au1300_psc1_res, | ||
258 | }; | ||
259 | |||
260 | /**********************************************************************/ | ||
261 | |||
262 | static struct resource au1300_psc2_res[] = { | ||
263 | [0] = { | ||
264 | .start = AU1300_PSC2_PHYS_ADDR, | ||
265 | .end = AU1300_PSC2_PHYS_ADDR + 0x0fff, | ||
266 | .flags = IORESOURCE_MEM, | ||
267 | }, | ||
268 | [1] = { | ||
269 | .start = AU1300_PSC2_INT, | ||
270 | .end = AU1300_PSC2_INT, | ||
271 | .flags = IORESOURCE_IRQ, | ||
272 | }, | ||
273 | [2] = { | ||
274 | .start = AU1300_DSCR_CMD0_PSC2_TX, | ||
275 | .end = AU1300_DSCR_CMD0_PSC2_TX, | ||
276 | .flags = IORESOURCE_DMA, | ||
277 | }, | ||
278 | [3] = { | ||
279 | .start = AU1300_DSCR_CMD0_PSC2_RX, | ||
280 | .end = AU1300_DSCR_CMD0_PSC2_RX, | ||
281 | .flags = IORESOURCE_DMA, | ||
282 | }, | ||
283 | }; | ||
284 | |||
285 | static struct platform_device db1300_i2s_dev = { | ||
286 | .name = "au1xpsc_i2s", | ||
287 | .id = 2, /* PSC ID */ | ||
288 | .num_resources = ARRAY_SIZE(au1300_psc2_res), | ||
289 | .resource = au1300_psc2_res, | ||
290 | }; | ||
291 | |||
292 | /**********************************************************************/ | ||
293 | |||
294 | static struct resource au1300_psc3_res[] = { | ||
295 | [0] = { | ||
296 | .start = AU1300_PSC3_PHYS_ADDR, | ||
297 | .end = AU1300_PSC3_PHYS_ADDR + 0x0fff, | ||
298 | .flags = IORESOURCE_MEM, | ||
299 | }, | ||
300 | [1] = { | ||
301 | .start = AU1300_PSC3_INT, | ||
302 | .end = AU1300_PSC3_INT, | ||
303 | .flags = IORESOURCE_IRQ, | ||
304 | }, | ||
305 | [2] = { | ||
306 | .start = AU1300_DSCR_CMD0_PSC3_TX, | ||
307 | .end = AU1300_DSCR_CMD0_PSC3_TX, | ||
308 | .flags = IORESOURCE_DMA, | ||
309 | }, | ||
310 | [3] = { | ||
311 | .start = AU1300_DSCR_CMD0_PSC3_RX, | ||
312 | .end = AU1300_DSCR_CMD0_PSC3_RX, | ||
313 | .flags = IORESOURCE_DMA, | ||
314 | }, | ||
315 | }; | ||
316 | |||
317 | static struct platform_device db1300_i2c_dev = { | ||
318 | .name = "au1xpsc_smbus", | ||
319 | .id = 0, /* bus number */ | ||
320 | .num_resources = ARRAY_SIZE(au1300_psc3_res), | ||
321 | .resource = au1300_psc3_res, | ||
322 | }; | ||
323 | |||
324 | /**********************************************************************/ | ||
325 | |||
326 | /* proper key assignments when facing the LCD panel. For key assignments | ||
327 | * according to the schematics swap up with down and left with right. | ||
328 | * I chose to use it to emulate the arrow keys of a keyboard. | ||
329 | */ | ||
330 | static struct gpio_keys_button db1300_5waysw_arrowkeys[] = { | ||
331 | { | ||
332 | .code = KEY_DOWN, | ||
333 | .gpio = AU1300_PIN_LCDPWM0, | ||
334 | .type = EV_KEY, | ||
335 | .debounce_interval = 1, | ||
336 | .active_low = 1, | ||
337 | .desc = "5waysw-down", | ||
338 | }, | ||
339 | { | ||
340 | .code = KEY_UP, | ||
341 | .gpio = AU1300_PIN_PSC2SYNC1, | ||
342 | .type = EV_KEY, | ||
343 | .debounce_interval = 1, | ||
344 | .active_low = 1, | ||
345 | .desc = "5waysw-up", | ||
346 | }, | ||
347 | { | ||
348 | .code = KEY_RIGHT, | ||
349 | .gpio = AU1300_PIN_WAKE3, | ||
350 | .type = EV_KEY, | ||
351 | .debounce_interval = 1, | ||
352 | .active_low = 1, | ||
353 | .desc = "5waysw-right", | ||
354 | }, | ||
355 | { | ||
356 | .code = KEY_LEFT, | ||
357 | .gpio = AU1300_PIN_WAKE2, | ||
358 | .type = EV_KEY, | ||
359 | .debounce_interval = 1, | ||
360 | .active_low = 1, | ||
361 | .desc = "5waysw-left", | ||
362 | }, | ||
363 | { | ||
364 | .code = KEY_ENTER, | ||
365 | .gpio = AU1300_PIN_WAKE1, | ||
366 | .type = EV_KEY, | ||
367 | .debounce_interval = 1, | ||
368 | .active_low = 1, | ||
369 | .desc = "5waysw-push", | ||
370 | }, | ||
371 | }; | ||
372 | |||
373 | static struct gpio_keys_platform_data db1300_5waysw_data = { | ||
374 | .buttons = db1300_5waysw_arrowkeys, | ||
375 | .nbuttons = ARRAY_SIZE(db1300_5waysw_arrowkeys), | ||
376 | .rep = 1, | ||
377 | .name = "db1300-5wayswitch", | ||
378 | }; | ||
379 | |||
380 | static struct platform_device db1300_5waysw_dev = { | ||
381 | .name = "gpio-keys", | ||
382 | .dev = { | ||
383 | .platform_data = &db1300_5waysw_data, | ||
384 | }, | ||
385 | }; | ||
386 | |||
387 | /**********************************************************************/ | ||
388 | |||
389 | static struct pata_platform_info db1300_ide_info = { | ||
390 | .ioport_shift = DB1300_IDE_REG_SHIFT, | ||
391 | }; | ||
392 | |||
393 | #define IDE_ALT_START (14 << DB1300_IDE_REG_SHIFT) | ||
394 | static struct resource db1300_ide_res[] = { | ||
395 | [0] = { | ||
396 | .start = DB1300_IDE_PHYS_ADDR, | ||
397 | .end = DB1300_IDE_PHYS_ADDR + IDE_ALT_START - 1, | ||
398 | .flags = IORESOURCE_MEM, | ||
399 | }, | ||
400 | [1] = { | ||
401 | .start = DB1300_IDE_PHYS_ADDR + IDE_ALT_START, | ||
402 | .end = DB1300_IDE_PHYS_ADDR + DB1300_IDE_PHYS_LEN - 1, | ||
403 | .flags = IORESOURCE_MEM, | ||
404 | }, | ||
405 | [2] = { | ||
406 | .start = DB1300_IDE_INT, | ||
407 | .end = DB1300_IDE_INT, | ||
408 | .flags = IORESOURCE_IRQ, | ||
409 | }, | ||
410 | }; | ||
411 | |||
412 | static struct platform_device db1300_ide_dev = { | ||
413 | .dev = { | ||
414 | .platform_data = &db1300_ide_info, | ||
415 | }, | ||
416 | .name = "pata_platform", | ||
417 | .resource = db1300_ide_res, | ||
418 | .num_resources = ARRAY_SIZE(db1300_ide_res), | ||
419 | }; | ||
420 | |||
421 | /**********************************************************************/ | ||
422 | |||
423 | static irqreturn_t db1300_mmc_cd(int irq, void *ptr) | ||
424 | { | ||
425 | void(*mmc_cd)(struct mmc_host *, unsigned long); | ||
426 | |||
427 | /* disable the one currently screaming. No other way to shut it up */ | ||
428 | if (irq == DB1300_SD1_INSERT_INT) { | ||
429 | disable_irq_nosync(DB1300_SD1_INSERT_INT); | ||
430 | enable_irq(DB1300_SD1_EJECT_INT); | ||
431 | } else { | ||
432 | disable_irq_nosync(DB1300_SD1_EJECT_INT); | ||
433 | enable_irq(DB1300_SD1_INSERT_INT); | ||
434 | } | ||
435 | |||
436 | /* link against CONFIG_MMC=m. We can only be called once MMC core has | ||
437 | * initialized the controller, so symbol_get() should always succeed. | ||
438 | */ | ||
439 | mmc_cd = symbol_get(mmc_detect_change); | ||
440 | mmc_cd(ptr, msecs_to_jiffies(500)); | ||
441 | symbol_put(mmc_detect_change); | ||
442 | |||
443 | return IRQ_HANDLED; | ||
444 | } | ||
445 | |||
446 | static int db1300_mmc_card_readonly(void *mmc_host) | ||
447 | { | ||
448 | /* it uses SD1 interface, but the DB1200's SD0 bit in the CPLD */ | ||
449 | return bcsr_read(BCSR_STATUS) & BCSR_STATUS_SD0WP; | ||
450 | } | ||
451 | |||
452 | static int db1300_mmc_card_inserted(void *mmc_host) | ||
453 | { | ||
454 | return bcsr_read(BCSR_SIGSTAT) & (1 << 12); /* insertion irq signal */ | ||
455 | } | ||
456 | |||
457 | static int db1300_mmc_cd_setup(void *mmc_host, int en) | ||
458 | { | ||
459 | int ret; | ||
460 | |||
461 | if (en) { | ||
462 | ret = request_irq(DB1300_SD1_INSERT_INT, db1300_mmc_cd, 0, | ||
463 | "sd_insert", mmc_host); | ||
464 | if (ret) | ||
465 | goto out; | ||
466 | |||
467 | ret = request_irq(DB1300_SD1_EJECT_INT, db1300_mmc_cd, 0, | ||
468 | "sd_eject", mmc_host); | ||
469 | if (ret) { | ||
470 | free_irq(DB1300_SD1_INSERT_INT, mmc_host); | ||
471 | goto out; | ||
472 | } | ||
473 | |||
474 | if (db1300_mmc_card_inserted(mmc_host)) | ||
475 | enable_irq(DB1300_SD1_EJECT_INT); | ||
476 | else | ||
477 | enable_irq(DB1300_SD1_INSERT_INT); | ||
478 | |||
479 | } else { | ||
480 | free_irq(DB1300_SD1_INSERT_INT, mmc_host); | ||
481 | free_irq(DB1300_SD1_EJECT_INT, mmc_host); | ||
482 | } | ||
483 | ret = 0; | ||
484 | out: | ||
485 | return ret; | ||
486 | } | ||
487 | |||
488 | static void db1300_mmcled_set(struct led_classdev *led, | ||
489 | enum led_brightness brightness) | ||
490 | { | ||
491 | if (brightness != LED_OFF) | ||
492 | bcsr_mod(BCSR_LEDS, BCSR_LEDS_LED0, 0); | ||
493 | else | ||
494 | bcsr_mod(BCSR_LEDS, 0, BCSR_LEDS_LED0); | ||
495 | } | ||
496 | |||
497 | static struct led_classdev db1300_mmc_led = { | ||
498 | .brightness_set = db1300_mmcled_set, | ||
499 | }; | ||
500 | |||
501 | struct au1xmmc_platform_data db1300_sd1_platdata = { | ||
502 | .cd_setup = db1300_mmc_cd_setup, | ||
503 | .card_inserted = db1300_mmc_card_inserted, | ||
504 | .card_readonly = db1300_mmc_card_readonly, | ||
505 | .led = &db1300_mmc_led, | ||
506 | }; | ||
507 | |||
508 | static struct resource au1300_sd1_res[] = { | ||
509 | [0] = { | ||
510 | .start = AU1300_SD1_PHYS_ADDR, | ||
511 | .end = AU1300_SD1_PHYS_ADDR, | ||
512 | .flags = IORESOURCE_MEM, | ||
513 | }, | ||
514 | [1] = { | ||
515 | .start = AU1300_SD1_INT, | ||
516 | .end = AU1300_SD1_INT, | ||
517 | .flags = IORESOURCE_IRQ, | ||
518 | }, | ||
519 | [2] = { | ||
520 | .start = AU1300_DSCR_CMD0_SDMS_TX1, | ||
521 | .end = AU1300_DSCR_CMD0_SDMS_TX1, | ||
522 | .flags = IORESOURCE_DMA, | ||
523 | }, | ||
524 | [3] = { | ||
525 | .start = AU1300_DSCR_CMD0_SDMS_RX1, | ||
526 | .end = AU1300_DSCR_CMD0_SDMS_RX1, | ||
527 | .flags = IORESOURCE_DMA, | ||
528 | }, | ||
529 | }; | ||
530 | |||
531 | static struct platform_device db1300_sd1_dev = { | ||
532 | .dev = { | ||
533 | .platform_data = &db1300_sd1_platdata, | ||
534 | }, | ||
535 | .name = "au1xxx-mmc", | ||
536 | .id = 1, | ||
537 | .resource = au1300_sd1_res, | ||
538 | .num_resources = ARRAY_SIZE(au1300_sd1_res), | ||
539 | }; | ||
540 | |||
541 | /**********************************************************************/ | ||
542 | |||
543 | static int db1300_movinand_inserted(void *mmc_host) | ||
544 | { | ||
545 | return 0; /* disable for now, it doesn't work yet */ | ||
546 | } | ||
547 | |||
548 | static int db1300_movinand_readonly(void *mmc_host) | ||
549 | { | ||
550 | return 0; | ||
551 | } | ||
552 | |||
553 | static void db1300_movinand_led_set(struct led_classdev *led, | ||
554 | enum led_brightness brightness) | ||
555 | { | ||
556 | if (brightness != LED_OFF) | ||
557 | bcsr_mod(BCSR_LEDS, BCSR_LEDS_LED1, 0); | ||
558 | else | ||
559 | bcsr_mod(BCSR_LEDS, 0, BCSR_LEDS_LED1); | ||
560 | } | ||
561 | |||
562 | static struct led_classdev db1300_movinand_led = { | ||
563 | .brightness_set = db1300_movinand_led_set, | ||
564 | }; | ||
565 | |||
566 | struct au1xmmc_platform_data db1300_sd0_platdata = { | ||
567 | .card_inserted = db1300_movinand_inserted, | ||
568 | .card_readonly = db1300_movinand_readonly, | ||
569 | .led = &db1300_movinand_led, | ||
570 | .mask_host_caps = MMC_CAP_NEEDS_POLL, | ||
571 | }; | ||
572 | |||
573 | static struct resource au1300_sd0_res[] = { | ||
574 | [0] = { | ||
575 | .start = AU1100_SD0_PHYS_ADDR, | ||
576 | .end = AU1100_SD0_PHYS_ADDR, | ||
577 | .flags = IORESOURCE_MEM, | ||
578 | }, | ||
579 | [1] = { | ||
580 | .start = AU1300_SD0_INT, | ||
581 | .end = AU1300_SD0_INT, | ||
582 | .flags = IORESOURCE_IRQ, | ||
583 | }, | ||
584 | [2] = { | ||
585 | .start = AU1300_DSCR_CMD0_SDMS_TX0, | ||
586 | .end = AU1300_DSCR_CMD0_SDMS_TX0, | ||
587 | .flags = IORESOURCE_DMA, | ||
588 | }, | ||
589 | [3] = { | ||
590 | .start = AU1300_DSCR_CMD0_SDMS_RX0, | ||
591 | .end = AU1300_DSCR_CMD0_SDMS_RX0, | ||
592 | .flags = IORESOURCE_DMA, | ||
593 | }, | ||
594 | }; | ||
595 | |||
596 | static struct platform_device db1300_sd0_dev = { | ||
597 | .dev = { | ||
598 | .platform_data = &db1300_sd0_platdata, | ||
599 | }, | ||
600 | .name = "au1xxx-mmc", | ||
601 | .id = 0, | ||
602 | .resource = au1300_sd0_res, | ||
603 | .num_resources = ARRAY_SIZE(au1300_sd0_res), | ||
604 | }; | ||
605 | |||
606 | /**********************************************************************/ | ||
607 | |||
608 | static struct platform_device db1300_wm9715_dev = { | ||
609 | .name = "wm9712-codec", | ||
610 | .id = 1, /* ID of PSC for AC97 audio, see asoc glue! */ | ||
611 | }; | ||
612 | |||
613 | static struct platform_device db1300_ac97dma_dev = { | ||
614 | .name = "au1xpsc-pcm", | ||
615 | .id = 1, /* PSC ID */ | ||
616 | }; | ||
617 | |||
618 | static struct platform_device db1300_i2sdma_dev = { | ||
619 | .name = "au1xpsc-pcm", | ||
620 | .id = 2, /* PSC ID */ | ||
621 | }; | ||
622 | |||
623 | static struct platform_device db1300_sndac97_dev = { | ||
624 | .name = "db1300-ac97", | ||
625 | }; | ||
626 | |||
627 | static struct platform_device db1300_sndi2s_dev = { | ||
628 | .name = "db1300-i2s", | ||
629 | }; | ||
630 | |||
631 | /**********************************************************************/ | ||
632 | |||
633 | static int db1300fb_panel_index(void) | ||
634 | { | ||
635 | return 9; /* DB1300_800x480 */ | ||
636 | } | ||
637 | |||
638 | static int db1300fb_panel_init(void) | ||
639 | { | ||
640 | /* Apply power (Vee/Vdd logic is inverted on Panel DB1300_800x480) */ | ||
641 | bcsr_mod(BCSR_BOARD, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD, | ||
642 | BCSR_BOARD_LCDBL); | ||
643 | return 0; | ||
644 | } | ||
645 | |||
646 | static int db1300fb_panel_shutdown(void) | ||
647 | { | ||
648 | /* Remove power (Vee/Vdd logic is inverted on Panel DB1300_800x480) */ | ||
649 | bcsr_mod(BCSR_BOARD, BCSR_BOARD_LCDBL, | ||
650 | BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD); | ||
651 | return 0; | ||
652 | } | ||
653 | |||
654 | static struct au1200fb_platdata db1300fb_pd = { | ||
655 | .panel_index = db1300fb_panel_index, | ||
656 | .panel_init = db1300fb_panel_init, | ||
657 | .panel_shutdown = db1300fb_panel_shutdown, | ||
658 | }; | ||
659 | |||
660 | static struct resource au1300_lcd_res[] = { | ||
661 | [0] = { | ||
662 | .start = AU1200_LCD_PHYS_ADDR, | ||
663 | .end = AU1200_LCD_PHYS_ADDR + 0x800 - 1, | ||
664 | .flags = IORESOURCE_MEM, | ||
665 | }, | ||
666 | [1] = { | ||
667 | .start = AU1300_LCD_INT, | ||
668 | .end = AU1300_LCD_INT, | ||
669 | .flags = IORESOURCE_IRQ, | ||
670 | } | ||
671 | }; | ||
672 | |||
673 | static u64 au1300_lcd_dmamask = DMA_BIT_MASK(32); | ||
674 | |||
675 | static struct platform_device db1300_lcd_dev = { | ||
676 | .name = "au1200-lcd", | ||
677 | .id = 0, | ||
678 | .dev = { | ||
679 | .dma_mask = &au1300_lcd_dmamask, | ||
680 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
681 | .platform_data = &db1300fb_pd, | ||
682 | }, | ||
683 | .num_resources = ARRAY_SIZE(au1300_lcd_res), | ||
684 | .resource = au1300_lcd_res, | ||
685 | }; | ||
686 | |||
687 | /**********************************************************************/ | ||
688 | |||
689 | static struct platform_device *db1300_dev[] __initdata = { | ||
690 | &db1300_eth_dev, | ||
691 | &db1300_i2c_dev, | ||
692 | &db1300_5waysw_dev, | ||
693 | &db1300_nand_dev, | ||
694 | &db1300_ide_dev, | ||
695 | &db1300_sd0_dev, | ||
696 | &db1300_sd1_dev, | ||
697 | &db1300_lcd_dev, | ||
698 | &db1300_ac97_dev, | ||
699 | &db1300_i2s_dev, | ||
700 | &db1300_wm9715_dev, | ||
701 | &db1300_ac97dma_dev, | ||
702 | &db1300_i2sdma_dev, | ||
703 | &db1300_sndac97_dev, | ||
704 | &db1300_sndi2s_dev, | ||
705 | }; | ||
706 | |||
707 | static int __init db1300_device_init(void) | ||
708 | { | ||
709 | int swapped, cpldirq; | ||
710 | |||
711 | /* setup CPLD IRQ muxer */ | ||
712 | cpldirq = au1300_gpio_to_irq(AU1300_PIN_EXTCLK1); | ||
713 | irq_set_irq_type(cpldirq, IRQ_TYPE_LEVEL_HIGH); | ||
714 | bcsr_init_irq(DB1300_FIRST_INT, DB1300_LAST_INT, cpldirq); | ||
715 | |||
716 | /* insert/eject IRQs: one always triggers so don't enable them | ||
717 | * when doing request_irq() on them. DB1200 has this bug too. | ||
718 | */ | ||
719 | irq_set_status_flags(DB1300_SD1_INSERT_INT, IRQ_NOAUTOEN); | ||
720 | irq_set_status_flags(DB1300_SD1_EJECT_INT, IRQ_NOAUTOEN); | ||
721 | irq_set_status_flags(DB1300_CF_INSERT_INT, IRQ_NOAUTOEN); | ||
722 | irq_set_status_flags(DB1300_CF_EJECT_INT, IRQ_NOAUTOEN); | ||
723 | |||
724 | /* | ||
725 | * setup board | ||
726 | */ | ||
727 | prom_get_ethernet_addr(&db1300_eth_config.mac[0]); | ||
728 | |||
729 | i2c_register_board_info(0, db1300_i2c_devs, | ||
730 | ARRAY_SIZE(db1300_i2c_devs)); | ||
731 | |||
732 | /* Audio PSC clock is supplied by codecs (PSC1, 2) */ | ||
733 | __raw_writel(PSC_SEL_CLK_SERCLK, | ||
734 | (void __iomem *)KSEG1ADDR(AU1300_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET); | ||
735 | wmb(); | ||
736 | __raw_writel(PSC_SEL_CLK_SERCLK, | ||
737 | (void __iomem *)KSEG1ADDR(AU1300_PSC2_PHYS_ADDR) + PSC_SEL_OFFSET); | ||
738 | wmb(); | ||
739 | /* I2C uses internal 48MHz EXTCLK1 */ | ||
740 | __raw_writel(PSC_SEL_CLK_INTCLK, | ||
741 | (void __iomem *)KSEG1ADDR(AU1300_PSC3_PHYS_ADDR) + PSC_SEL_OFFSET); | ||
742 | wmb(); | ||
743 | |||
744 | /* enable power to USB ports */ | ||
745 | bcsr_mod(BCSR_RESETS, 0, BCSR_RESETS_USBHPWR | BCSR_RESETS_OTGPWR); | ||
746 | |||
747 | /* although it is socket #0, it uses the CPLD bits which previous boards | ||
748 | * have used for socket #1. | ||
749 | */ | ||
750 | db1x_register_pcmcia_socket( | ||
751 | AU1000_PCMCIA_ATTR_PHYS_ADDR, | ||
752 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x00400000 - 1, | ||
753 | AU1000_PCMCIA_MEM_PHYS_ADDR, | ||
754 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x00400000 - 1, | ||
755 | AU1000_PCMCIA_IO_PHYS_ADDR, | ||
756 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x00010000 - 1, | ||
757 | DB1300_CF_INT, DB1300_CF_INSERT_INT, 0, DB1300_CF_EJECT_INT, 1); | ||
758 | |||
759 | swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1200_SWAPBOOT; | ||
760 | db1x_register_norflash(64 << 20, 2, swapped); | ||
761 | |||
762 | return platform_add_devices(db1300_dev, ARRAY_SIZE(db1300_dev)); | ||
763 | } | ||
764 | device_initcall(db1300_device_init); | ||
765 | |||
766 | |||
767 | void __init board_setup(void) | ||
768 | { | ||
769 | unsigned short whoami; | ||
770 | |||
771 | db1300_gpio_config(); | ||
772 | bcsr_init(DB1300_BCSR_PHYS_ADDR, | ||
773 | DB1300_BCSR_PHYS_ADDR + DB1300_BCSR_HEXLED_OFS); | ||
774 | |||
775 | whoami = bcsr_read(BCSR_WHOAMI); | ||
776 | printk(KERN_INFO "NetLogic DBAu1300 Development Platform.\n\t" | ||
777 | "BoardID %d CPLD Rev %d DaughtercardID %d\n", | ||
778 | BCSR_WHOAMI_BOARD(whoami), BCSR_WHOAMI_CPLD(whoami), | ||
779 | BCSR_WHOAMI_DCID(whoami)); | ||
780 | |||
781 | /* enable UARTs, YAMON only enables #2 */ | ||
782 | alchemy_uart_enable(AU1300_UART0_PHYS_ADDR); | ||
783 | alchemy_uart_enable(AU1300_UART1_PHYS_ADDR); | ||
784 | alchemy_uart_enable(AU1300_UART3_PHYS_ADDR); | ||
785 | } | ||
diff --git a/arch/mips/alchemy/devboards/db1550.c b/arch/mips/alchemy/devboards/db1550.c new file mode 100644 index 000000000000..6815d0783cd8 --- /dev/null +++ b/arch/mips/alchemy/devboards/db1550.c | |||
@@ -0,0 +1,498 @@ | |||
1 | /* | ||
2 | * Alchemy Db1550 board support | ||
3 | * | ||
4 | * (c) 2011 Manuel Lauss <manuel.lauss@googlemail.com> | ||
5 | */ | ||
6 | |||
7 | #include <linux/dma-mapping.h> | ||
8 | #include <linux/gpio.h> | ||
9 | #include <linux/i2c.h> | ||
10 | #include <linux/init.h> | ||
11 | #include <linux/io.h> | ||
12 | #include <linux/interrupt.h> | ||
13 | #include <linux/mtd/mtd.h> | ||
14 | #include <linux/mtd/nand.h> | ||
15 | #include <linux/mtd/partitions.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/pm.h> | ||
18 | #include <linux/spi/spi.h> | ||
19 | #include <linux/spi/flash.h> | ||
20 | #include <asm/mach-au1x00/au1000.h> | ||
21 | #include <asm/mach-au1x00/au1xxx_eth.h> | ||
22 | #include <asm/mach-au1x00/au1xxx_dbdma.h> | ||
23 | #include <asm/mach-au1x00/au1xxx_psc.h> | ||
24 | #include <asm/mach-au1x00/au1550_spi.h> | ||
25 | #include <asm/mach-db1x00/bcsr.h> | ||
26 | #include <prom.h> | ||
27 | #include "platform.h" | ||
28 | |||
29 | |||
30 | const char *get_system_type(void) | ||
31 | { | ||
32 | return "DB1550"; | ||
33 | } | ||
34 | |||
35 | static void __init db1550_hw_setup(void) | ||
36 | { | ||
37 | void __iomem *base; | ||
38 | |||
39 | alchemy_gpio_direction_output(203, 0); /* red led on */ | ||
40 | |||
41 | /* complete SPI setup: link psc0_intclk to a 48MHz source, | ||
42 | * and assign GPIO16 to PSC0_SYNC1 (SPI cs# line) | ||
43 | */ | ||
44 | base = (void __iomem *)SYS_CLKSRC; | ||
45 | __raw_writel(__raw_readl(base) | 0x000001e0, base); | ||
46 | base = (void __iomem *)SYS_PINFUNC; | ||
47 | __raw_writel(__raw_readl(base) | 1, base); | ||
48 | wmb(); | ||
49 | |||
50 | /* reset the AC97 codec now, the reset time in the psc-ac97 driver | ||
51 | * is apparently too short although it's ridiculous as it is. | ||
52 | */ | ||
53 | base = (void __iomem *)KSEG1ADDR(AU1550_PSC1_PHYS_ADDR); | ||
54 | __raw_writel(PSC_SEL_CLK_SERCLK | PSC_SEL_PS_AC97MODE, | ||
55 | base + PSC_SEL_OFFSET); | ||
56 | __raw_writel(PSC_CTRL_DISABLE, base + PSC_CTRL_OFFSET); | ||
57 | wmb(); | ||
58 | __raw_writel(PSC_AC97RST_RST, base + PSC_AC97RST_OFFSET); | ||
59 | wmb(); | ||
60 | |||
61 | alchemy_gpio_direction_output(202, 0); /* green led on */ | ||
62 | } | ||
63 | |||
64 | void __init board_setup(void) | ||
65 | { | ||
66 | unsigned short whoami; | ||
67 | |||
68 | bcsr_init(DB1550_BCSR_PHYS_ADDR, | ||
69 | DB1550_BCSR_PHYS_ADDR + DB1550_BCSR_HEXLED_OFS); | ||
70 | |||
71 | whoami = bcsr_read(BCSR_WHOAMI); | ||
72 | printk(KERN_INFO "Alchemy/AMD DB1550 Board, CPLD Rev %d" | ||
73 | " Board-ID %d Daughtercard ID %d\n", | ||
74 | (whoami >> 4) & 0xf, (whoami >> 8) & 0xf, whoami & 0xf); | ||
75 | |||
76 | db1550_hw_setup(); | ||
77 | } | ||
78 | |||
79 | /*****************************************************************************/ | ||
80 | |||
81 | static struct mtd_partition db1550_spiflash_parts[] = { | ||
82 | { | ||
83 | .name = "spi_flash", | ||
84 | .offset = 0, | ||
85 | .size = MTDPART_SIZ_FULL, | ||
86 | }, | ||
87 | }; | ||
88 | |||
89 | static struct flash_platform_data db1550_spiflash_data = { | ||
90 | .name = "s25fl010", | ||
91 | .parts = db1550_spiflash_parts, | ||
92 | .nr_parts = ARRAY_SIZE(db1550_spiflash_parts), | ||
93 | .type = "m25p10", | ||
94 | }; | ||
95 | |||
96 | static struct spi_board_info db1550_spi_devs[] __initdata = { | ||
97 | { | ||
98 | /* TI TMP121AIDBVR temp sensor */ | ||
99 | .modalias = "tmp121", | ||
100 | .max_speed_hz = 2400000, | ||
101 | .bus_num = 0, | ||
102 | .chip_select = 0, | ||
103 | .mode = SPI_MODE_0, | ||
104 | }, | ||
105 | { | ||
106 | /* Spansion S25FL001D0FMA SPI flash */ | ||
107 | .modalias = "m25p80", | ||
108 | .max_speed_hz = 2400000, | ||
109 | .bus_num = 0, | ||
110 | .chip_select = 1, | ||
111 | .mode = SPI_MODE_0, | ||
112 | .platform_data = &db1550_spiflash_data, | ||
113 | }, | ||
114 | }; | ||
115 | |||
116 | static struct i2c_board_info db1550_i2c_devs[] __initdata = { | ||
117 | { I2C_BOARD_INFO("24c04", 0x52),}, /* AT24C04-10 I2C eeprom */ | ||
118 | { I2C_BOARD_INFO("ne1619", 0x2d),}, /* adm1025-compat hwmon */ | ||
119 | { I2C_BOARD_INFO("wm8731", 0x1b),}, /* I2S audio codec WM8731 */ | ||
120 | }; | ||
121 | |||
122 | /**********************************************************************/ | ||
123 | |||
124 | static void au1550_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, | ||
125 | unsigned int ctrl) | ||
126 | { | ||
127 | struct nand_chip *this = mtd->priv; | ||
128 | unsigned long ioaddr = (unsigned long)this->IO_ADDR_W; | ||
129 | |||
130 | ioaddr &= 0xffffff00; | ||
131 | |||
132 | if (ctrl & NAND_CLE) { | ||
133 | ioaddr += MEM_STNAND_CMD; | ||
134 | } else if (ctrl & NAND_ALE) { | ||
135 | ioaddr += MEM_STNAND_ADDR; | ||
136 | } else { | ||
137 | /* assume we want to r/w real data by default */ | ||
138 | ioaddr += MEM_STNAND_DATA; | ||
139 | } | ||
140 | this->IO_ADDR_R = this->IO_ADDR_W = (void __iomem *)ioaddr; | ||
141 | if (cmd != NAND_CMD_NONE) { | ||
142 | __raw_writeb(cmd, this->IO_ADDR_W); | ||
143 | wmb(); | ||
144 | } | ||
145 | } | ||
146 | |||
147 | static int au1550_nand_device_ready(struct mtd_info *mtd) | ||
148 | { | ||
149 | return __raw_readl((void __iomem *)MEM_STSTAT) & 1; | ||
150 | } | ||
151 | |||
152 | static const char *db1550_part_probes[] = { "cmdlinepart", NULL }; | ||
153 | |||
154 | static struct mtd_partition db1550_nand_parts[] = { | ||
155 | { | ||
156 | .name = "NAND FS 0", | ||
157 | .offset = 0, | ||
158 | .size = 8 * 1024 * 1024, | ||
159 | }, | ||
160 | { | ||
161 | .name = "NAND FS 1", | ||
162 | .offset = MTDPART_OFS_APPEND, | ||
163 | .size = MTDPART_SIZ_FULL | ||
164 | }, | ||
165 | }; | ||
166 | |||
167 | struct platform_nand_data db1550_nand_platdata = { | ||
168 | .chip = { | ||
169 | .nr_chips = 1, | ||
170 | .chip_offset = 0, | ||
171 | .nr_partitions = ARRAY_SIZE(db1550_nand_parts), | ||
172 | .partitions = db1550_nand_parts, | ||
173 | .chip_delay = 20, | ||
174 | .part_probe_types = db1550_part_probes, | ||
175 | }, | ||
176 | .ctrl = { | ||
177 | .dev_ready = au1550_nand_device_ready, | ||
178 | .cmd_ctrl = au1550_nand_cmd_ctrl, | ||
179 | }, | ||
180 | }; | ||
181 | |||
182 | static struct resource db1550_nand_res[] = { | ||
183 | [0] = { | ||
184 | .start = 0x20000000, | ||
185 | .end = 0x200000ff, | ||
186 | .flags = IORESOURCE_MEM, | ||
187 | }, | ||
188 | }; | ||
189 | |||
190 | static struct platform_device db1550_nand_dev = { | ||
191 | .name = "gen_nand", | ||
192 | .num_resources = ARRAY_SIZE(db1550_nand_res), | ||
193 | .resource = db1550_nand_res, | ||
194 | .id = -1, | ||
195 | .dev = { | ||
196 | .platform_data = &db1550_nand_platdata, | ||
197 | } | ||
198 | }; | ||
199 | |||
200 | /**********************************************************************/ | ||
201 | |||
202 | static struct resource au1550_psc0_res[] = { | ||
203 | [0] = { | ||
204 | .start = AU1550_PSC0_PHYS_ADDR, | ||
205 | .end = AU1550_PSC0_PHYS_ADDR + 0xfff, | ||
206 | .flags = IORESOURCE_MEM, | ||
207 | }, | ||
208 | [1] = { | ||
209 | .start = AU1550_PSC0_INT, | ||
210 | .end = AU1550_PSC0_INT, | ||
211 | .flags = IORESOURCE_IRQ, | ||
212 | }, | ||
213 | [2] = { | ||
214 | .start = AU1550_DSCR_CMD0_PSC0_TX, | ||
215 | .end = AU1550_DSCR_CMD0_PSC0_TX, | ||
216 | .flags = IORESOURCE_DMA, | ||
217 | }, | ||
218 | [3] = { | ||
219 | .start = AU1550_DSCR_CMD0_PSC0_RX, | ||
220 | .end = AU1550_DSCR_CMD0_PSC0_RX, | ||
221 | .flags = IORESOURCE_DMA, | ||
222 | }, | ||
223 | }; | ||
224 | |||
225 | static void db1550_spi_cs_en(struct au1550_spi_info *spi, int cs, int pol) | ||
226 | { | ||
227 | if (cs) | ||
228 | bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_SPISEL); | ||
229 | else | ||
230 | bcsr_mod(BCSR_BOARD, BCSR_BOARD_SPISEL, 0); | ||
231 | } | ||
232 | |||
233 | static struct au1550_spi_info db1550_spi_platdata = { | ||
234 | .mainclk_hz = 48000000, /* PSC0 clock: max. 2.4MHz SPI clk */ | ||
235 | .num_chipselect = 2, | ||
236 | .activate_cs = db1550_spi_cs_en, | ||
237 | }; | ||
238 | |||
239 | static u64 spi_dmamask = DMA_BIT_MASK(32); | ||
240 | |||
241 | static struct platform_device db1550_spi_dev = { | ||
242 | .dev = { | ||
243 | .dma_mask = &spi_dmamask, | ||
244 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
245 | .platform_data = &db1550_spi_platdata, | ||
246 | }, | ||
247 | .name = "au1550-spi", | ||
248 | .id = 0, /* bus number */ | ||
249 | .num_resources = ARRAY_SIZE(au1550_psc0_res), | ||
250 | .resource = au1550_psc0_res, | ||
251 | }; | ||
252 | |||
253 | /**********************************************************************/ | ||
254 | |||
255 | static struct resource au1550_psc1_res[] = { | ||
256 | [0] = { | ||
257 | .start = AU1550_PSC1_PHYS_ADDR, | ||
258 | .end = AU1550_PSC1_PHYS_ADDR + 0xfff, | ||
259 | .flags = IORESOURCE_MEM, | ||
260 | }, | ||
261 | [1] = { | ||
262 | .start = AU1550_PSC1_INT, | ||
263 | .end = AU1550_PSC1_INT, | ||
264 | .flags = IORESOURCE_IRQ, | ||
265 | }, | ||
266 | [2] = { | ||
267 | .start = AU1550_DSCR_CMD0_PSC1_TX, | ||
268 | .end = AU1550_DSCR_CMD0_PSC1_TX, | ||
269 | .flags = IORESOURCE_DMA, | ||
270 | }, | ||
271 | [3] = { | ||
272 | .start = AU1550_DSCR_CMD0_PSC1_RX, | ||
273 | .end = AU1550_DSCR_CMD0_PSC1_RX, | ||
274 | .flags = IORESOURCE_DMA, | ||
275 | }, | ||
276 | }; | ||
277 | |||
278 | static struct platform_device db1550_ac97_dev = { | ||
279 | .name = "au1xpsc_ac97", | ||
280 | .id = 1, /* PSC ID */ | ||
281 | .num_resources = ARRAY_SIZE(au1550_psc1_res), | ||
282 | .resource = au1550_psc1_res, | ||
283 | }; | ||
284 | |||
285 | |||
286 | static struct resource au1550_psc2_res[] = { | ||
287 | [0] = { | ||
288 | .start = AU1550_PSC2_PHYS_ADDR, | ||
289 | .end = AU1550_PSC2_PHYS_ADDR + 0xfff, | ||
290 | .flags = IORESOURCE_MEM, | ||
291 | }, | ||
292 | [1] = { | ||
293 | .start = AU1550_PSC2_INT, | ||
294 | .end = AU1550_PSC2_INT, | ||
295 | .flags = IORESOURCE_IRQ, | ||
296 | }, | ||
297 | [2] = { | ||
298 | .start = AU1550_DSCR_CMD0_PSC2_TX, | ||
299 | .end = AU1550_DSCR_CMD0_PSC2_TX, | ||
300 | .flags = IORESOURCE_DMA, | ||
301 | }, | ||
302 | [3] = { | ||
303 | .start = AU1550_DSCR_CMD0_PSC2_RX, | ||
304 | .end = AU1550_DSCR_CMD0_PSC2_RX, | ||
305 | .flags = IORESOURCE_DMA, | ||
306 | }, | ||
307 | }; | ||
308 | |||
309 | static struct platform_device db1550_i2c_dev = { | ||
310 | .name = "au1xpsc_smbus", | ||
311 | .id = 0, /* bus number */ | ||
312 | .num_resources = ARRAY_SIZE(au1550_psc2_res), | ||
313 | .resource = au1550_psc2_res, | ||
314 | }; | ||
315 | |||
316 | /**********************************************************************/ | ||
317 | |||
318 | static struct resource au1550_psc3_res[] = { | ||
319 | [0] = { | ||
320 | .start = AU1550_PSC3_PHYS_ADDR, | ||
321 | .end = AU1550_PSC3_PHYS_ADDR + 0xfff, | ||
322 | .flags = IORESOURCE_MEM, | ||
323 | }, | ||
324 | [1] = { | ||
325 | .start = AU1550_PSC3_INT, | ||
326 | .end = AU1550_PSC3_INT, | ||
327 | .flags = IORESOURCE_IRQ, | ||
328 | }, | ||
329 | [2] = { | ||
330 | .start = AU1550_DSCR_CMD0_PSC3_TX, | ||
331 | .end = AU1550_DSCR_CMD0_PSC3_TX, | ||
332 | .flags = IORESOURCE_DMA, | ||
333 | }, | ||
334 | [3] = { | ||
335 | .start = AU1550_DSCR_CMD0_PSC3_RX, | ||
336 | .end = AU1550_DSCR_CMD0_PSC3_RX, | ||
337 | .flags = IORESOURCE_DMA, | ||
338 | }, | ||
339 | }; | ||
340 | |||
341 | static struct platform_device db1550_i2s_dev = { | ||
342 | .name = "au1xpsc_i2s", | ||
343 | .id = 3, /* PSC ID */ | ||
344 | .num_resources = ARRAY_SIZE(au1550_psc3_res), | ||
345 | .resource = au1550_psc3_res, | ||
346 | }; | ||
347 | |||
348 | /**********************************************************************/ | ||
349 | |||
350 | static struct platform_device db1550_stac_dev = { | ||
351 | .name = "ac97-codec", | ||
352 | .id = 1, /* on PSC1 */ | ||
353 | }; | ||
354 | |||
355 | static struct platform_device db1550_ac97dma_dev = { | ||
356 | .name = "au1xpsc-pcm", | ||
357 | .id = 1, /* on PSC3 */ | ||
358 | }; | ||
359 | |||
360 | static struct platform_device db1550_i2sdma_dev = { | ||
361 | .name = "au1xpsc-pcm", | ||
362 | .id = 3, /* on PSC3 */ | ||
363 | }; | ||
364 | |||
365 | static struct platform_device db1550_sndac97_dev = { | ||
366 | .name = "db1550-ac97", | ||
367 | }; | ||
368 | |||
369 | static struct platform_device db1550_sndi2s_dev = { | ||
370 | .name = "db1550-i2s", | ||
371 | }; | ||
372 | |||
373 | /**********************************************************************/ | ||
374 | |||
375 | static int db1550_map_pci_irq(const struct pci_dev *d, u8 slot, u8 pin) | ||
376 | { | ||
377 | if ((slot < 11) || (slot > 13) || pin == 0) | ||
378 | return -1; | ||
379 | if (slot == 11) | ||
380 | return (pin == 1) ? AU1550_PCI_INTC : 0xff; | ||
381 | if (slot == 12) { | ||
382 | switch (pin) { | ||
383 | case 1: return AU1550_PCI_INTB; | ||
384 | case 2: return AU1550_PCI_INTC; | ||
385 | case 3: return AU1550_PCI_INTD; | ||
386 | case 4: return AU1550_PCI_INTA; | ||
387 | } | ||
388 | } | ||
389 | if (slot == 13) { | ||
390 | switch (pin) { | ||
391 | case 1: return AU1550_PCI_INTA; | ||
392 | case 2: return AU1550_PCI_INTB; | ||
393 | case 3: return AU1550_PCI_INTC; | ||
394 | case 4: return AU1550_PCI_INTD; | ||
395 | } | ||
396 | } | ||
397 | return -1; | ||
398 | } | ||
399 | |||
400 | static struct resource alchemy_pci_host_res[] = { | ||
401 | [0] = { | ||
402 | .start = AU1500_PCI_PHYS_ADDR, | ||
403 | .end = AU1500_PCI_PHYS_ADDR + 0xfff, | ||
404 | .flags = IORESOURCE_MEM, | ||
405 | }, | ||
406 | }; | ||
407 | |||
408 | static struct alchemy_pci_platdata db1550_pci_pd = { | ||
409 | .board_map_irq = db1550_map_pci_irq, | ||
410 | }; | ||
411 | |||
412 | static struct platform_device db1550_pci_host_dev = { | ||
413 | .dev.platform_data = &db1550_pci_pd, | ||
414 | .name = "alchemy-pci", | ||
415 | .id = 0, | ||
416 | .num_resources = ARRAY_SIZE(alchemy_pci_host_res), | ||
417 | .resource = alchemy_pci_host_res, | ||
418 | }; | ||
419 | |||
420 | /**********************************************************************/ | ||
421 | |||
422 | static struct platform_device *db1550_devs[] __initdata = { | ||
423 | &db1550_nand_dev, | ||
424 | &db1550_i2c_dev, | ||
425 | &db1550_ac97_dev, | ||
426 | &db1550_spi_dev, | ||
427 | &db1550_i2s_dev, | ||
428 | &db1550_stac_dev, | ||
429 | &db1550_ac97dma_dev, | ||
430 | &db1550_i2sdma_dev, | ||
431 | &db1550_sndac97_dev, | ||
432 | &db1550_sndi2s_dev, | ||
433 | }; | ||
434 | |||
435 | /* must be arch_initcall; MIPS PCI scans busses in a subsys_initcall */ | ||
436 | static int __init db1550_pci_init(void) | ||
437 | { | ||
438 | return platform_device_register(&db1550_pci_host_dev); | ||
439 | } | ||
440 | arch_initcall(db1550_pci_init); | ||
441 | |||
442 | static int __init db1550_dev_init(void) | ||
443 | { | ||
444 | int swapped; | ||
445 | |||
446 | irq_set_irq_type(AU1550_GPIO0_INT, IRQ_TYPE_EDGE_BOTH); /* CD0# */ | ||
447 | irq_set_irq_type(AU1550_GPIO1_INT, IRQ_TYPE_EDGE_BOTH); /* CD1# */ | ||
448 | irq_set_irq_type(AU1550_GPIO3_INT, IRQ_TYPE_LEVEL_LOW); /* CARD0# */ | ||
449 | irq_set_irq_type(AU1550_GPIO5_INT, IRQ_TYPE_LEVEL_LOW); /* CARD1# */ | ||
450 | irq_set_irq_type(AU1550_GPIO21_INT, IRQ_TYPE_LEVEL_LOW); /* STSCHG0# */ | ||
451 | irq_set_irq_type(AU1550_GPIO22_INT, IRQ_TYPE_LEVEL_LOW); /* STSCHG1# */ | ||
452 | |||
453 | i2c_register_board_info(0, db1550_i2c_devs, | ||
454 | ARRAY_SIZE(db1550_i2c_devs)); | ||
455 | spi_register_board_info(db1550_spi_devs, | ||
456 | ARRAY_SIZE(db1550_i2c_devs)); | ||
457 | |||
458 | /* Audio PSC clock is supplied by codecs (PSC1, 3) FIXME: platdata!! */ | ||
459 | __raw_writel(PSC_SEL_CLK_SERCLK, | ||
460 | (void __iomem *)KSEG1ADDR(AU1550_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET); | ||
461 | wmb(); | ||
462 | __raw_writel(PSC_SEL_CLK_SERCLK, | ||
463 | (void __iomem *)KSEG1ADDR(AU1550_PSC3_PHYS_ADDR) + PSC_SEL_OFFSET); | ||
464 | wmb(); | ||
465 | /* SPI/I2C use internally supplied 50MHz source */ | ||
466 | __raw_writel(PSC_SEL_CLK_INTCLK, | ||
467 | (void __iomem *)KSEG1ADDR(AU1550_PSC0_PHYS_ADDR) + PSC_SEL_OFFSET); | ||
468 | wmb(); | ||
469 | __raw_writel(PSC_SEL_CLK_INTCLK, | ||
470 | (void __iomem *)KSEG1ADDR(AU1550_PSC2_PHYS_ADDR) + PSC_SEL_OFFSET); | ||
471 | wmb(); | ||
472 | |||
473 | db1x_register_pcmcia_socket( | ||
474 | AU1000_PCMCIA_ATTR_PHYS_ADDR, | ||
475 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1, | ||
476 | AU1000_PCMCIA_MEM_PHYS_ADDR, | ||
477 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x000400000 - 1, | ||
478 | AU1000_PCMCIA_IO_PHYS_ADDR, | ||
479 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x000010000 - 1, | ||
480 | AU1550_GPIO3_INT, AU1550_GPIO0_INT, | ||
481 | /*AU1550_GPIO21_INT*/0, 0, 0); | ||
482 | |||
483 | db1x_register_pcmcia_socket( | ||
484 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004000000, | ||
485 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004400000 - 1, | ||
486 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x004000000, | ||
487 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x004400000 - 1, | ||
488 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x004000000, | ||
489 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x004010000 - 1, | ||
490 | AU1550_GPIO5_INT, AU1550_GPIO1_INT, | ||
491 | /*AU1550_GPIO22_INT*/0, 0, 1); | ||
492 | |||
493 | swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1000_SWAPBOOT; | ||
494 | db1x_register_norflash(128 << 20, 4, swapped); | ||
495 | |||
496 | return platform_add_devices(db1550_devs, ARRAY_SIZE(db1550_devs)); | ||
497 | } | ||
498 | device_initcall(db1550_dev_init); | ||
diff --git a/arch/mips/alchemy/devboards/db1x00/Makefile b/arch/mips/alchemy/devboards/db1x00/Makefile deleted file mode 100644 index 613c0c0c8be9..000000000000 --- a/arch/mips/alchemy/devboards/db1x00/Makefile +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | # | ||
2 | # Copyright 2000, 2008 MontaVista Software Inc. | ||
3 | # Author: MontaVista Software, Inc. <source@mvista.com> | ||
4 | # | ||
5 | # Makefile for the Alchemy Semiconductor DBAu1xx0 boards. | ||
6 | # | ||
7 | |||
8 | obj-y := board_setup.o platform.o | ||
diff --git a/arch/mips/alchemy/devboards/db1x00/board_setup.c b/arch/mips/alchemy/devboards/db1x00/board_setup.c deleted file mode 100644 index 7cd36e631f6c..000000000000 --- a/arch/mips/alchemy/devboards/db1x00/board_setup.c +++ /dev/null | |||
@@ -1,229 +0,0 @@ | |||
1 | /* | ||
2 | * | ||
3 | * BRIEF MODULE DESCRIPTION | ||
4 | * Alchemy Db1x00 board setup. | ||
5 | * | ||
6 | * Copyright 2000, 2008 MontaVista Software Inc. | ||
7 | * Author: MontaVista Software, Inc. <source@mvista.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the | ||
11 | * Free Software Foundation; either version 2 of the License, or (at your | ||
12 | * option) any later version. | ||
13 | * | ||
14 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
15 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
16 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
17 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
20 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
24 | * | ||
25 | * You should have received a copy of the GNU General Public License along | ||
26 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
27 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
28 | */ | ||
29 | |||
30 | #include <linux/gpio.h> | ||
31 | #include <linux/init.h> | ||
32 | #include <linux/interrupt.h> | ||
33 | #include <linux/pm.h> | ||
34 | |||
35 | #include <asm/mach-au1x00/au1000.h> | ||
36 | #include <asm/mach-au1x00/au1xxx_eth.h> | ||
37 | #include <asm/mach-db1x00/db1x00.h> | ||
38 | #include <asm/mach-db1x00/bcsr.h> | ||
39 | #include <asm/reboot.h> | ||
40 | |||
41 | #include <prom.h> | ||
42 | |||
43 | #ifdef CONFIG_MIPS_BOSPORUS | ||
44 | char irq_tab_alchemy[][5] __initdata = { | ||
45 | [11] = { -1, AU1500_PCI_INTA, AU1500_PCI_INTB, 0xff, 0xff }, /* IDSEL 11 - miniPCI */ | ||
46 | [12] = { -1, AU1500_PCI_INTA, 0xff, 0xff, 0xff }, /* IDSEL 12 - SN1741 */ | ||
47 | [13] = { -1, AU1500_PCI_INTA, AU1500_PCI_INTB, AU1500_PCI_INTC, AU1500_PCI_INTD }, /* IDSEL 13 - PCI slot */ | ||
48 | }; | ||
49 | |||
50 | /* | ||
51 | * Micrel/Kendin 5 port switch attached to MAC0, | ||
52 | * MAC0 is associated with PHY address 5 (== WAN port) | ||
53 | * MAC1 is not associated with any PHY, since it's connected directly | ||
54 | * to the switch. | ||
55 | * no interrupts are used | ||
56 | */ | ||
57 | static struct au1000_eth_platform_data eth0_pdata = { | ||
58 | .phy_static_config = 1, | ||
59 | .phy_addr = 5, | ||
60 | }; | ||
61 | |||
62 | static void bosporus_power_off(void) | ||
63 | { | ||
64 | while (1) | ||
65 | asm volatile (".set mips3 ; wait ; .set mips0"); | ||
66 | } | ||
67 | |||
68 | const char *get_system_type(void) | ||
69 | { | ||
70 | return "Alchemy Bosporus Gateway Reference"; | ||
71 | } | ||
72 | #endif | ||
73 | |||
74 | |||
75 | #ifdef CONFIG_MIPS_MIRAGE | ||
76 | static void mirage_power_off(void) | ||
77 | { | ||
78 | alchemy_gpio_direction_output(210, 1); | ||
79 | } | ||
80 | |||
81 | const char *get_system_type(void) | ||
82 | { | ||
83 | return "Alchemy Mirage"; | ||
84 | } | ||
85 | #endif | ||
86 | |||
87 | |||
88 | #if defined(CONFIG_MIPS_BOSPORUS) || defined(CONFIG_MIPS_MIRAGE) | ||
89 | static void mips_softreset(void) | ||
90 | { | ||
91 | asm volatile ("jr\t%0" : : "r"(0xbfc00000)); | ||
92 | } | ||
93 | |||
94 | #else | ||
95 | |||
96 | const char *get_system_type(void) | ||
97 | { | ||
98 | return "Alchemy Db1x00"; | ||
99 | } | ||
100 | #endif | ||
101 | |||
102 | |||
103 | void __init board_setup(void) | ||
104 | { | ||
105 | unsigned long bcsr1, bcsr2; | ||
106 | |||
107 | bcsr1 = DB1000_BCSR_PHYS_ADDR; | ||
108 | bcsr2 = DB1000_BCSR_PHYS_ADDR + DB1000_BCSR_HEXLED_OFS; | ||
109 | |||
110 | #ifdef CONFIG_MIPS_DB1000 | ||
111 | printk(KERN_INFO "AMD Alchemy Au1000/Db1000 Board\n"); | ||
112 | #endif | ||
113 | #ifdef CONFIG_MIPS_DB1500 | ||
114 | printk(KERN_INFO "AMD Alchemy Au1500/Db1500 Board\n"); | ||
115 | #endif | ||
116 | #ifdef CONFIG_MIPS_DB1100 | ||
117 | printk(KERN_INFO "AMD Alchemy Au1100/Db1100 Board\n"); | ||
118 | #endif | ||
119 | #ifdef CONFIG_MIPS_BOSPORUS | ||
120 | au1xxx_override_eth_cfg(0, ð0_pdata); | ||
121 | |||
122 | printk(KERN_INFO "AMD Alchemy Bosporus Board\n"); | ||
123 | #endif | ||
124 | #ifdef CONFIG_MIPS_MIRAGE | ||
125 | printk(KERN_INFO "AMD Alchemy Mirage Board\n"); | ||
126 | #endif | ||
127 | #ifdef CONFIG_MIPS_DB1550 | ||
128 | printk(KERN_INFO "AMD Alchemy Au1550/Db1550 Board\n"); | ||
129 | |||
130 | bcsr1 = DB1550_BCSR_PHYS_ADDR; | ||
131 | bcsr2 = DB1550_BCSR_PHYS_ADDR + DB1550_BCSR_HEXLED_OFS; | ||
132 | #endif | ||
133 | |||
134 | /* initialize board register space */ | ||
135 | bcsr_init(bcsr1, bcsr2); | ||
136 | |||
137 | #if defined(CONFIG_IRDA) && defined(CONFIG_AU1000_FIR) | ||
138 | { | ||
139 | u32 pin_func; | ||
140 | |||
141 | /* Set IRFIRSEL instead of GPIO15 */ | ||
142 | pin_func = au_readl(SYS_PINFUNC) | SYS_PF_IRF; | ||
143 | au_writel(pin_func, SYS_PINFUNC); | ||
144 | /* Power off until the driver is in use */ | ||
145 | bcsr_mod(BCSR_RESETS, BCSR_RESETS_IRDA_MODE_MASK, | ||
146 | BCSR_RESETS_IRDA_MODE_OFF); | ||
147 | } | ||
148 | #endif | ||
149 | bcsr_write(BCSR_PCMCIA, 0); /* turn off PCMCIA power */ | ||
150 | |||
151 | /* Enable GPIO[31:0] inputs */ | ||
152 | alchemy_gpio1_input_enable(); | ||
153 | |||
154 | #ifdef CONFIG_MIPS_MIRAGE | ||
155 | { | ||
156 | u32 pin_func; | ||
157 | |||
158 | /* GPIO[20] is output */ | ||
159 | alchemy_gpio_direction_output(20, 0); | ||
160 | |||
161 | /* Set GPIO[210:208] instead of SSI_0 */ | ||
162 | pin_func = au_readl(SYS_PINFUNC) | SYS_PF_S0; | ||
163 | |||
164 | /* Set GPIO[215:211] for LEDs */ | ||
165 | pin_func |= 5 << 2; | ||
166 | |||
167 | /* Set GPIO[214:213] for more LEDs */ | ||
168 | pin_func |= 5 << 12; | ||
169 | |||
170 | /* Set GPIO[207:200] instead of PCMCIA/LCD */ | ||
171 | pin_func |= SYS_PF_LCD | SYS_PF_PC; | ||
172 | au_writel(pin_func, SYS_PINFUNC); | ||
173 | |||
174 | /* | ||
175 | * Enable speaker amplifier. This should | ||
176 | * be part of the audio driver. | ||
177 | */ | ||
178 | alchemy_gpio_direction_output(209, 1); | ||
179 | |||
180 | pm_power_off = mirage_power_off; | ||
181 | _machine_halt = mirage_power_off; | ||
182 | _machine_restart = (void(*)(char *))mips_softreset; | ||
183 | } | ||
184 | #endif | ||
185 | |||
186 | #ifdef CONFIG_MIPS_BOSPORUS | ||
187 | pm_power_off = bosporus_power_off; | ||
188 | _machine_halt = bosporus_power_off; | ||
189 | _machine_restart = (void(*)(char *))mips_softreset; | ||
190 | #endif | ||
191 | au_sync(); | ||
192 | } | ||
193 | |||
194 | static int __init db1x00_init_irq(void) | ||
195 | { | ||
196 | #if defined(CONFIG_MIPS_MIRAGE) | ||
197 | irq_set_irq_type(AU1500_GPIO7_INT, IRQF_TRIGGER_RISING); /* TS pendown */ | ||
198 | #elif defined(CONFIG_MIPS_DB1550) | ||
199 | irq_set_irq_type(AU1550_GPIO0_INT, IRQF_TRIGGER_LOW); /* CD0# */ | ||
200 | irq_set_irq_type(AU1550_GPIO1_INT, IRQF_TRIGGER_LOW); /* CD1# */ | ||
201 | irq_set_irq_type(AU1550_GPIO3_INT, IRQF_TRIGGER_LOW); /* CARD0# */ | ||
202 | irq_set_irq_type(AU1550_GPIO5_INT, IRQF_TRIGGER_LOW); /* CARD1# */ | ||
203 | irq_set_irq_type(AU1550_GPIO21_INT, IRQF_TRIGGER_LOW); /* STSCHG0# */ | ||
204 | irq_set_irq_type(AU1550_GPIO22_INT, IRQF_TRIGGER_LOW); /* STSCHG1# */ | ||
205 | #elif defined(CONFIG_MIPS_DB1500) | ||
206 | irq_set_irq_type(AU1500_GPIO0_INT, IRQF_TRIGGER_LOW); /* CD0# */ | ||
207 | irq_set_irq_type(AU1500_GPIO3_INT, IRQF_TRIGGER_LOW); /* CD1# */ | ||
208 | irq_set_irq_type(AU1500_GPIO2_INT, IRQF_TRIGGER_LOW); /* CARD0# */ | ||
209 | irq_set_irq_type(AU1500_GPIO5_INT, IRQF_TRIGGER_LOW); /* CARD1# */ | ||
210 | irq_set_irq_type(AU1500_GPIO1_INT, IRQF_TRIGGER_LOW); /* STSCHG0# */ | ||
211 | irq_set_irq_type(AU1500_GPIO4_INT, IRQF_TRIGGER_LOW); /* STSCHG1# */ | ||
212 | #elif defined(CONFIG_MIPS_DB1100) | ||
213 | irq_set_irq_type(AU1100_GPIO0_INT, IRQF_TRIGGER_LOW); /* CD0# */ | ||
214 | irq_set_irq_type(AU1100_GPIO3_INT, IRQF_TRIGGER_LOW); /* CD1# */ | ||
215 | irq_set_irq_type(AU1100_GPIO2_INT, IRQF_TRIGGER_LOW); /* CARD0# */ | ||
216 | irq_set_irq_type(AU1100_GPIO5_INT, IRQF_TRIGGER_LOW); /* CARD1# */ | ||
217 | irq_set_irq_type(AU1100_GPIO1_INT, IRQF_TRIGGER_LOW); /* STSCHG0# */ | ||
218 | irq_set_irq_type(AU1100_GPIO4_INT, IRQF_TRIGGER_LOW); /* STSCHG1# */ | ||
219 | #elif defined(CONFIG_MIPS_DB1000) | ||
220 | irq_set_irq_type(AU1000_GPIO0_INT, IRQF_TRIGGER_LOW); /* CD0# */ | ||
221 | irq_set_irq_type(AU1000_GPIO3_INT, IRQF_TRIGGER_LOW); /* CD1# */ | ||
222 | irq_set_irq_type(AU1000_GPIO2_INT, IRQF_TRIGGER_LOW); /* CARD0# */ | ||
223 | irq_set_irq_type(AU1000_GPIO5_INT, IRQF_TRIGGER_LOW); /* CARD1# */ | ||
224 | irq_set_irq_type(AU1000_GPIO1_INT, IRQF_TRIGGER_LOW); /* STSCHG0# */ | ||
225 | irq_set_irq_type(AU1000_GPIO4_INT, IRQF_TRIGGER_LOW); /* STSCHG1# */ | ||
226 | #endif | ||
227 | return 0; | ||
228 | } | ||
229 | arch_initcall(db1x00_init_irq); | ||
diff --git a/arch/mips/alchemy/devboards/db1x00/platform.c b/arch/mips/alchemy/devboards/db1x00/platform.c deleted file mode 100644 index 9e6b3d442acd..000000000000 --- a/arch/mips/alchemy/devboards/db1x00/platform.c +++ /dev/null | |||
@@ -1,316 +0,0 @@ | |||
1 | /* | ||
2 | * DBAu1xxx board platform device registration | ||
3 | * | ||
4 | * Copyright (C) 2009 Manuel Lauss | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #include <linux/init.h> | ||
22 | #include <linux/interrupt.h> | ||
23 | #include <linux/dma-mapping.h> | ||
24 | #include <linux/platform_device.h> | ||
25 | |||
26 | #include <asm/mach-au1x00/au1000.h> | ||
27 | #include <asm/mach-au1x00/au1000_dma.h> | ||
28 | #include <asm/mach-db1x00/bcsr.h> | ||
29 | #include "../platform.h" | ||
30 | |||
31 | struct pci_dev; | ||
32 | |||
33 | /* DB1xxx PCMCIA interrupt sources: | ||
34 | * CD0/1 GPIO0/3 | ||
35 | * STSCHG0/1 GPIO1/4 | ||
36 | * CARD0/1 GPIO2/5 | ||
37 | * Db1550: 0/1, 21/22, 3/5 | ||
38 | */ | ||
39 | |||
40 | #define DB1XXX_HAS_PCMCIA | ||
41 | #define F_SWAPPED (bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1000_SWAPBOOT) | ||
42 | |||
43 | #if defined(CONFIG_MIPS_DB1000) | ||
44 | #define DB1XXX_PCMCIA_CD0 AU1000_GPIO0_INT | ||
45 | #define DB1XXX_PCMCIA_STSCHG0 AU1000_GPIO1_INT | ||
46 | #define DB1XXX_PCMCIA_CARD0 AU1000_GPIO2_INT | ||
47 | #define DB1XXX_PCMCIA_CD1 AU1000_GPIO3_INT | ||
48 | #define DB1XXX_PCMCIA_STSCHG1 AU1000_GPIO4_INT | ||
49 | #define DB1XXX_PCMCIA_CARD1 AU1000_GPIO5_INT | ||
50 | #define BOARD_FLASH_SIZE 0x02000000 /* 32MB */ | ||
51 | #define BOARD_FLASH_WIDTH 4 /* 32-bits */ | ||
52 | #elif defined(CONFIG_MIPS_DB1100) | ||
53 | #define DB1XXX_PCMCIA_CD0 AU1100_GPIO0_INT | ||
54 | #define DB1XXX_PCMCIA_STSCHG0 AU1100_GPIO1_INT | ||
55 | #define DB1XXX_PCMCIA_CARD0 AU1100_GPIO2_INT | ||
56 | #define DB1XXX_PCMCIA_CD1 AU1100_GPIO3_INT | ||
57 | #define DB1XXX_PCMCIA_STSCHG1 AU1100_GPIO4_INT | ||
58 | #define DB1XXX_PCMCIA_CARD1 AU1100_GPIO5_INT | ||
59 | #define BOARD_FLASH_SIZE 0x02000000 /* 32MB */ | ||
60 | #define BOARD_FLASH_WIDTH 4 /* 32-bits */ | ||
61 | #elif defined(CONFIG_MIPS_DB1500) | ||
62 | #define DB1XXX_PCMCIA_CD0 AU1500_GPIO0_INT | ||
63 | #define DB1XXX_PCMCIA_STSCHG0 AU1500_GPIO1_INT | ||
64 | #define DB1XXX_PCMCIA_CARD0 AU1500_GPIO2_INT | ||
65 | #define DB1XXX_PCMCIA_CD1 AU1500_GPIO3_INT | ||
66 | #define DB1XXX_PCMCIA_STSCHG1 AU1500_GPIO4_INT | ||
67 | #define DB1XXX_PCMCIA_CARD1 AU1500_GPIO5_INT | ||
68 | #define BOARD_FLASH_SIZE 0x02000000 /* 32MB */ | ||
69 | #define BOARD_FLASH_WIDTH 4 /* 32-bits */ | ||
70 | #elif defined(CONFIG_MIPS_DB1550) | ||
71 | #define DB1XXX_PCMCIA_CD0 AU1550_GPIO0_INT | ||
72 | #define DB1XXX_PCMCIA_STSCHG0 AU1550_GPIO21_INT | ||
73 | #define DB1XXX_PCMCIA_CARD0 AU1550_GPIO3_INT | ||
74 | #define DB1XXX_PCMCIA_CD1 AU1550_GPIO1_INT | ||
75 | #define DB1XXX_PCMCIA_STSCHG1 AU1550_GPIO22_INT | ||
76 | #define DB1XXX_PCMCIA_CARD1 AU1550_GPIO5_INT | ||
77 | #define BOARD_FLASH_SIZE 0x08000000 /* 128MB */ | ||
78 | #define BOARD_FLASH_WIDTH 4 /* 32-bits */ | ||
79 | #else | ||
80 | /* other board: no PCMCIA */ | ||
81 | #undef DB1XXX_HAS_PCMCIA | ||
82 | #undef F_SWAPPED | ||
83 | #define F_SWAPPED 0 | ||
84 | #if defined(CONFIG_MIPS_BOSPORUS) | ||
85 | #define BOARD_FLASH_SIZE 0x01000000 /* 16MB */ | ||
86 | #define BOARD_FLASH_WIDTH 2 /* 16-bits */ | ||
87 | #elif defined(CONFIG_MIPS_MIRAGE) | ||
88 | #define BOARD_FLASH_SIZE 0x04000000 /* 64MB */ | ||
89 | #define BOARD_FLASH_WIDTH 4 /* 32-bits */ | ||
90 | #endif | ||
91 | #endif | ||
92 | |||
93 | #ifdef CONFIG_PCI | ||
94 | #ifdef CONFIG_MIPS_DB1500 | ||
95 | static int db1xxx_map_pci_irq(const struct pci_dev *d, u8 slot, u8 pin) | ||
96 | { | ||
97 | if ((slot < 12) || (slot > 13) || pin == 0) | ||
98 | return -1; | ||
99 | if (slot == 12) | ||
100 | return (pin == 1) ? AU1500_PCI_INTA : 0xff; | ||
101 | if (slot == 13) { | ||
102 | switch (pin) { | ||
103 | case 1: return AU1500_PCI_INTA; | ||
104 | case 2: return AU1500_PCI_INTB; | ||
105 | case 3: return AU1500_PCI_INTC; | ||
106 | case 4: return AU1500_PCI_INTD; | ||
107 | } | ||
108 | } | ||
109 | return -1; | ||
110 | } | ||
111 | #endif | ||
112 | |||
113 | #ifdef CONFIG_MIPS_DB1550 | ||
114 | static int db1xxx_map_pci_irq(const struct pci_dev *d, u8 slot, u8 pin) | ||
115 | { | ||
116 | if ((slot < 11) || (slot > 13) || pin == 0) | ||
117 | return -1; | ||
118 | if (slot == 11) | ||
119 | return (pin == 1) ? AU1550_PCI_INTC : 0xff; | ||
120 | if (slot == 12) { | ||
121 | switch (pin) { | ||
122 | case 1: return AU1550_PCI_INTB; | ||
123 | case 2: return AU1550_PCI_INTC; | ||
124 | case 3: return AU1550_PCI_INTD; | ||
125 | case 4: return AU1550_PCI_INTA; | ||
126 | } | ||
127 | } | ||
128 | if (slot == 13) { | ||
129 | switch (pin) { | ||
130 | case 1: return AU1550_PCI_INTA; | ||
131 | case 2: return AU1550_PCI_INTB; | ||
132 | case 3: return AU1550_PCI_INTC; | ||
133 | case 4: return AU1550_PCI_INTD; | ||
134 | } | ||
135 | } | ||
136 | return -1; | ||
137 | } | ||
138 | #endif | ||
139 | |||
140 | #ifdef CONFIG_MIPS_BOSPORUS | ||
141 | static int db1xxx_map_pci_irq(const struct pci_dev *d, u8 slot, u8 pin) | ||
142 | { | ||
143 | if ((slot < 11) || (slot > 13) || pin == 0) | ||
144 | return -1; | ||
145 | if (slot == 12) | ||
146 | return (pin == 1) ? AU1500_PCI_INTA : 0xff; | ||
147 | if (slot == 11) { | ||
148 | switch (pin) { | ||
149 | case 1: return AU1500_PCI_INTA; | ||
150 | case 2: return AU1500_PCI_INTB; | ||
151 | default: return 0xff; | ||
152 | } | ||
153 | } | ||
154 | if (slot == 13) { | ||
155 | switch (pin) { | ||
156 | case 1: return AU1500_PCI_INTA; | ||
157 | case 2: return AU1500_PCI_INTB; | ||
158 | case 3: return AU1500_PCI_INTC; | ||
159 | case 4: return AU1500_PCI_INTD; | ||
160 | } | ||
161 | } | ||
162 | return -1; | ||
163 | } | ||
164 | #endif | ||
165 | |||
166 | #ifdef CONFIG_MIPS_MIRAGE | ||
167 | static int db1xxx_map_pci_irq(const struct pci_dev *d, u8 slot, u8 pin) | ||
168 | { | ||
169 | if ((slot < 11) || (slot > 13) || pin == 0) | ||
170 | return -1; | ||
171 | if (slot == 11) | ||
172 | return (pin == 1) ? AU1500_PCI_INTD : 0xff; | ||
173 | if (slot == 12) | ||
174 | return (pin == 3) ? AU1500_PCI_INTC : 0xff; | ||
175 | if (slot == 13) { | ||
176 | switch (pin) { | ||
177 | case 1: return AU1500_PCI_INTA; | ||
178 | case 2: return AU1500_PCI_INTB; | ||
179 | default: return 0xff; | ||
180 | } | ||
181 | } | ||
182 | return -1; | ||
183 | } | ||
184 | #endif | ||
185 | |||
186 | static struct resource alchemy_pci_host_res[] = { | ||
187 | [0] = { | ||
188 | .start = AU1500_PCI_PHYS_ADDR, | ||
189 | .end = AU1500_PCI_PHYS_ADDR + 0xfff, | ||
190 | .flags = IORESOURCE_MEM, | ||
191 | }, | ||
192 | }; | ||
193 | |||
194 | static struct alchemy_pci_platdata db1xxx_pci_pd = { | ||
195 | .board_map_irq = db1xxx_map_pci_irq, | ||
196 | }; | ||
197 | |||
198 | static struct platform_device db1xxx_pci_host_dev = { | ||
199 | .dev.platform_data = &db1xxx_pci_pd, | ||
200 | .name = "alchemy-pci", | ||
201 | .id = 0, | ||
202 | .num_resources = ARRAY_SIZE(alchemy_pci_host_res), | ||
203 | .resource = alchemy_pci_host_res, | ||
204 | }; | ||
205 | |||
206 | static int __init db15x0_pci_init(void) | ||
207 | { | ||
208 | return platform_device_register(&db1xxx_pci_host_dev); | ||
209 | } | ||
210 | /* must be arch_initcall; MIPS PCI scans busses in a subsys_initcall */ | ||
211 | arch_initcall(db15x0_pci_init); | ||
212 | #endif | ||
213 | |||
214 | #ifdef CONFIG_MIPS_DB1100 | ||
215 | static struct resource au1100_lcd_resources[] = { | ||
216 | [0] = { | ||
217 | .start = AU1100_LCD_PHYS_ADDR, | ||
218 | .end = AU1100_LCD_PHYS_ADDR + 0x800 - 1, | ||
219 | .flags = IORESOURCE_MEM, | ||
220 | }, | ||
221 | [1] = { | ||
222 | .start = AU1100_LCD_INT, | ||
223 | .end = AU1100_LCD_INT, | ||
224 | .flags = IORESOURCE_IRQ, | ||
225 | } | ||
226 | }; | ||
227 | |||
228 | static u64 au1100_lcd_dmamask = DMA_BIT_MASK(32); | ||
229 | |||
230 | static struct platform_device au1100_lcd_device = { | ||
231 | .name = "au1100-lcd", | ||
232 | .id = 0, | ||
233 | .dev = { | ||
234 | .dma_mask = &au1100_lcd_dmamask, | ||
235 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
236 | }, | ||
237 | .num_resources = ARRAY_SIZE(au1100_lcd_resources), | ||
238 | .resource = au1100_lcd_resources, | ||
239 | }; | ||
240 | #endif | ||
241 | |||
242 | static struct resource alchemy_ac97c_res[] = { | ||
243 | [0] = { | ||
244 | .start = AU1000_AC97_PHYS_ADDR, | ||
245 | .end = AU1000_AC97_PHYS_ADDR + 0xfff, | ||
246 | .flags = IORESOURCE_MEM, | ||
247 | }, | ||
248 | [1] = { | ||
249 | .start = DMA_ID_AC97C_TX, | ||
250 | .end = DMA_ID_AC97C_TX, | ||
251 | .flags = IORESOURCE_DMA, | ||
252 | }, | ||
253 | [2] = { | ||
254 | .start = DMA_ID_AC97C_RX, | ||
255 | .end = DMA_ID_AC97C_RX, | ||
256 | .flags = IORESOURCE_DMA, | ||
257 | }, | ||
258 | }; | ||
259 | |||
260 | static struct platform_device alchemy_ac97c_dev = { | ||
261 | .name = "alchemy-ac97c", | ||
262 | .id = -1, | ||
263 | .resource = alchemy_ac97c_res, | ||
264 | .num_resources = ARRAY_SIZE(alchemy_ac97c_res), | ||
265 | }; | ||
266 | |||
267 | static struct platform_device alchemy_ac97c_dma_dev = { | ||
268 | .name = "alchemy-pcm-dma", | ||
269 | .id = 0, | ||
270 | }; | ||
271 | |||
272 | static struct platform_device db1x00_codec_dev = { | ||
273 | .name = "ac97-codec", | ||
274 | .id = -1, | ||
275 | }; | ||
276 | |||
277 | static struct platform_device db1x00_audio_dev = { | ||
278 | .name = "db1000-audio", | ||
279 | }; | ||
280 | |||
281 | static int __init db1xxx_dev_init(void) | ||
282 | { | ||
283 | #ifdef DB1XXX_HAS_PCMCIA | ||
284 | db1x_register_pcmcia_socket( | ||
285 | AU1000_PCMCIA_ATTR_PHYS_ADDR, | ||
286 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1, | ||
287 | AU1000_PCMCIA_MEM_PHYS_ADDR, | ||
288 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x000400000 - 1, | ||
289 | AU1000_PCMCIA_IO_PHYS_ADDR, | ||
290 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x000010000 - 1, | ||
291 | DB1XXX_PCMCIA_CARD0, DB1XXX_PCMCIA_CD0, | ||
292 | /*DB1XXX_PCMCIA_STSCHG0*/0, 0, 0); | ||
293 | |||
294 | db1x_register_pcmcia_socket( | ||
295 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004000000, | ||
296 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004400000 - 1, | ||
297 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x004000000, | ||
298 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x004400000 - 1, | ||
299 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x004000000, | ||
300 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x004010000 - 1, | ||
301 | DB1XXX_PCMCIA_CARD1, DB1XXX_PCMCIA_CD1, | ||
302 | /*DB1XXX_PCMCIA_STSCHG1*/0, 0, 1); | ||
303 | #endif | ||
304 | #ifdef CONFIG_MIPS_DB1100 | ||
305 | platform_device_register(&au1100_lcd_device); | ||
306 | #endif | ||
307 | db1x_register_norflash(BOARD_FLASH_SIZE, BOARD_FLASH_WIDTH, F_SWAPPED); | ||
308 | |||
309 | platform_device_register(&db1x00_codec_dev); | ||
310 | platform_device_register(&alchemy_ac97c_dma_dev); | ||
311 | platform_device_register(&alchemy_ac97c_dev); | ||
312 | platform_device_register(&db1x00_audio_dev); | ||
313 | |||
314 | return 0; | ||
315 | } | ||
316 | device_initcall(db1xxx_dev_init); | ||
diff --git a/arch/mips/alchemy/devboards/pb1000/Makefile b/arch/mips/alchemy/devboards/pb1000/Makefile deleted file mode 100644 index 97c6615ba2bb..000000000000 --- a/arch/mips/alchemy/devboards/pb1000/Makefile +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | # | ||
2 | # Copyright 2000, 2008 MontaVista Software Inc. | ||
3 | # Author: MontaVista Software, Inc. <source@mvista.com> | ||
4 | # | ||
5 | # Makefile for the Alchemy Semiconductor Pb1000 board. | ||
6 | # | ||
7 | |||
8 | obj-y := board_setup.o | ||
diff --git a/arch/mips/alchemy/devboards/pb1000/board_setup.c b/arch/mips/alchemy/devboards/pb1000/board_setup.c deleted file mode 100644 index e64fdcbf75d0..000000000000 --- a/arch/mips/alchemy/devboards/pb1000/board_setup.c +++ /dev/null | |||
@@ -1,209 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2000, 2008 MontaVista Software Inc. | ||
3 | * Author: MontaVista Software, Inc. <source@mvista.com> | ||
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 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
11 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
12 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
13 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
14 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
15 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
16 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
17 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
18 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
19 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License along | ||
22 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
23 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
24 | */ | ||
25 | |||
26 | #include <linux/delay.h> | ||
27 | #include <linux/gpio.h> | ||
28 | #include <linux/init.h> | ||
29 | #include <linux/interrupt.h> | ||
30 | #include <linux/pm.h> | ||
31 | #include <asm/mach-au1x00/au1000.h> | ||
32 | #include <asm/mach-pb1x00/pb1000.h> | ||
33 | #include <asm/reboot.h> | ||
34 | #include <prom.h> | ||
35 | |||
36 | #include "../platform.h" | ||
37 | |||
38 | const char *get_system_type(void) | ||
39 | { | ||
40 | return "Alchemy Pb1000"; | ||
41 | } | ||
42 | |||
43 | static void board_reset(char *c) | ||
44 | { | ||
45 | asm volatile ("jr %0" : : "r" (0xbfc00000)); | ||
46 | } | ||
47 | |||
48 | static void board_power_off(void) | ||
49 | { | ||
50 | while (1) | ||
51 | asm volatile ( | ||
52 | " .set mips32 \n" | ||
53 | " wait \n" | ||
54 | " .set mips0 \n"); | ||
55 | } | ||
56 | |||
57 | void __init board_setup(void) | ||
58 | { | ||
59 | u32 pin_func, static_cfg0; | ||
60 | u32 sys_freqctrl, sys_clksrc; | ||
61 | u32 prid = read_c0_prid(); | ||
62 | |||
63 | sys_freqctrl = 0; | ||
64 | sys_clksrc = 0; | ||
65 | |||
66 | /* Set AUX clock to 12 MHz * 8 = 96 MHz */ | ||
67 | au_writel(8, SYS_AUXPLL); | ||
68 | alchemy_gpio1_input_enable(); | ||
69 | udelay(100); | ||
70 | |||
71 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | ||
72 | /* Zero and disable FREQ2 */ | ||
73 | sys_freqctrl = au_readl(SYS_FREQCTRL0); | ||
74 | sys_freqctrl &= ~0xFFF00000; | ||
75 | au_writel(sys_freqctrl, SYS_FREQCTRL0); | ||
76 | |||
77 | /* Zero and disable USBH/USBD clocks */ | ||
78 | sys_clksrc = au_readl(SYS_CLKSRC); | ||
79 | sys_clksrc &= ~(SYS_CS_CUD | SYS_CS_DUD | SYS_CS_MUD_MASK | | ||
80 | SYS_CS_CUH | SYS_CS_DUH | SYS_CS_MUH_MASK); | ||
81 | au_writel(sys_clksrc, SYS_CLKSRC); | ||
82 | |||
83 | sys_freqctrl = au_readl(SYS_FREQCTRL0); | ||
84 | sys_freqctrl &= ~0xFFF00000; | ||
85 | |||
86 | sys_clksrc = au_readl(SYS_CLKSRC); | ||
87 | sys_clksrc &= ~(SYS_CS_CUD | SYS_CS_DUD | SYS_CS_MUD_MASK | | ||
88 | SYS_CS_CUH | SYS_CS_DUH | SYS_CS_MUH_MASK); | ||
89 | |||
90 | switch (prid & 0x000000FF) { | ||
91 | case 0x00: /* DA */ | ||
92 | case 0x01: /* HA */ | ||
93 | case 0x02: /* HB */ | ||
94 | /* CPU core freq to 48 MHz to slow it way down... */ | ||
95 | au_writel(4, SYS_CPUPLL); | ||
96 | |||
97 | /* | ||
98 | * Setup 48 MHz FREQ2 from CPUPLL for USB Host | ||
99 | * FRDIV2 = 3 -> div by 8 of 384 MHz -> 48 MHz | ||
100 | */ | ||
101 | sys_freqctrl |= (3 << SYS_FC_FRDIV2_BIT) | SYS_FC_FE2; | ||
102 | au_writel(sys_freqctrl, SYS_FREQCTRL0); | ||
103 | |||
104 | /* CPU core freq to 384 MHz */ | ||
105 | au_writel(0x20, SYS_CPUPLL); | ||
106 | |||
107 | printk(KERN_INFO "Au1000: 48 MHz OHCI workaround enabled\n"); | ||
108 | break; | ||
109 | |||
110 | default: /* HC and newer */ | ||
111 | /* FREQ2 = aux / 2 = 48 MHz */ | ||
112 | sys_freqctrl |= (0 << SYS_FC_FRDIV2_BIT) | | ||
113 | SYS_FC_FE2 | SYS_FC_FS2; | ||
114 | au_writel(sys_freqctrl, SYS_FREQCTRL0); | ||
115 | break; | ||
116 | } | ||
117 | |||
118 | /* | ||
119 | * Route 48 MHz FREQ2 into USB Host and/or Device | ||
120 | */ | ||
121 | sys_clksrc |= SYS_CS_MUX_FQ2 << SYS_CS_MUH_BIT; | ||
122 | au_writel(sys_clksrc, SYS_CLKSRC); | ||
123 | |||
124 | /* Configure pins GPIO[14:9] as GPIO */ | ||
125 | pin_func = au_readl(SYS_PINFUNC) & ~(SYS_PF_UR3 | SYS_PF_USB); | ||
126 | |||
127 | /* 2nd USB port is USB host */ | ||
128 | pin_func |= SYS_PF_USB; | ||
129 | |||
130 | au_writel(pin_func, SYS_PINFUNC); | ||
131 | |||
132 | alchemy_gpio_direction_input(11); | ||
133 | alchemy_gpio_direction_input(13); | ||
134 | alchemy_gpio_direction_output(4, 0); | ||
135 | alchemy_gpio_direction_output(5, 0); | ||
136 | #endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */ | ||
137 | |||
138 | /* Make GPIO 15 an input (for interrupt line) */ | ||
139 | pin_func = au_readl(SYS_PINFUNC) & ~SYS_PF_IRF; | ||
140 | /* We don't need I2S, so make it available for GPIO[31:29] */ | ||
141 | pin_func |= SYS_PF_I2S; | ||
142 | au_writel(pin_func, SYS_PINFUNC); | ||
143 | |||
144 | alchemy_gpio_direction_input(15); | ||
145 | |||
146 | static_cfg0 = au_readl(MEM_STCFG0) & ~0xc00; | ||
147 | au_writel(static_cfg0, MEM_STCFG0); | ||
148 | |||
149 | /* configure RCE2* for LCD */ | ||
150 | au_writel(0x00000004, MEM_STCFG2); | ||
151 | |||
152 | /* MEM_STTIME2 */ | ||
153 | au_writel(0x09000000, MEM_STTIME2); | ||
154 | |||
155 | /* Set 32-bit base address decoding for RCE2* */ | ||
156 | au_writel(0x10003ff0, MEM_STADDR2); | ||
157 | |||
158 | /* | ||
159 | * PCI CPLD setup | ||
160 | * Expand CE0 to cover PCI | ||
161 | */ | ||
162 | au_writel(0x11803e40, MEM_STADDR1); | ||
163 | |||
164 | /* Burst visibility on */ | ||
165 | au_writel(au_readl(MEM_STCFG0) | 0x1000, MEM_STCFG0); | ||
166 | |||
167 | au_writel(0x83, MEM_STCFG1); /* ewait enabled, flash timing */ | ||
168 | au_writel(0x33030a10, MEM_STTIME1); /* slower timing for FPGA */ | ||
169 | |||
170 | /* Setup the static bus controller */ | ||
171 | au_writel(0x00000002, MEM_STCFG3); /* type = PCMCIA */ | ||
172 | au_writel(0x280E3D07, MEM_STTIME3); /* 250ns cycle time */ | ||
173 | au_writel(0x10000000, MEM_STADDR3); /* any PCMCIA select */ | ||
174 | |||
175 | /* | ||
176 | * Enable Au1000 BCLK switching - note: sed1356 must not use | ||
177 | * its BCLK (Au1000 LCLK) for any timings | ||
178 | */ | ||
179 | switch (prid & 0x000000FF) { | ||
180 | case 0x00: /* DA */ | ||
181 | case 0x01: /* HA */ | ||
182 | case 0x02: /* HB */ | ||
183 | break; | ||
184 | default: /* HC and newer */ | ||
185 | /* | ||
186 | * Enable sys bus clock divider when IDLE state or no bus | ||
187 | * activity. | ||
188 | */ | ||
189 | au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL); | ||
190 | break; | ||
191 | } | ||
192 | |||
193 | pm_power_off = board_power_off; | ||
194 | _machine_halt = board_power_off; | ||
195 | _machine_restart = board_reset; | ||
196 | } | ||
197 | |||
198 | static int __init pb1000_init_irq(void) | ||
199 | { | ||
200 | irq_set_irq_type(AU1000_GPIO15_INT, IRQF_TRIGGER_LOW); | ||
201 | return 0; | ||
202 | } | ||
203 | arch_initcall(pb1000_init_irq); | ||
204 | |||
205 | static int __init pb1000_device_init(void) | ||
206 | { | ||
207 | return db1x_register_norflash(8 * 1024 * 1024, 4, 0); | ||
208 | } | ||
209 | device_initcall(pb1000_device_init); | ||
diff --git a/arch/mips/alchemy/devboards/pb1100/board_setup.c b/arch/mips/alchemy/devboards/pb1100.c index d108fd573aaf..cff50d05ddd4 100644 --- a/arch/mips/alchemy/devboards/pb1100/board_setup.c +++ b/arch/mips/alchemy/devboards/pb1100.c | |||
@@ -1,42 +1,37 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright 2002, 2008 MontaVista Software Inc. | 2 | * Pb1100 board platform device registration |
3 | * Author: MontaVista Software, Inc. <source@mvista.com> | ||
4 | * | 3 | * |
5 | * This program is free software; you can redistribute it and/or modify it | 4 | * Copyright (C) 2009 Manuel Lauss |
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 | * | 5 | * |
10 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | 6 | * This program is free software; you can redistribute it and/or modify |
11 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | 7 | * it under the terms of the GNU General Public License as published by |
12 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | 8 | * the Free Software Foundation; either version 2 of the License, or |
13 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 9 | * (at your option) any later version. |
14 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
15 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
16 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
17 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
18 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
19 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
20 | * | 10 | * |
21 | * You should have received a copy of the GNU General Public License along | 11 | * This program is distributed in the hope that it will be useful, |
22 | * with this program; if not, write to the Free Software Foundation, Inc., | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
23 | * 675 Mass Ave, Cambridge, MA 02139, USA. | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
24 | */ | 19 | */ |
25 | 20 | ||
21 | #include <linux/delay.h> | ||
26 | #include <linux/gpio.h> | 22 | #include <linux/gpio.h> |
27 | #include <linux/init.h> | 23 | #include <linux/init.h> |
28 | #include <linux/delay.h> | ||
29 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
30 | 25 | #include <linux/dma-mapping.h> | |
26 | #include <linux/platform_device.h> | ||
31 | #include <asm/mach-au1x00/au1000.h> | 27 | #include <asm/mach-au1x00/au1000.h> |
32 | #include <asm/mach-db1x00/bcsr.h> | 28 | #include <asm/mach-db1x00/bcsr.h> |
33 | |||
34 | #include <prom.h> | 29 | #include <prom.h> |
35 | 30 | #include "platform.h" | |
36 | 31 | ||
37 | const char *get_system_type(void) | 32 | const char *get_system_type(void) |
38 | { | 33 | { |
39 | return "Alchemy Pb1100"; | 34 | return "PB1100"; |
40 | } | 35 | } |
41 | 36 | ||
42 | void __init board_setup(void) | 37 | void __init board_setup(void) |
@@ -115,13 +110,58 @@ void __init board_setup(void) | |||
115 | } | 110 | } |
116 | } | 111 | } |
117 | 112 | ||
118 | static int __init pb1100_init_irq(void) | 113 | /******************************************************************************/ |
114 | |||
115 | static struct resource au1100_lcd_resources[] = { | ||
116 | [0] = { | ||
117 | .start = AU1100_LCD_PHYS_ADDR, | ||
118 | .end = AU1100_LCD_PHYS_ADDR + 0x800 - 1, | ||
119 | .flags = IORESOURCE_MEM, | ||
120 | }, | ||
121 | [1] = { | ||
122 | .start = AU1100_LCD_INT, | ||
123 | .end = AU1100_LCD_INT, | ||
124 | .flags = IORESOURCE_IRQ, | ||
125 | } | ||
126 | }; | ||
127 | |||
128 | static u64 au1100_lcd_dmamask = DMA_BIT_MASK(32); | ||
129 | |||
130 | static struct platform_device au1100_lcd_device = { | ||
131 | .name = "au1100-lcd", | ||
132 | .id = 0, | ||
133 | .dev = { | ||
134 | .dma_mask = &au1100_lcd_dmamask, | ||
135 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
136 | }, | ||
137 | .num_resources = ARRAY_SIZE(au1100_lcd_resources), | ||
138 | .resource = au1100_lcd_resources, | ||
139 | }; | ||
140 | |||
141 | static int __init pb1100_dev_init(void) | ||
119 | { | 142 | { |
143 | int swapped; | ||
144 | |||
120 | irq_set_irq_type(AU1100_GPIO9_INT, IRQF_TRIGGER_LOW); /* PCCD# */ | 145 | irq_set_irq_type(AU1100_GPIO9_INT, IRQF_TRIGGER_LOW); /* PCCD# */ |
121 | irq_set_irq_type(AU1100_GPIO10_INT, IRQF_TRIGGER_LOW); /* PCSTSCHG# */ | 146 | irq_set_irq_type(AU1100_GPIO10_INT, IRQF_TRIGGER_LOW); /* PCSTSCHG# */ |
122 | irq_set_irq_type(AU1100_GPIO11_INT, IRQF_TRIGGER_LOW); /* PCCard# */ | 147 | irq_set_irq_type(AU1100_GPIO11_INT, IRQF_TRIGGER_LOW); /* PCCard# */ |
123 | irq_set_irq_type(AU1100_GPIO13_INT, IRQF_TRIGGER_LOW); /* DC_IRQ# */ | 148 | irq_set_irq_type(AU1100_GPIO13_INT, IRQF_TRIGGER_LOW); /* DC_IRQ# */ |
124 | 149 | ||
150 | /* PCMCIA. single socket, identical to Pb1500 */ | ||
151 | db1x_register_pcmcia_socket( | ||
152 | AU1000_PCMCIA_ATTR_PHYS_ADDR, | ||
153 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1, | ||
154 | AU1000_PCMCIA_MEM_PHYS_ADDR, | ||
155 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x000400000 - 1, | ||
156 | AU1000_PCMCIA_IO_PHYS_ADDR, | ||
157 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x000010000 - 1, | ||
158 | AU1100_GPIO11_INT, AU1100_GPIO9_INT, /* card / insert */ | ||
159 | /*AU1100_GPIO10_INT*/0, 0, 0); /* stschg / eject / id */ | ||
160 | |||
161 | swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1000_SWAPBOOT; | ||
162 | db1x_register_norflash(64 * 1024 * 1024, 4, swapped); | ||
163 | platform_device_register(&au1100_lcd_device); | ||
164 | |||
125 | return 0; | 165 | return 0; |
126 | } | 166 | } |
127 | arch_initcall(pb1100_init_irq); | 167 | device_initcall(pb1100_dev_init); |
diff --git a/arch/mips/alchemy/devboards/pb1100/Makefile b/arch/mips/alchemy/devboards/pb1100/Makefile deleted file mode 100644 index 7e3756c83fe5..000000000000 --- a/arch/mips/alchemy/devboards/pb1100/Makefile +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | # | ||
2 | # Copyright 2000, 2001, 2008 MontaVista Software Inc. | ||
3 | # Author: MontaVista Software, Inc. <source@mvista.com> | ||
4 | # | ||
5 | # Makefile for the Alchemy Semiconductor Pb1100 board. | ||
6 | # | ||
7 | |||
8 | obj-y := board_setup.o platform.o | ||
diff --git a/arch/mips/alchemy/devboards/pb1100/platform.c b/arch/mips/alchemy/devboards/pb1100/platform.c deleted file mode 100644 index 9c57c01a68c4..000000000000 --- a/arch/mips/alchemy/devboards/pb1100/platform.c +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | /* | ||
2 | * Pb1100 board platform device registration | ||
3 | * | ||
4 | * Copyright (C) 2009 Manuel Lauss | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #include <linux/init.h> | ||
22 | #include <linux/dma-mapping.h> | ||
23 | #include <linux/platform_device.h> | ||
24 | |||
25 | #include <asm/mach-au1x00/au1000.h> | ||
26 | #include <asm/mach-db1x00/bcsr.h> | ||
27 | |||
28 | #include "../platform.h" | ||
29 | |||
30 | static struct resource au1100_lcd_resources[] = { | ||
31 | [0] = { | ||
32 | .start = AU1100_LCD_PHYS_ADDR, | ||
33 | .end = AU1100_LCD_PHYS_ADDR + 0x800 - 1, | ||
34 | .flags = IORESOURCE_MEM, | ||
35 | }, | ||
36 | [1] = { | ||
37 | .start = AU1100_LCD_INT, | ||
38 | .end = AU1100_LCD_INT, | ||
39 | .flags = IORESOURCE_IRQ, | ||
40 | } | ||
41 | }; | ||
42 | |||
43 | static u64 au1100_lcd_dmamask = DMA_BIT_MASK(32); | ||
44 | |||
45 | static struct platform_device au1100_lcd_device = { | ||
46 | .name = "au1100-lcd", | ||
47 | .id = 0, | ||
48 | .dev = { | ||
49 | .dma_mask = &au1100_lcd_dmamask, | ||
50 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
51 | }, | ||
52 | .num_resources = ARRAY_SIZE(au1100_lcd_resources), | ||
53 | .resource = au1100_lcd_resources, | ||
54 | }; | ||
55 | |||
56 | static int __init pb1100_dev_init(void) | ||
57 | { | ||
58 | int swapped; | ||
59 | |||
60 | /* PCMCIA. single socket, identical to Pb1500 */ | ||
61 | db1x_register_pcmcia_socket( | ||
62 | AU1000_PCMCIA_ATTR_PHYS_ADDR, | ||
63 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1, | ||
64 | AU1000_PCMCIA_MEM_PHYS_ADDR, | ||
65 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x000400000 - 1, | ||
66 | AU1000_PCMCIA_IO_PHYS_ADDR, | ||
67 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x000010000 - 1, | ||
68 | AU1100_GPIO11_INT, AU1100_GPIO9_INT, /* card / insert */ | ||
69 | /*AU1100_GPIO10_INT*/0, 0, 0); /* stschg / eject / id */ | ||
70 | |||
71 | swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1000_SWAPBOOT; | ||
72 | db1x_register_norflash(64 * 1024 * 1024, 4, swapped); | ||
73 | platform_device_register(&au1100_lcd_device); | ||
74 | |||
75 | return 0; | ||
76 | } | ||
77 | device_initcall(pb1100_dev_init); | ||
diff --git a/arch/mips/alchemy/devboards/pb1200/Makefile b/arch/mips/alchemy/devboards/pb1200/Makefile deleted file mode 100644 index 18c1bd53e4c0..000000000000 --- a/arch/mips/alchemy/devboards/pb1200/Makefile +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for the Alchemy Semiconductor Pb1200/DBAu1200 boards. | ||
3 | # | ||
4 | |||
5 | obj-y := board_setup.o platform.o | ||
diff --git a/arch/mips/alchemy/devboards/pb1200/board_setup.c b/arch/mips/alchemy/devboards/pb1200/board_setup.c deleted file mode 100644 index 6d06b07c2381..000000000000 --- a/arch/mips/alchemy/devboards/pb1200/board_setup.c +++ /dev/null | |||
@@ -1,174 +0,0 @@ | |||
1 | /* | ||
2 | * | ||
3 | * BRIEF MODULE DESCRIPTION | ||
4 | * Alchemy Pb1200/Db1200 board setup. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | * | ||
11 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
12 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
13 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
14 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
15 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
16 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
17 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
18 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
19 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
20 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License along | ||
23 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
24 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
25 | */ | ||
26 | |||
27 | #include <linux/init.h> | ||
28 | #include <linux/interrupt.h> | ||
29 | #include <linux/sched.h> | ||
30 | |||
31 | #include <asm/mach-au1x00/au1000.h> | ||
32 | #include <asm/mach-db1x00/bcsr.h> | ||
33 | |||
34 | #ifdef CONFIG_MIPS_PB1200 | ||
35 | #include <asm/mach-pb1x00/pb1200.h> | ||
36 | #endif | ||
37 | |||
38 | #ifdef CONFIG_MIPS_DB1200 | ||
39 | #include <asm/mach-db1x00/db1200.h> | ||
40 | #define PB1200_INT_BEGIN DB1200_INT_BEGIN | ||
41 | #define PB1200_INT_END DB1200_INT_END | ||
42 | #endif | ||
43 | |||
44 | #include <prom.h> | ||
45 | |||
46 | const char *get_system_type(void) | ||
47 | { | ||
48 | return "Alchemy Pb1200"; | ||
49 | } | ||
50 | |||
51 | void __init board_setup(void) | ||
52 | { | ||
53 | printk(KERN_INFO "AMD Alchemy Pb1200 Board\n"); | ||
54 | bcsr_init(PB1200_BCSR_PHYS_ADDR, | ||
55 | PB1200_BCSR_PHYS_ADDR + PB1200_BCSR_HEXLED_OFS); | ||
56 | |||
57 | #if 0 | ||
58 | { | ||
59 | u32 pin_func; | ||
60 | |||
61 | /* | ||
62 | * Enable PSC1 SYNC for AC97. Normaly done in audio driver, | ||
63 | * but it is board specific code, so put it here. | ||
64 | */ | ||
65 | pin_func = au_readl(SYS_PINFUNC); | ||
66 | au_sync(); | ||
67 | pin_func |= SYS_PF_MUST_BE_SET | SYS_PF_PSC1_S1; | ||
68 | au_writel(pin_func, SYS_PINFUNC); | ||
69 | |||
70 | au_writel(0, (u32)bcsr | 0x10); /* turn off PCMCIA power */ | ||
71 | au_sync(); | ||
72 | } | ||
73 | #endif | ||
74 | |||
75 | #if defined(CONFIG_I2C_AU1550) | ||
76 | { | ||
77 | u32 freq0, clksrc; | ||
78 | u32 pin_func; | ||
79 | |||
80 | /* Select SMBus in CPLD */ | ||
81 | bcsr_mod(BCSR_RESETS, BCSR_RESETS_PSC0MUX, 0); | ||
82 | |||
83 | pin_func = au_readl(SYS_PINFUNC); | ||
84 | au_sync(); | ||
85 | pin_func &= ~(SYS_PINFUNC_P0A | SYS_PINFUNC_P0B); | ||
86 | /* Set GPIOs correctly */ | ||
87 | pin_func |= 2 << 17; | ||
88 | au_writel(pin_func, SYS_PINFUNC); | ||
89 | au_sync(); | ||
90 | |||
91 | /* The I2C driver depends on 50 MHz clock */ | ||
92 | freq0 = au_readl(SYS_FREQCTRL0); | ||
93 | au_sync(); | ||
94 | freq0 &= ~(SYS_FC_FRDIV1_MASK | SYS_FC_FS1 | SYS_FC_FE1); | ||
95 | freq0 |= 3 << SYS_FC_FRDIV1_BIT; | ||
96 | /* 396 MHz / (3 + 1) * 2 == 49.5 MHz */ | ||
97 | au_writel(freq0, SYS_FREQCTRL0); | ||
98 | au_sync(); | ||
99 | freq0 |= SYS_FC_FE1; | ||
100 | au_writel(freq0, SYS_FREQCTRL0); | ||
101 | au_sync(); | ||
102 | |||
103 | clksrc = au_readl(SYS_CLKSRC); | ||
104 | au_sync(); | ||
105 | clksrc &= ~(SYS_CS_CE0 | SYS_CS_DE0 | SYS_CS_ME0_MASK); | ||
106 | /* Bit 22 is EXTCLK0 for PSC0 */ | ||
107 | clksrc |= SYS_CS_MUX_FQ1 << SYS_CS_ME0_BIT; | ||
108 | au_writel(clksrc, SYS_CLKSRC); | ||
109 | au_sync(); | ||
110 | } | ||
111 | #endif | ||
112 | |||
113 | /* | ||
114 | * The Pb1200 development board uses external MUX for PSC0 to | ||
115 | * support SMB/SPI. bcsr_resets bit 12: 0=SMB 1=SPI | ||
116 | */ | ||
117 | #ifdef CONFIG_I2C_AU1550 | ||
118 | bcsr_mod(BCSR_RESETS, BCSR_RESETS_PSC0MUX, 0); | ||
119 | #endif | ||
120 | au_sync(); | ||
121 | } | ||
122 | |||
123 | static int __init pb1200_init_irq(void) | ||
124 | { | ||
125 | /* We have a problem with CPLD rev 3. */ | ||
126 | if (BCSR_WHOAMI_CPLD(bcsr_read(BCSR_WHOAMI)) <= 3) { | ||
127 | printk(KERN_ERR "WARNING!!!\n"); | ||
128 | printk(KERN_ERR "WARNING!!!\n"); | ||
129 | printk(KERN_ERR "WARNING!!!\n"); | ||
130 | printk(KERN_ERR "WARNING!!!\n"); | ||
131 | printk(KERN_ERR "WARNING!!!\n"); | ||
132 | printk(KERN_ERR "WARNING!!!\n"); | ||
133 | printk(KERN_ERR "Pb1200 must be at CPLD rev 4. Please have Pb1200\n"); | ||
134 | printk(KERN_ERR "updated to latest revision. This software will\n"); | ||
135 | printk(KERN_ERR "not work on anything less than CPLD rev 4.\n"); | ||
136 | printk(KERN_ERR "WARNING!!!\n"); | ||
137 | printk(KERN_ERR "WARNING!!!\n"); | ||
138 | printk(KERN_ERR "WARNING!!!\n"); | ||
139 | printk(KERN_ERR "WARNING!!!\n"); | ||
140 | printk(KERN_ERR "WARNING!!!\n"); | ||
141 | printk(KERN_ERR "WARNING!!!\n"); | ||
142 | panic("Game over. Your score is 0."); | ||
143 | } | ||
144 | |||
145 | irq_set_irq_type(AU1200_GPIO7_INT, IRQF_TRIGGER_LOW); | ||
146 | bcsr_init_irq(PB1200_INT_BEGIN, PB1200_INT_END, AU1200_GPIO7_INT); | ||
147 | |||
148 | return 0; | ||
149 | } | ||
150 | arch_initcall(pb1200_init_irq); | ||
151 | |||
152 | |||
153 | int board_au1200fb_panel(void) | ||
154 | { | ||
155 | return (bcsr_read(BCSR_SWITCHES) >> 8) & 0x0f; | ||
156 | } | ||
157 | |||
158 | int board_au1200fb_panel_init(void) | ||
159 | { | ||
160 | /* Apply power */ | ||
161 | bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD | | ||
162 | BCSR_BOARD_LCDBL); | ||
163 | /* printk(KERN_DEBUG "board_au1200fb_panel_init()\n"); */ | ||
164 | return 0; | ||
165 | } | ||
166 | |||
167 | int board_au1200fb_panel_shutdown(void) | ||
168 | { | ||
169 | /* Remove power */ | ||
170 | bcsr_mod(BCSR_BOARD, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD | | ||
171 | BCSR_BOARD_LCDBL, 0); | ||
172 | /* printk(KERN_DEBUG "board_au1200fb_panel_shutdown()\n"); */ | ||
173 | return 0; | ||
174 | } | ||
diff --git a/arch/mips/alchemy/devboards/pb1200/platform.c b/arch/mips/alchemy/devboards/pb1200/platform.c deleted file mode 100644 index 54f7f7b0676e..000000000000 --- a/arch/mips/alchemy/devboards/pb1200/platform.c +++ /dev/null | |||
@@ -1,339 +0,0 @@ | |||
1 | /* | ||
2 | * Pb1200/DBAu1200 board platform device registration | ||
3 | * | ||
4 | * Copyright (C) 2008 MontaVista Software Inc. <source@mvista.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #include <linux/dma-mapping.h> | ||
22 | #include <linux/init.h> | ||
23 | #include <linux/leds.h> | ||
24 | #include <linux/platform_device.h> | ||
25 | #include <linux/smc91x.h> | ||
26 | |||
27 | #include <asm/mach-au1x00/au1000.h> | ||
28 | #include <asm/mach-au1x00/au1100_mmc.h> | ||
29 | #include <asm/mach-au1x00/au1xxx_dbdma.h> | ||
30 | #include <asm/mach-db1x00/bcsr.h> | ||
31 | #include <asm/mach-pb1x00/pb1200.h> | ||
32 | |||
33 | #include "../platform.h" | ||
34 | |||
35 | static int mmc_activity; | ||
36 | |||
37 | static void pb1200mmc0_set_power(void *mmc_host, int state) | ||
38 | { | ||
39 | if (state) | ||
40 | bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_SD0PWR); | ||
41 | else | ||
42 | bcsr_mod(BCSR_BOARD, BCSR_BOARD_SD0PWR, 0); | ||
43 | |||
44 | msleep(1); | ||
45 | } | ||
46 | |||
47 | static int pb1200mmc0_card_readonly(void *mmc_host) | ||
48 | { | ||
49 | return (bcsr_read(BCSR_STATUS) & BCSR_STATUS_SD0WP) ? 1 : 0; | ||
50 | } | ||
51 | |||
52 | static int pb1200mmc0_card_inserted(void *mmc_host) | ||
53 | { | ||
54 | return (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD0INSERT) ? 1 : 0; | ||
55 | } | ||
56 | |||
57 | static void pb1200_mmcled_set(struct led_classdev *led, | ||
58 | enum led_brightness brightness) | ||
59 | { | ||
60 | if (brightness != LED_OFF) { | ||
61 | if (++mmc_activity == 1) | ||
62 | bcsr_mod(BCSR_LEDS, BCSR_LEDS_LED0, 0); | ||
63 | } else { | ||
64 | if (--mmc_activity == 0) | ||
65 | bcsr_mod(BCSR_LEDS, 0, BCSR_LEDS_LED0); | ||
66 | } | ||
67 | } | ||
68 | |||
69 | static struct led_classdev pb1200mmc_led = { | ||
70 | .brightness_set = pb1200_mmcled_set, | ||
71 | }; | ||
72 | |||
73 | static void pb1200mmc1_set_power(void *mmc_host, int state) | ||
74 | { | ||
75 | if (state) | ||
76 | bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_SD1PWR); | ||
77 | else | ||
78 | bcsr_mod(BCSR_BOARD, BCSR_BOARD_SD1PWR, 0); | ||
79 | |||
80 | msleep(1); | ||
81 | } | ||
82 | |||
83 | static int pb1200mmc1_card_readonly(void *mmc_host) | ||
84 | { | ||
85 | return (bcsr_read(BCSR_STATUS) & BCSR_STATUS_SD1WP) ? 1 : 0; | ||
86 | } | ||
87 | |||
88 | static int pb1200mmc1_card_inserted(void *mmc_host) | ||
89 | { | ||
90 | return (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD1INSERT) ? 1 : 0; | ||
91 | } | ||
92 | |||
93 | static struct au1xmmc_platform_data pb1200mmc_platdata[2] = { | ||
94 | [0] = { | ||
95 | .set_power = pb1200mmc0_set_power, | ||
96 | .card_inserted = pb1200mmc0_card_inserted, | ||
97 | .card_readonly = pb1200mmc0_card_readonly, | ||
98 | .cd_setup = NULL, /* use poll-timer in driver */ | ||
99 | .led = &pb1200mmc_led, | ||
100 | }, | ||
101 | [1] = { | ||
102 | .set_power = pb1200mmc1_set_power, | ||
103 | .card_inserted = pb1200mmc1_card_inserted, | ||
104 | .card_readonly = pb1200mmc1_card_readonly, | ||
105 | .cd_setup = NULL, /* use poll-timer in driver */ | ||
106 | .led = &pb1200mmc_led, | ||
107 | }, | ||
108 | }; | ||
109 | |||
110 | static u64 au1xxx_mmc_dmamask = DMA_BIT_MASK(32); | ||
111 | |||
112 | static struct resource au1200_mmc0_res[] = { | ||
113 | [0] = { | ||
114 | .start = AU1100_SD0_PHYS_ADDR, | ||
115 | .end = AU1100_SD0_PHYS_ADDR + 0xfff, | ||
116 | .flags = IORESOURCE_MEM, | ||
117 | }, | ||
118 | [1] = { | ||
119 | .start = AU1200_SD_INT, | ||
120 | .end = AU1200_SD_INT, | ||
121 | .flags = IORESOURCE_IRQ, | ||
122 | }, | ||
123 | [2] = { | ||
124 | .start = AU1200_DSCR_CMD0_SDMS_TX0, | ||
125 | .end = AU1200_DSCR_CMD0_SDMS_TX0, | ||
126 | .flags = IORESOURCE_DMA, | ||
127 | }, | ||
128 | [3] = { | ||
129 | .start = AU1200_DSCR_CMD0_SDMS_RX0, | ||
130 | .end = AU1200_DSCR_CMD0_SDMS_RX0, | ||
131 | .flags = IORESOURCE_DMA, | ||
132 | } | ||
133 | }; | ||
134 | |||
135 | static struct platform_device pb1200_mmc0_dev = { | ||
136 | .name = "au1xxx-mmc", | ||
137 | .id = 0, | ||
138 | .dev = { | ||
139 | .dma_mask = &au1xxx_mmc_dmamask, | ||
140 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
141 | .platform_data = &pb1200mmc_platdata[0], | ||
142 | }, | ||
143 | .num_resources = ARRAY_SIZE(au1200_mmc0_res), | ||
144 | .resource = au1200_mmc0_res, | ||
145 | }; | ||
146 | |||
147 | static struct resource au1200_mmc1_res[] = { | ||
148 | [0] = { | ||
149 | .start = AU1100_SD1_PHYS_ADDR, | ||
150 | .end = AU1100_SD1_PHYS_ADDR + 0xfff, | ||
151 | .flags = IORESOURCE_MEM, | ||
152 | }, | ||
153 | [1] = { | ||
154 | .start = AU1200_SD_INT, | ||
155 | .end = AU1200_SD_INT, | ||
156 | .flags = IORESOURCE_IRQ, | ||
157 | }, | ||
158 | [2] = { | ||
159 | .start = AU1200_DSCR_CMD0_SDMS_TX1, | ||
160 | .end = AU1200_DSCR_CMD0_SDMS_TX1, | ||
161 | .flags = IORESOURCE_DMA, | ||
162 | }, | ||
163 | [3] = { | ||
164 | .start = AU1200_DSCR_CMD0_SDMS_RX1, | ||
165 | .end = AU1200_DSCR_CMD0_SDMS_RX1, | ||
166 | .flags = IORESOURCE_DMA, | ||
167 | } | ||
168 | }; | ||
169 | |||
170 | static struct platform_device pb1200_mmc1_dev = { | ||
171 | .name = "au1xxx-mmc", | ||
172 | .id = 1, | ||
173 | .dev = { | ||
174 | .dma_mask = &au1xxx_mmc_dmamask, | ||
175 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
176 | .platform_data = &pb1200mmc_platdata[1], | ||
177 | }, | ||
178 | .num_resources = ARRAY_SIZE(au1200_mmc1_res), | ||
179 | .resource = au1200_mmc1_res, | ||
180 | }; | ||
181 | |||
182 | |||
183 | static struct resource ide_resources[] = { | ||
184 | [0] = { | ||
185 | .start = IDE_PHYS_ADDR, | ||
186 | .end = IDE_PHYS_ADDR + IDE_PHYS_LEN - 1, | ||
187 | .flags = IORESOURCE_MEM | ||
188 | }, | ||
189 | [1] = { | ||
190 | .start = IDE_INT, | ||
191 | .end = IDE_INT, | ||
192 | .flags = IORESOURCE_IRQ | ||
193 | }, | ||
194 | [2] = { | ||
195 | .start = AU1200_DSCR_CMD0_DMA_REQ1, | ||
196 | .end = AU1200_DSCR_CMD0_DMA_REQ1, | ||
197 | .flags = IORESOURCE_DMA, | ||
198 | }, | ||
199 | }; | ||
200 | |||
201 | static u64 ide_dmamask = DMA_BIT_MASK(32); | ||
202 | |||
203 | static struct platform_device ide_device = { | ||
204 | .name = "au1200-ide", | ||
205 | .id = 0, | ||
206 | .dev = { | ||
207 | .dma_mask = &ide_dmamask, | ||
208 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
209 | }, | ||
210 | .num_resources = ARRAY_SIZE(ide_resources), | ||
211 | .resource = ide_resources | ||
212 | }; | ||
213 | |||
214 | static struct smc91x_platdata smc_data = { | ||
215 | .flags = SMC91X_NOWAIT | SMC91X_USE_16BIT, | ||
216 | .leda = RPC_LED_100_10, | ||
217 | .ledb = RPC_LED_TX_RX, | ||
218 | }; | ||
219 | |||
220 | static struct resource smc91c111_resources[] = { | ||
221 | [0] = { | ||
222 | .name = "smc91x-regs", | ||
223 | .start = SMC91C111_PHYS_ADDR, | ||
224 | .end = SMC91C111_PHYS_ADDR + 0xf, | ||
225 | .flags = IORESOURCE_MEM | ||
226 | }, | ||
227 | [1] = { | ||
228 | .start = SMC91C111_INT, | ||
229 | .end = SMC91C111_INT, | ||
230 | .flags = IORESOURCE_IRQ | ||
231 | }, | ||
232 | }; | ||
233 | |||
234 | static struct platform_device smc91c111_device = { | ||
235 | .dev = { | ||
236 | .platform_data = &smc_data, | ||
237 | }, | ||
238 | .name = "smc91x", | ||
239 | .id = -1, | ||
240 | .num_resources = ARRAY_SIZE(smc91c111_resources), | ||
241 | .resource = smc91c111_resources | ||
242 | }; | ||
243 | |||
244 | static struct resource au1200_psc0_res[] = { | ||
245 | [0] = { | ||
246 | .start = AU1550_PSC0_PHYS_ADDR, | ||
247 | .end = AU1550_PSC0_PHYS_ADDR + 0xfff, | ||
248 | .flags = IORESOURCE_MEM, | ||
249 | }, | ||
250 | [1] = { | ||
251 | .start = AU1200_PSC0_INT, | ||
252 | .end = AU1200_PSC0_INT, | ||
253 | .flags = IORESOURCE_IRQ, | ||
254 | }, | ||
255 | [2] = { | ||
256 | .start = AU1200_DSCR_CMD0_PSC0_TX, | ||
257 | .end = AU1200_DSCR_CMD0_PSC0_TX, | ||
258 | .flags = IORESOURCE_DMA, | ||
259 | }, | ||
260 | [3] = { | ||
261 | .start = AU1200_DSCR_CMD0_PSC0_RX, | ||
262 | .end = AU1200_DSCR_CMD0_PSC0_RX, | ||
263 | .flags = IORESOURCE_DMA, | ||
264 | }, | ||
265 | }; | ||
266 | |||
267 | static struct platform_device pb1200_i2c_dev = { | ||
268 | .name = "au1xpsc_smbus", | ||
269 | .id = 0, /* bus number */ | ||
270 | .num_resources = ARRAY_SIZE(au1200_psc0_res), | ||
271 | .resource = au1200_psc0_res, | ||
272 | }; | ||
273 | |||
274 | static struct resource au1200_lcd_res[] = { | ||
275 | [0] = { | ||
276 | .start = AU1200_LCD_PHYS_ADDR, | ||
277 | .end = AU1200_LCD_PHYS_ADDR + 0x800 - 1, | ||
278 | .flags = IORESOURCE_MEM, | ||
279 | }, | ||
280 | [1] = { | ||
281 | .start = AU1200_LCD_INT, | ||
282 | .end = AU1200_LCD_INT, | ||
283 | .flags = IORESOURCE_IRQ, | ||
284 | } | ||
285 | }; | ||
286 | |||
287 | static u64 au1200_lcd_dmamask = DMA_BIT_MASK(32); | ||
288 | |||
289 | static struct platform_device au1200_lcd_dev = { | ||
290 | .name = "au1200-lcd", | ||
291 | .id = 0, | ||
292 | .dev = { | ||
293 | .dma_mask = &au1200_lcd_dmamask, | ||
294 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
295 | }, | ||
296 | .num_resources = ARRAY_SIZE(au1200_lcd_res), | ||
297 | .resource = au1200_lcd_res, | ||
298 | }; | ||
299 | |||
300 | static struct platform_device *board_platform_devices[] __initdata = { | ||
301 | &ide_device, | ||
302 | &smc91c111_device, | ||
303 | &pb1200_i2c_dev, | ||
304 | &pb1200_mmc0_dev, | ||
305 | &pb1200_mmc1_dev, | ||
306 | &au1200_lcd_dev, | ||
307 | }; | ||
308 | |||
309 | static int __init board_register_devices(void) | ||
310 | { | ||
311 | int swapped; | ||
312 | |||
313 | db1x_register_pcmcia_socket( | ||
314 | AU1000_PCMCIA_ATTR_PHYS_ADDR, | ||
315 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1, | ||
316 | AU1000_PCMCIA_MEM_PHYS_ADDR, | ||
317 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x000400000 - 1, | ||
318 | AU1000_PCMCIA_IO_PHYS_ADDR, | ||
319 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x000010000 - 1, | ||
320 | PB1200_PC0_INT, PB1200_PC0_INSERT_INT, | ||
321 | /*PB1200_PC0_STSCHG_INT*/0, PB1200_PC0_EJECT_INT, 0); | ||
322 | |||
323 | db1x_register_pcmcia_socket( | ||
324 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x008000000, | ||
325 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x008400000 - 1, | ||
326 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x008000000, | ||
327 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x008400000 - 1, | ||
328 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x008000000, | ||
329 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x008010000 - 1, | ||
330 | PB1200_PC1_INT, PB1200_PC1_INSERT_INT, | ||
331 | /*PB1200_PC1_STSCHG_INT*/0, PB1200_PC1_EJECT_INT, 1); | ||
332 | |||
333 | swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1200_SWAPBOOT; | ||
334 | db1x_register_norflash(128 * 1024 * 1024, 2, swapped); | ||
335 | |||
336 | return platform_add_devices(board_platform_devices, | ||
337 | ARRAY_SIZE(board_platform_devices)); | ||
338 | } | ||
339 | device_initcall(board_register_devices); | ||
diff --git a/arch/mips/alchemy/devboards/pb1500/board_setup.c b/arch/mips/alchemy/devboards/pb1500.c index 37c1883b5ea9..e7b807b3ec51 100644 --- a/arch/mips/alchemy/devboards/pb1500/board_setup.c +++ b/arch/mips/alchemy/devboards/pb1500.c | |||
@@ -1,41 +1,37 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright 2000, 2008 MontaVista Software Inc. | 2 | * Pb1500 board support. |
3 | * Author: MontaVista Software, Inc. <source@mvista.com> | ||
4 | * | 3 | * |
5 | * This program is free software; you can redistribute it and/or modify it | 4 | * Copyright (C) 2009 Manuel Lauss |
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 | * | 5 | * |
10 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | 6 | * This program is free software; you can redistribute it and/or modify |
11 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | 7 | * it under the terms of the GNU General Public License as published by |
12 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | 8 | * the Free Software Foundation; either version 2 of the License, or |
13 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 9 | * (at your option) any later version. |
14 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
15 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
16 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
17 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
18 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
19 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
20 | * | 10 | * |
21 | * You should have received a copy of the GNU General Public License along | 11 | * This program is distributed in the hope that it will be useful, |
22 | * with this program; if not, write to the Free Software Foundation, Inc., | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
23 | * 675 Mass Ave, Cambridge, MA 02139, USA. | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
24 | */ | 19 | */ |
25 | 20 | ||
26 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
22 | #include <linux/dma-mapping.h> | ||
27 | #include <linux/gpio.h> | 23 | #include <linux/gpio.h> |
28 | #include <linux/init.h> | 24 | #include <linux/init.h> |
29 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
30 | 26 | #include <linux/platform_device.h> | |
31 | #include <asm/mach-au1x00/au1000.h> | 27 | #include <asm/mach-au1x00/au1000.h> |
32 | #include <asm/mach-db1x00/bcsr.h> | 28 | #include <asm/mach-db1x00/bcsr.h> |
33 | |||
34 | #include <prom.h> | 29 | #include <prom.h> |
30 | #include "platform.h" | ||
35 | 31 | ||
36 | const char *get_system_type(void) | 32 | const char *get_system_type(void) |
37 | { | 33 | { |
38 | return "Alchemy Pb1500"; | 34 | return "PB1500"; |
39 | } | 35 | } |
40 | 36 | ||
41 | void __init board_setup(void) | 37 | void __init board_setup(void) |
@@ -123,17 +119,80 @@ void __init board_setup(void) | |||
123 | } | 119 | } |
124 | } | 120 | } |
125 | 121 | ||
126 | static int __init pb1500_init_irq(void) | 122 | /******************************************************************************/ |
123 | |||
124 | static int pb1500_map_pci_irq(const struct pci_dev *d, u8 slot, u8 pin) | ||
127 | { | 125 | { |
128 | irq_set_irq_type(AU1500_GPIO9_INT, IRQF_TRIGGER_LOW); /* CD0# */ | 126 | if ((slot < 12) || (slot > 13) || pin == 0) |
129 | irq_set_irq_type(AU1500_GPIO10_INT, IRQF_TRIGGER_LOW); /* CARD0 */ | 127 | return -1; |
130 | irq_set_irq_type(AU1500_GPIO11_INT, IRQF_TRIGGER_LOW); /* STSCHG0# */ | 128 | if (slot == 12) |
129 | return (pin == 1) ? AU1500_PCI_INTA : 0xff; | ||
130 | if (slot == 13) { | ||
131 | switch (pin) { | ||
132 | case 1: return AU1500_PCI_INTA; | ||
133 | case 2: return AU1500_PCI_INTB; | ||
134 | case 3: return AU1500_PCI_INTC; | ||
135 | case 4: return AU1500_PCI_INTD; | ||
136 | } | ||
137 | } | ||
138 | return -1; | ||
139 | } | ||
140 | |||
141 | static struct resource alchemy_pci_host_res[] = { | ||
142 | [0] = { | ||
143 | .start = AU1500_PCI_PHYS_ADDR, | ||
144 | .end = AU1500_PCI_PHYS_ADDR + 0xfff, | ||
145 | .flags = IORESOURCE_MEM, | ||
146 | }, | ||
147 | }; | ||
148 | |||
149 | static struct alchemy_pci_platdata pb1500_pci_pd = { | ||
150 | .board_map_irq = pb1500_map_pci_irq, | ||
151 | .pci_cfg_set = PCI_CONFIG_AEN | PCI_CONFIG_R2H | PCI_CONFIG_R1H | | ||
152 | PCI_CONFIG_CH | | ||
153 | #if defined(__MIPSEB__) | ||
154 | PCI_CONFIG_SIC_HWA_DAT | PCI_CONFIG_SM, | ||
155 | #else | ||
156 | 0, | ||
157 | #endif | ||
158 | }; | ||
159 | |||
160 | static struct platform_device pb1500_pci_host = { | ||
161 | .dev.platform_data = &pb1500_pci_pd, | ||
162 | .name = "alchemy-pci", | ||
163 | .id = 0, | ||
164 | .num_resources = ARRAY_SIZE(alchemy_pci_host_res), | ||
165 | .resource = alchemy_pci_host_res, | ||
166 | }; | ||
167 | |||
168 | static int __init pb1500_dev_init(void) | ||
169 | { | ||
170 | int swapped; | ||
171 | |||
172 | irq_set_irq_type(AU1500_GPIO9_INT, IRQF_TRIGGER_LOW); /* CD0# */ | ||
173 | irq_set_irq_type(AU1500_GPIO10_INT, IRQF_TRIGGER_LOW); /* CARD0 */ | ||
174 | irq_set_irq_type(AU1500_GPIO11_INT, IRQF_TRIGGER_LOW); /* STSCHG0# */ | ||
131 | irq_set_irq_type(AU1500_GPIO204_INT, IRQF_TRIGGER_HIGH); | 175 | irq_set_irq_type(AU1500_GPIO204_INT, IRQF_TRIGGER_HIGH); |
132 | irq_set_irq_type(AU1500_GPIO201_INT, IRQF_TRIGGER_LOW); | 176 | irq_set_irq_type(AU1500_GPIO201_INT, IRQF_TRIGGER_LOW); |
133 | irq_set_irq_type(AU1500_GPIO202_INT, IRQF_TRIGGER_LOW); | 177 | irq_set_irq_type(AU1500_GPIO202_INT, IRQF_TRIGGER_LOW); |
134 | irq_set_irq_type(AU1500_GPIO203_INT, IRQF_TRIGGER_LOW); | 178 | irq_set_irq_type(AU1500_GPIO203_INT, IRQF_TRIGGER_LOW); |
135 | irq_set_irq_type(AU1500_GPIO205_INT, IRQF_TRIGGER_LOW); | 179 | irq_set_irq_type(AU1500_GPIO205_INT, IRQF_TRIGGER_LOW); |
136 | 180 | ||
181 | /* PCMCIA. single socket, identical to Pb1100 */ | ||
182 | db1x_register_pcmcia_socket( | ||
183 | AU1000_PCMCIA_ATTR_PHYS_ADDR, | ||
184 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1, | ||
185 | AU1000_PCMCIA_MEM_PHYS_ADDR, | ||
186 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x000400000 - 1, | ||
187 | AU1000_PCMCIA_IO_PHYS_ADDR, | ||
188 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x000010000 - 1, | ||
189 | AU1500_GPIO11_INT, AU1500_GPIO9_INT, /* card / insert */ | ||
190 | /*AU1500_GPIO10_INT*/0, 0, 0); /* stschg / eject / id */ | ||
191 | |||
192 | swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1000_SWAPBOOT; | ||
193 | db1x_register_norflash(64 * 1024 * 1024, 4, swapped); | ||
194 | platform_device_register(&pb1500_pci_host); | ||
195 | |||
137 | return 0; | 196 | return 0; |
138 | } | 197 | } |
139 | arch_initcall(pb1500_init_irq); | 198 | arch_initcall(pb1500_dev_init); |
diff --git a/arch/mips/alchemy/devboards/pb1500/Makefile b/arch/mips/alchemy/devboards/pb1500/Makefile deleted file mode 100644 index e83b151b5b63..000000000000 --- a/arch/mips/alchemy/devboards/pb1500/Makefile +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | # | ||
2 | # Copyright 2000, 2001, 2008 MontaVista Software Inc. | ||
3 | # Author: MontaVista Software, Inc. <source@mvista.com> | ||
4 | # | ||
5 | # Makefile for the Alchemy Semiconductor Pb1500 board. | ||
6 | # | ||
7 | |||
8 | obj-y := board_setup.o platform.o | ||
diff --git a/arch/mips/alchemy/devboards/pb1500/platform.c b/arch/mips/alchemy/devboards/pb1500/platform.c deleted file mode 100644 index 1e52a01bac00..000000000000 --- a/arch/mips/alchemy/devboards/pb1500/platform.c +++ /dev/null | |||
@@ -1,94 +0,0 @@ | |||
1 | /* | ||
2 | * Pb1500 board platform device registration | ||
3 | * | ||
4 | * Copyright (C) 2009 Manuel Lauss | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #include <linux/dma-mapping.h> | ||
22 | #include <linux/init.h> | ||
23 | #include <linux/platform_device.h> | ||
24 | #include <asm/mach-au1x00/au1000.h> | ||
25 | #include <asm/mach-db1x00/bcsr.h> | ||
26 | |||
27 | #include "../platform.h" | ||
28 | |||
29 | static int pb1500_map_pci_irq(const struct pci_dev *d, u8 slot, u8 pin) | ||
30 | { | ||
31 | if ((slot < 12) || (slot > 13) || pin == 0) | ||
32 | return -1; | ||
33 | if (slot == 12) | ||
34 | return (pin == 1) ? AU1500_PCI_INTA : 0xff; | ||
35 | if (slot == 13) { | ||
36 | switch (pin) { | ||
37 | case 1: return AU1500_PCI_INTA; | ||
38 | case 2: return AU1500_PCI_INTB; | ||
39 | case 3: return AU1500_PCI_INTC; | ||
40 | case 4: return AU1500_PCI_INTD; | ||
41 | } | ||
42 | } | ||
43 | return -1; | ||
44 | } | ||
45 | |||
46 | static struct resource alchemy_pci_host_res[] = { | ||
47 | [0] = { | ||
48 | .start = AU1500_PCI_PHYS_ADDR, | ||
49 | .end = AU1500_PCI_PHYS_ADDR + 0xfff, | ||
50 | .flags = IORESOURCE_MEM, | ||
51 | }, | ||
52 | }; | ||
53 | |||
54 | static struct alchemy_pci_platdata pb1500_pci_pd = { | ||
55 | .board_map_irq = pb1500_map_pci_irq, | ||
56 | .pci_cfg_set = PCI_CONFIG_AEN | PCI_CONFIG_R2H | PCI_CONFIG_R1H | | ||
57 | PCI_CONFIG_CH | | ||
58 | #if defined(__MIPSEB__) | ||
59 | PCI_CONFIG_SIC_HWA_DAT | PCI_CONFIG_SM, | ||
60 | #else | ||
61 | 0, | ||
62 | #endif | ||
63 | }; | ||
64 | |||
65 | static struct platform_device pb1500_pci_host = { | ||
66 | .dev.platform_data = &pb1500_pci_pd, | ||
67 | .name = "alchemy-pci", | ||
68 | .id = 0, | ||
69 | .num_resources = ARRAY_SIZE(alchemy_pci_host_res), | ||
70 | .resource = alchemy_pci_host_res, | ||
71 | }; | ||
72 | |||
73 | static int __init pb1500_dev_init(void) | ||
74 | { | ||
75 | int swapped; | ||
76 | |||
77 | /* PCMCIA. single socket, identical to Pb1100 */ | ||
78 | db1x_register_pcmcia_socket( | ||
79 | AU1000_PCMCIA_ATTR_PHYS_ADDR, | ||
80 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1, | ||
81 | AU1000_PCMCIA_MEM_PHYS_ADDR, | ||
82 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x000400000 - 1, | ||
83 | AU1000_PCMCIA_IO_PHYS_ADDR, | ||
84 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x000010000 - 1, | ||
85 | AU1500_GPIO11_INT, AU1500_GPIO9_INT, /* card / insert */ | ||
86 | /*AU1500_GPIO10_INT*/0, 0, 0); /* stschg / eject / id */ | ||
87 | |||
88 | swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1000_SWAPBOOT; | ||
89 | db1x_register_norflash(64 * 1024 * 1024, 4, swapped); | ||
90 | platform_device_register(&pb1500_pci_host); | ||
91 | |||
92 | return 0; | ||
93 | } | ||
94 | arch_initcall(pb1500_dev_init); | ||
diff --git a/arch/mips/alchemy/devboards/pb1550/platform.c b/arch/mips/alchemy/devboards/pb1550.c index a4604b8a349e..b37e7de8d920 100644 --- a/arch/mips/alchemy/devboards/pb1550/platform.c +++ b/arch/mips/alchemy/devboards/pb1550.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Pb1550 board platform device registration | 2 | * Pb1550 board support. |
3 | * | 3 | * |
4 | * Copyright (C) 2009 Manuel Lauss | 4 | * Copyright (C) 2009-2011 Manuel Lauss |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
@@ -20,13 +20,44 @@ | |||
20 | 20 | ||
21 | #include <linux/dma-mapping.h> | 21 | #include <linux/dma-mapping.h> |
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/interrupt.h> | ||
23 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
24 | #include <asm/mach-au1x00/au1000.h> | 25 | #include <asm/mach-au1x00/au1000.h> |
25 | #include <asm/mach-au1x00/au1xxx_dbdma.h> | 26 | #include <asm/mach-au1x00/au1xxx_dbdma.h> |
26 | #include <asm/mach-pb1x00/pb1550.h> | 27 | #include <asm/mach-au1x00/au1550nd.h> |
28 | #include <asm/mach-au1x00/gpio.h> | ||
27 | #include <asm/mach-db1x00/bcsr.h> | 29 | #include <asm/mach-db1x00/bcsr.h> |
30 | #include "platform.h" | ||
28 | 31 | ||
29 | #include "../platform.h" | 32 | const char *get_system_type(void) |
33 | { | ||
34 | return "PB1550"; | ||
35 | } | ||
36 | |||
37 | void __init board_setup(void) | ||
38 | { | ||
39 | u32 pin_func; | ||
40 | |||
41 | bcsr_init(PB1550_BCSR_PHYS_ADDR, | ||
42 | PB1550_BCSR_PHYS_ADDR + PB1550_BCSR_HEXLED_OFS); | ||
43 | |||
44 | alchemy_gpio2_enable(); | ||
45 | |||
46 | /* | ||
47 | * Enable PSC1 SYNC for AC'97. Normaly done in audio driver, | ||
48 | * but it is board specific code, so put it here. | ||
49 | */ | ||
50 | pin_func = au_readl(SYS_PINFUNC); | ||
51 | au_sync(); | ||
52 | pin_func |= SYS_PF_MUST_BE_SET | SYS_PF_PSC1_S1; | ||
53 | au_writel(pin_func, SYS_PINFUNC); | ||
54 | |||
55 | bcsr_write(BCSR_PCMCIA, 0); /* turn off PCMCIA power */ | ||
56 | |||
57 | printk(KERN_INFO "AMD Alchemy Pb1550 Board\n"); | ||
58 | } | ||
59 | |||
60 | /******************************************************************************/ | ||
30 | 61 | ||
31 | static int pb1550_map_pci_irq(const struct pci_dev *d, u8 slot, u8 pin) | 62 | static int pb1550_map_pci_irq(const struct pci_dev *d, u8 slot, u8 pin) |
32 | { | 63 | { |
@@ -101,10 +132,79 @@ static struct platform_device pb1550_i2c_dev = { | |||
101 | .resource = au1550_psc2_res, | 132 | .resource = au1550_psc2_res, |
102 | }; | 133 | }; |
103 | 134 | ||
135 | static struct mtd_partition pb1550_nand_parts[] = { | ||
136 | [0] = { | ||
137 | .name = "NAND FS 0", | ||
138 | .offset = 0, | ||
139 | .size = 8 * 1024 * 1024, | ||
140 | }, | ||
141 | [1] = { | ||
142 | .name = "NAND FS 1", | ||
143 | .offset = MTDPART_OFS_APPEND, | ||
144 | .size = MTDPART_SIZ_FULL, | ||
145 | }, | ||
146 | }; | ||
147 | |||
148 | static struct au1550nd_platdata pb1550_nand_pd = { | ||
149 | .parts = pb1550_nand_parts, | ||
150 | .num_parts = ARRAY_SIZE(pb1550_nand_parts), | ||
151 | .devwidth = 0, /* x8 NAND default, needs fixing up */ | ||
152 | }; | ||
153 | |||
154 | static struct resource pb1550_nand_res[] = { | ||
155 | [0] = { | ||
156 | .start = 0x20000000, | ||
157 | .end = 0x20000fff, | ||
158 | .flags = IORESOURCE_MEM, | ||
159 | }, | ||
160 | }; | ||
161 | |||
162 | static struct platform_device pb1550_nand_dev = { | ||
163 | .name = "au1550-nand", | ||
164 | .id = -1, | ||
165 | .resource = pb1550_nand_res, | ||
166 | .num_resources = ARRAY_SIZE(pb1550_nand_res), | ||
167 | .dev = { | ||
168 | .platform_data = &pb1550_nand_pd, | ||
169 | }, | ||
170 | }; | ||
171 | |||
172 | static void __init pb1550_nand_setup(void) | ||
173 | { | ||
174 | int boot_swapboot = (au_readl(MEM_STSTAT) & (0x7 << 1)) | | ||
175 | ((bcsr_read(BCSR_STATUS) >> 6) & 0x1); | ||
176 | |||
177 | switch (boot_swapboot) { | ||
178 | case 0: | ||
179 | case 2: | ||
180 | case 8: | ||
181 | case 0xC: | ||
182 | case 0xD: | ||
183 | /* x16 NAND Flash */ | ||
184 | pb1550_nand_pd.devwidth = 1; | ||
185 | /* fallthrough */ | ||
186 | case 1: | ||
187 | case 9: | ||
188 | case 3: | ||
189 | case 0xE: | ||
190 | case 0xF: | ||
191 | /* x8 NAND, already set up */ | ||
192 | platform_device_register(&pb1550_nand_dev); | ||
193 | } | ||
194 | } | ||
195 | |||
104 | static int __init pb1550_dev_init(void) | 196 | static int __init pb1550_dev_init(void) |
105 | { | 197 | { |
106 | int swapped; | 198 | int swapped; |
107 | 199 | ||
200 | irq_set_irq_type(AU1550_GPIO0_INT, IRQF_TRIGGER_LOW); | ||
201 | irq_set_irq_type(AU1550_GPIO1_INT, IRQF_TRIGGER_LOW); | ||
202 | irq_set_irq_type(AU1550_GPIO201_205_INT, IRQF_TRIGGER_HIGH); | ||
203 | |||
204 | /* enable both PCMCIA card irqs in the shared line */ | ||
205 | alchemy_gpio2_enable_int(201); | ||
206 | alchemy_gpio2_enable_int(202); | ||
207 | |||
108 | /* Pb1550, like all others, also has statuschange irqs; however they're | 208 | /* Pb1550, like all others, also has statuschange irqs; however they're |
109 | * wired up on one of the Au1550's shared GPIO201_205 line, which also | 209 | * wired up on one of the Au1550's shared GPIO201_205 line, which also |
110 | * services the PCMCIA card interrupts. So we ignore statuschange and | 210 | * services the PCMCIA card interrupts. So we ignore statuschange and |
@@ -130,6 +230,10 @@ static int __init pb1550_dev_init(void) | |||
130 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x008010000 - 1, | 230 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x008010000 - 1, |
131 | AU1550_GPIO201_205_INT, AU1550_GPIO1_INT, 0, 0, 1); | 231 | AU1550_GPIO201_205_INT, AU1550_GPIO1_INT, 0, 0, 1); |
132 | 232 | ||
233 | /* NAND setup */ | ||
234 | gpio_direction_input(206); /* GPIO206 high */ | ||
235 | pb1550_nand_setup(); | ||
236 | |||
133 | swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_PB1550_SWAPBOOT; | 237 | swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_PB1550_SWAPBOOT; |
134 | db1x_register_norflash(128 * 1024 * 1024, 4, swapped); | 238 | db1x_register_norflash(128 * 1024 * 1024, 4, swapped); |
135 | platform_device_register(&pb1550_pci_host); | 239 | platform_device_register(&pb1550_pci_host); |
diff --git a/arch/mips/alchemy/devboards/pb1550/Makefile b/arch/mips/alchemy/devboards/pb1550/Makefile deleted file mode 100644 index 9661b6ec5dd3..000000000000 --- a/arch/mips/alchemy/devboards/pb1550/Makefile +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | # | ||
2 | # Copyright 2000, 2008 MontaVista Software Inc. | ||
3 | # Author: MontaVista Software, Inc. <source@mvista.com> | ||
4 | # | ||
5 | # Makefile for the Alchemy Semiconductor Pb1550 board. | ||
6 | # | ||
7 | |||
8 | obj-y := board_setup.o platform.o | ||
diff --git a/arch/mips/alchemy/devboards/pb1550/board_setup.c b/arch/mips/alchemy/devboards/pb1550/board_setup.c deleted file mode 100644 index 0f62d1e3df24..000000000000 --- a/arch/mips/alchemy/devboards/pb1550/board_setup.c +++ /dev/null | |||
@@ -1,80 +0,0 @@ | |||
1 | /* | ||
2 | * | ||
3 | * BRIEF MODULE DESCRIPTION | ||
4 | * Alchemy Pb1550 board setup. | ||
5 | * | ||
6 | * Copyright 2000, 2008 MontaVista Software Inc. | ||
7 | * Author: MontaVista Software, Inc. <source@mvista.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the | ||
11 | * Free Software Foundation; either version 2 of the License, or (at your | ||
12 | * option) any later version. | ||
13 | * | ||
14 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
15 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
16 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
17 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
20 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
24 | * | ||
25 | * You should have received a copy of the GNU General Public License along | ||
26 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
27 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
28 | */ | ||
29 | |||
30 | #include <linux/init.h> | ||
31 | #include <linux/interrupt.h> | ||
32 | |||
33 | #include <asm/mach-au1x00/au1000.h> | ||
34 | #include <asm/mach-pb1x00/pb1550.h> | ||
35 | #include <asm/mach-db1x00/bcsr.h> | ||
36 | #include <asm/mach-au1x00/gpio.h> | ||
37 | |||
38 | #include <prom.h> | ||
39 | |||
40 | const char *get_system_type(void) | ||
41 | { | ||
42 | return "Alchemy Pb1550"; | ||
43 | } | ||
44 | |||
45 | void __init board_setup(void) | ||
46 | { | ||
47 | u32 pin_func; | ||
48 | |||
49 | bcsr_init(PB1550_BCSR_PHYS_ADDR, | ||
50 | PB1550_BCSR_PHYS_ADDR + PB1550_BCSR_HEXLED_OFS); | ||
51 | |||
52 | alchemy_gpio2_enable(); | ||
53 | |||
54 | /* | ||
55 | * Enable PSC1 SYNC for AC'97. Normaly done in audio driver, | ||
56 | * but it is board specific code, so put it here. | ||
57 | */ | ||
58 | pin_func = au_readl(SYS_PINFUNC); | ||
59 | au_sync(); | ||
60 | pin_func |= SYS_PF_MUST_BE_SET | SYS_PF_PSC1_S1; | ||
61 | au_writel(pin_func, SYS_PINFUNC); | ||
62 | |||
63 | bcsr_write(BCSR_PCMCIA, 0); /* turn off PCMCIA power */ | ||
64 | |||
65 | printk(KERN_INFO "AMD Alchemy Pb1550 Board\n"); | ||
66 | } | ||
67 | |||
68 | static int __init pb1550_init_irq(void) | ||
69 | { | ||
70 | irq_set_irq_type(AU1550_GPIO0_INT, IRQF_TRIGGER_LOW); | ||
71 | irq_set_irq_type(AU1550_GPIO1_INT, IRQF_TRIGGER_LOW); | ||
72 | irq_set_irq_type(AU1550_GPIO201_205_INT, IRQF_TRIGGER_HIGH); | ||
73 | |||
74 | /* enable both PCMCIA card irqs in the shared line */ | ||
75 | alchemy_gpio2_enable_int(201); | ||
76 | alchemy_gpio2_enable_int(202); | ||
77 | |||
78 | return 0; | ||
79 | } | ||
80 | arch_initcall(pb1550_init_irq); | ||
diff --git a/arch/mips/alchemy/devboards/platform.c b/arch/mips/alchemy/devboards/platform.c index 49a4b3244d8e..621f70afb63a 100644 --- a/arch/mips/alchemy/devboards/platform.c +++ b/arch/mips/alchemy/devboards/platform.c | |||
@@ -13,6 +13,13 @@ | |||
13 | #include <asm/reboot.h> | 13 | #include <asm/reboot.h> |
14 | #include <asm/mach-db1x00/bcsr.h> | 14 | #include <asm/mach-db1x00/bcsr.h> |
15 | 15 | ||
16 | |||
17 | static struct platform_device db1x00_rtc_dev = { | ||
18 | .name = "rtc-au1xxx", | ||
19 | .id = -1, | ||
20 | }; | ||
21 | |||
22 | |||
16 | static void db1x_power_off(void) | 23 | static void db1x_power_off(void) |
17 | { | 24 | { |
18 | bcsr_write(BCSR_RESETS, 0); | 25 | bcsr_write(BCSR_RESETS, 0); |
@@ -25,7 +32,7 @@ static void db1x_reset(char *c) | |||
25 | bcsr_write(BCSR_SYSTEM, 0); | 32 | bcsr_write(BCSR_SYSTEM, 0); |
26 | } | 33 | } |
27 | 34 | ||
28 | static int __init db1x_poweroff_setup(void) | 35 | static int __init db1x_late_setup(void) |
29 | { | 36 | { |
30 | if (!pm_power_off) | 37 | if (!pm_power_off) |
31 | pm_power_off = db1x_power_off; | 38 | pm_power_off = db1x_power_off; |
@@ -34,9 +41,11 @@ static int __init db1x_poweroff_setup(void) | |||
34 | if (!_machine_restart) | 41 | if (!_machine_restart) |
35 | _machine_restart = db1x_reset; | 42 | _machine_restart = db1x_reset; |
36 | 43 | ||
44 | platform_device_register(&db1x00_rtc_dev); | ||
45 | |||
37 | return 0; | 46 | return 0; |
38 | } | 47 | } |
39 | late_initcall(db1x_poweroff_setup); | 48 | device_initcall(db1x_late_setup); |
40 | 49 | ||
41 | /* register a pcmcia socket */ | 50 | /* register a pcmcia socket */ |
42 | int __init db1x_register_pcmcia_socket(phys_addr_t pcmcia_attr_start, | 51 | int __init db1x_register_pcmcia_socket(phys_addr_t pcmcia_attr_start, |
diff --git a/arch/mips/alchemy/devboards/prom.c b/arch/mips/alchemy/devboards/prom.c index e5306b56da6d..93a22107cc41 100644 --- a/arch/mips/alchemy/devboards/prom.c +++ b/arch/mips/alchemy/devboards/prom.c | |||
@@ -33,10 +33,9 @@ | |||
33 | #include <asm/mach-au1x00/au1000.h> | 33 | #include <asm/mach-au1x00/au1000.h> |
34 | #include <prom.h> | 34 | #include <prom.h> |
35 | 35 | ||
36 | #if defined(CONFIG_MIPS_PB1000) || defined(CONFIG_MIPS_DB1000) || \ | 36 | #if defined(CONFIG_MIPS_DB1000) || \ |
37 | defined(CONFIG_MIPS_PB1100) || defined(CONFIG_MIPS_DB1100) || \ | 37 | defined(CONFIG_MIPS_PB1100) || \ |
38 | defined(CONFIG_MIPS_PB1500) || defined(CONFIG_MIPS_DB1500) || \ | 38 | defined(CONFIG_MIPS_PB1500) |
39 | defined(CONFIG_MIPS_BOSPORUS) || defined(CONFIG_MIPS_MIRAGE) | ||
40 | #define ALCHEMY_BOARD_DEFAULT_MEMSIZE 0x04000000 | 39 | #define ALCHEMY_BOARD_DEFAULT_MEMSIZE 0x04000000 |
41 | 40 | ||
42 | #else /* Au1550/Au1200-based develboards */ | 41 | #else /* Au1550/Au1200-based develboards */ |
@@ -62,5 +61,9 @@ void __init prom_init(void) | |||
62 | 61 | ||
63 | void prom_putchar(unsigned char c) | 62 | void prom_putchar(unsigned char c) |
64 | { | 63 | { |
64 | #ifdef CONFIG_MIPS_DB1300 | ||
65 | alchemy_uart_putchar(AU1300_UART2_PHYS_ADDR, c); | ||
66 | #else | ||
65 | alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c); | 67 | alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c); |
68 | #endif | ||
66 | } | 69 | } |
diff --git a/arch/mips/alchemy/gpr/Makefile b/arch/mips/alchemy/gpr/Makefile deleted file mode 100644 index cb73fe256dce..000000000000 --- a/arch/mips/alchemy/gpr/Makefile +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | # | ||
2 | # Copyright 2003 MontaVista Software Inc. | ||
3 | # Author: MontaVista Software, Inc. <source@mvista.com> | ||
4 | # | ||
5 | # Makefile for Trapeze ITS GPR board. | ||
6 | # | ||
7 | |||
8 | obj-y += board_setup.o init.o platform.o | ||
diff --git a/arch/mips/alchemy/gpr/board_setup.c b/arch/mips/alchemy/gpr/board_setup.c deleted file mode 100644 index dea45c78fdcd..000000000000 --- a/arch/mips/alchemy/gpr/board_setup.c +++ /dev/null | |||
@@ -1,75 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2010 Wolfgang Grandegger <wg@denx.de> | ||
3 | * | ||
4 | * Copyright 2000-2003, 2008 MontaVista Software Inc. | ||
5 | * Author: MontaVista Software, Inc. <source@mvista.com> | ||
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 as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | * | ||
12 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
13 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
14 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
15 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
16 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
17 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
18 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
19 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
20 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
21 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License along | ||
24 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
25 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
26 | */ | ||
27 | |||
28 | #include <linux/gpio.h> | ||
29 | #include <linux/init.h> | ||
30 | #include <linux/interrupt.h> | ||
31 | #include <linux/delay.h> | ||
32 | #include <linux/pm.h> | ||
33 | |||
34 | #include <asm/reboot.h> | ||
35 | #include <asm/mach-au1x00/au1000.h> | ||
36 | |||
37 | #include <prom.h> | ||
38 | |||
39 | static void gpr_reset(char *c) | ||
40 | { | ||
41 | /* switch System-LED to orange (red# and green# on) */ | ||
42 | alchemy_gpio_direction_output(4, 0); | ||
43 | alchemy_gpio_direction_output(5, 0); | ||
44 | |||
45 | /* trigger watchdog to reset board in 200ms */ | ||
46 | printk(KERN_EMERG "Triggering watchdog soft reset...\n"); | ||
47 | raw_local_irq_disable(); | ||
48 | alchemy_gpio_direction_output(1, 0); | ||
49 | udelay(1); | ||
50 | alchemy_gpio_set_value(1, 1); | ||
51 | while (1) | ||
52 | cpu_wait(); | ||
53 | } | ||
54 | |||
55 | static void gpr_power_off(void) | ||
56 | { | ||
57 | while (1) | ||
58 | cpu_wait(); | ||
59 | } | ||
60 | |||
61 | void __init board_setup(void) | ||
62 | { | ||
63 | printk(KERN_INFO "Trapeze ITS GPR board\n"); | ||
64 | |||
65 | pm_power_off = gpr_power_off; | ||
66 | _machine_halt = gpr_power_off; | ||
67 | _machine_restart = gpr_reset; | ||
68 | |||
69 | /* Enable UART1/3 */ | ||
70 | alchemy_uart_enable(AU1000_UART3_PHYS_ADDR); | ||
71 | alchemy_uart_enable(AU1000_UART1_PHYS_ADDR); | ||
72 | |||
73 | /* Take away Reset of UMTS-card */ | ||
74 | alchemy_gpio_direction_output(215, 1); | ||
75 | } | ||
diff --git a/arch/mips/alchemy/gpr/init.c b/arch/mips/alchemy/gpr/init.c deleted file mode 100644 index 229aafae680c..000000000000 --- a/arch/mips/alchemy/gpr/init.c +++ /dev/null | |||
@@ -1,63 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2010 Wolfgang Grandegger <wg@denx.de> | ||
3 | * | ||
4 | * Copyright 2003, 2008 MontaVista Software Inc. | ||
5 | * Author: MontaVista Software, Inc. <source@mvista.com> | ||
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 as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | * | ||
12 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
13 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
14 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
15 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
16 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
17 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
18 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
19 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
20 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
21 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License along | ||
24 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
25 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
26 | */ | ||
27 | |||
28 | #include <linux/init.h> | ||
29 | #include <linux/kernel.h> | ||
30 | |||
31 | #include <asm/bootinfo.h> | ||
32 | #include <asm/mach-au1x00/au1000.h> | ||
33 | |||
34 | #include <prom.h> | ||
35 | |||
36 | const char *get_system_type(void) | ||
37 | { | ||
38 | return "GPR"; | ||
39 | } | ||
40 | |||
41 | void __init prom_init(void) | ||
42 | { | ||
43 | unsigned char *memsize_str; | ||
44 | unsigned long memsize; | ||
45 | |||
46 | prom_argc = fw_arg0; | ||
47 | prom_argv = (char **)fw_arg1; | ||
48 | prom_envp = (char **)fw_arg2; | ||
49 | |||
50 | prom_init_cmdline(); | ||
51 | |||
52 | memsize_str = prom_getenv("memsize"); | ||
53 | if (!memsize_str) | ||
54 | memsize = 0x04000000; | ||
55 | else | ||
56 | strict_strtoul(memsize_str, 0, &memsize); | ||
57 | add_memory_region(0, memsize, BOOT_MEM_RAM); | ||
58 | } | ||
59 | |||
60 | void prom_putchar(unsigned char c) | ||
61 | { | ||
62 | alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c); | ||
63 | } | ||
diff --git a/arch/mips/alchemy/mtx-1/Makefile b/arch/mips/alchemy/mtx-1/Makefile deleted file mode 100644 index 81b540ceaf88..000000000000 --- a/arch/mips/alchemy/mtx-1/Makefile +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | # | ||
2 | # Copyright 2003 MontaVista Software Inc. | ||
3 | # Author: MontaVista Software, Inc. <source@mvista.com> | ||
4 | # Bruno Randolf <bruno.randolf@4g-systems.biz> | ||
5 | # | ||
6 | # Makefile for 4G Systems MTX-1 board. | ||
7 | # | ||
8 | |||
9 | obj-y += init.o board_setup.o platform.o | ||
diff --git a/arch/mips/alchemy/mtx-1/board_setup.c b/arch/mips/alchemy/mtx-1/board_setup.c deleted file mode 100644 index 851a5ab4c8f2..000000000000 --- a/arch/mips/alchemy/mtx-1/board_setup.c +++ /dev/null | |||
@@ -1,94 +0,0 @@ | |||
1 | /* | ||
2 | * | ||
3 | * BRIEF MODULE DESCRIPTION | ||
4 | * 4G Systems MTX-1 board setup. | ||
5 | * | ||
6 | * Copyright 2003, 2008 MontaVista Software Inc. | ||
7 | * Author: MontaVista Software, Inc. <source@mvista.com> | ||
8 | * Bruno Randolf <bruno.randolf@4g-systems.biz> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify it | ||
11 | * under the terms of the GNU General Public License as published by the | ||
12 | * Free Software Foundation; either version 2 of the License, or (at your | ||
13 | * option) any later version. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
16 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
17 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
18 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
21 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
22 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | * You should have received a copy of the GNU General Public License along | ||
27 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
28 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
29 | */ | ||
30 | |||
31 | #include <linux/gpio.h> | ||
32 | #include <linux/init.h> | ||
33 | #include <linux/interrupt.h> | ||
34 | #include <linux/pm.h> | ||
35 | |||
36 | #include <asm/reboot.h> | ||
37 | #include <asm/mach-au1x00/au1000.h> | ||
38 | |||
39 | #include <prom.h> | ||
40 | |||
41 | static void mtx1_reset(char *c) | ||
42 | { | ||
43 | /* Jump to the reset vector */ | ||
44 | __asm__ __volatile__("jr\t%0"::"r"(0xbfc00000)); | ||
45 | } | ||
46 | |||
47 | static void mtx1_power_off(void) | ||
48 | { | ||
49 | while (1) | ||
50 | asm volatile ( | ||
51 | " .set mips32 \n" | ||
52 | " wait \n" | ||
53 | " .set mips0 \n"); | ||
54 | } | ||
55 | |||
56 | void __init board_setup(void) | ||
57 | { | ||
58 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | ||
59 | /* Enable USB power switch */ | ||
60 | alchemy_gpio_direction_output(204, 0); | ||
61 | #endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */ | ||
62 | |||
63 | /* Initialize sys_pinfunc */ | ||
64 | au_writel(SYS_PF_NI2, SYS_PINFUNC); | ||
65 | |||
66 | /* Initialize GPIO */ | ||
67 | au_writel(~0, KSEG1ADDR(AU1000_SYS_PHYS_ADDR) + SYS_TRIOUTCLR); | ||
68 | alchemy_gpio_direction_output(0, 0); /* Disable M66EN (PCI 66MHz) */ | ||
69 | alchemy_gpio_direction_output(3, 1); /* Disable PCI CLKRUN# */ | ||
70 | alchemy_gpio_direction_output(1, 1); /* Enable EXT_IO3 */ | ||
71 | alchemy_gpio_direction_output(5, 0); /* Disable eth PHY TX_ER */ | ||
72 | |||
73 | /* Enable LED and set it to green */ | ||
74 | alchemy_gpio_direction_output(211, 1); /* green on */ | ||
75 | alchemy_gpio_direction_output(212, 0); /* red off */ | ||
76 | |||
77 | pm_power_off = mtx1_power_off; | ||
78 | _machine_halt = mtx1_power_off; | ||
79 | _machine_restart = mtx1_reset; | ||
80 | |||
81 | printk(KERN_INFO "4G Systems MTX-1 Board\n"); | ||
82 | } | ||
83 | |||
84 | static int __init mtx1_init_irq(void) | ||
85 | { | ||
86 | irq_set_irq_type(AU1500_GPIO204_INT, IRQF_TRIGGER_HIGH); | ||
87 | irq_set_irq_type(AU1500_GPIO201_INT, IRQF_TRIGGER_LOW); | ||
88 | irq_set_irq_type(AU1500_GPIO202_INT, IRQF_TRIGGER_LOW); | ||
89 | irq_set_irq_type(AU1500_GPIO203_INT, IRQF_TRIGGER_LOW); | ||
90 | irq_set_irq_type(AU1500_GPIO205_INT, IRQF_TRIGGER_LOW); | ||
91 | |||
92 | return 0; | ||
93 | } | ||
94 | arch_initcall(mtx1_init_irq); | ||
diff --git a/arch/mips/alchemy/mtx-1/init.c b/arch/mips/alchemy/mtx-1/init.c deleted file mode 100644 index 2e81cc7f3422..000000000000 --- a/arch/mips/alchemy/mtx-1/init.c +++ /dev/null | |||
@@ -1,66 +0,0 @@ | |||
1 | /* | ||
2 | * | ||
3 | * BRIEF MODULE DESCRIPTION | ||
4 | * 4G Systems MTX-1 board setup | ||
5 | * | ||
6 | * Copyright 2003, 2008 MontaVista Software Inc. | ||
7 | * Author: MontaVista Software, Inc. <source@mvista.com> | ||
8 | * Bruno Randolf <bruno.randolf@4g-systems.biz> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify it | ||
11 | * under the terms of the GNU General Public License as published by the | ||
12 | * Free Software Foundation; either version 2 of the License, or (at your | ||
13 | * option) any later version. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
16 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
17 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
18 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
21 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
22 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | * You should have received a copy of the GNU General Public License along | ||
27 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
28 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
29 | */ | ||
30 | |||
31 | #include <linux/kernel.h> | ||
32 | #include <linux/init.h> | ||
33 | |||
34 | #include <asm/bootinfo.h> | ||
35 | #include <asm/mach-au1x00/au1000.h> | ||
36 | |||
37 | #include <prom.h> | ||
38 | |||
39 | const char *get_system_type(void) | ||
40 | { | ||
41 | return "MTX-1"; | ||
42 | } | ||
43 | |||
44 | void __init prom_init(void) | ||
45 | { | ||
46 | unsigned char *memsize_str; | ||
47 | unsigned long memsize; | ||
48 | |||
49 | prom_argc = fw_arg0; | ||
50 | prom_argv = (char **)fw_arg1; | ||
51 | prom_envp = (char **)fw_arg2; | ||
52 | |||
53 | prom_init_cmdline(); | ||
54 | |||
55 | memsize_str = prom_getenv("memsize"); | ||
56 | if (!memsize_str) | ||
57 | memsize = 0x04000000; | ||
58 | else | ||
59 | strict_strtoul(memsize_str, 0, &memsize); | ||
60 | add_memory_region(0, memsize, BOOT_MEM_RAM); | ||
61 | } | ||
62 | |||
63 | void prom_putchar(unsigned char c) | ||
64 | { | ||
65 | alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c); | ||
66 | } | ||
diff --git a/arch/mips/alchemy/xxs1500/Makefile b/arch/mips/alchemy/xxs1500/Makefile deleted file mode 100644 index 91defcf4f335..000000000000 --- a/arch/mips/alchemy/xxs1500/Makefile +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | # | ||
2 | # Copyright 2003 MontaVista Software Inc. | ||
3 | # Author: MontaVista Software, Inc. <source@mvista.com> | ||
4 | # | ||
5 | # Makefile for MyCable XXS1500 board. | ||
6 | # | ||
7 | |||
8 | obj-y += init.o board_setup.o platform.o | ||
diff --git a/arch/mips/alchemy/xxs1500/board_setup.c b/arch/mips/alchemy/xxs1500/board_setup.c deleted file mode 100644 index 3fa83f72e014..000000000000 --- a/arch/mips/alchemy/xxs1500/board_setup.c +++ /dev/null | |||
@@ -1,93 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2000-2003, 2008 MontaVista Software Inc. | ||
3 | * Author: MontaVista Software, Inc. <source@mvista.com> | ||
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 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
11 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
12 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
13 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
14 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
15 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
16 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
17 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
18 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
19 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License along | ||
22 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
23 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
24 | */ | ||
25 | |||
26 | #include <linux/gpio.h> | ||
27 | #include <linux/init.h> | ||
28 | #include <linux/interrupt.h> | ||
29 | #include <linux/delay.h> | ||
30 | #include <linux/pm.h> | ||
31 | |||
32 | #include <asm/reboot.h> | ||
33 | #include <asm/mach-au1x00/au1000.h> | ||
34 | |||
35 | #include <prom.h> | ||
36 | |||
37 | static void xxs1500_reset(char *c) | ||
38 | { | ||
39 | /* Jump to the reset vector */ | ||
40 | __asm__ __volatile__("jr\t%0"::"r"(0xbfc00000)); | ||
41 | } | ||
42 | |||
43 | static void xxs1500_power_off(void) | ||
44 | { | ||
45 | while (1) | ||
46 | asm volatile ( | ||
47 | " .set mips32 \n" | ||
48 | " wait \n" | ||
49 | " .set mips0 \n"); | ||
50 | } | ||
51 | |||
52 | void __init board_setup(void) | ||
53 | { | ||
54 | u32 pin_func; | ||
55 | |||
56 | pm_power_off = xxs1500_power_off; | ||
57 | _machine_halt = xxs1500_power_off; | ||
58 | _machine_restart = xxs1500_reset; | ||
59 | |||
60 | alchemy_gpio1_input_enable(); | ||
61 | alchemy_gpio2_enable(); | ||
62 | |||
63 | /* Set multiple use pins (UART3/GPIO) to UART (it's used as UART too) */ | ||
64 | pin_func = au_readl(SYS_PINFUNC) & ~SYS_PF_UR3; | ||
65 | pin_func |= SYS_PF_UR3; | ||
66 | au_writel(pin_func, SYS_PINFUNC); | ||
67 | |||
68 | /* Enable UART */ | ||
69 | alchemy_uart_enable(AU1000_UART3_PHYS_ADDR); | ||
70 | /* Enable DTR (MCR bit 0) = USB power up */ | ||
71 | __raw_writel(1, (void __iomem *)KSEG1ADDR(AU1000_UART3_PHYS_ADDR + 0x18)); | ||
72 | wmb(); | ||
73 | } | ||
74 | |||
75 | static int __init xxs1500_init_irq(void) | ||
76 | { | ||
77 | irq_set_irq_type(AU1500_GPIO204_INT, IRQF_TRIGGER_HIGH); | ||
78 | irq_set_irq_type(AU1500_GPIO201_INT, IRQF_TRIGGER_LOW); | ||
79 | irq_set_irq_type(AU1500_GPIO202_INT, IRQF_TRIGGER_LOW); | ||
80 | irq_set_irq_type(AU1500_GPIO203_INT, IRQF_TRIGGER_LOW); | ||
81 | irq_set_irq_type(AU1500_GPIO205_INT, IRQF_TRIGGER_LOW); | ||
82 | irq_set_irq_type(AU1500_GPIO207_INT, IRQF_TRIGGER_LOW); | ||
83 | |||
84 | irq_set_irq_type(AU1500_GPIO0_INT, IRQF_TRIGGER_LOW); | ||
85 | irq_set_irq_type(AU1500_GPIO1_INT, IRQF_TRIGGER_LOW); | ||
86 | irq_set_irq_type(AU1500_GPIO2_INT, IRQF_TRIGGER_LOW); | ||
87 | irq_set_irq_type(AU1500_GPIO3_INT, IRQF_TRIGGER_LOW); | ||
88 | irq_set_irq_type(AU1500_GPIO4_INT, IRQF_TRIGGER_LOW); /* CF irq */ | ||
89 | irq_set_irq_type(AU1500_GPIO5_INT, IRQF_TRIGGER_LOW); | ||
90 | |||
91 | return 0; | ||
92 | } | ||
93 | arch_initcall(xxs1500_init_irq); | ||
diff --git a/arch/mips/alchemy/xxs1500/init.c b/arch/mips/alchemy/xxs1500/init.c deleted file mode 100644 index 0ee02cfa989d..000000000000 --- a/arch/mips/alchemy/xxs1500/init.c +++ /dev/null | |||
@@ -1,63 +0,0 @@ | |||
1 | /* | ||
2 | * BRIEF MODULE DESCRIPTION | ||
3 | * XXS1500 board setup | ||
4 | * | ||
5 | * Copyright 2003, 2008 MontaVista Software Inc. | ||
6 | * Author: MontaVista Software, Inc. <source@mvista.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the | ||
10 | * Free Software Foundation; either version 2 of the License, or (at your | ||
11 | * option) any later version. | ||
12 | * | ||
13 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
14 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
15 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
16 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
17 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
18 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
19 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
20 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
21 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
22 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
23 | * | ||
24 | * You should have received a copy of the GNU General Public License along | ||
25 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
26 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
27 | */ | ||
28 | |||
29 | #include <linux/init.h> | ||
30 | #include <linux/kernel.h> | ||
31 | |||
32 | #include <asm/bootinfo.h> | ||
33 | #include <asm/mach-au1x00/au1000.h> | ||
34 | |||
35 | #include <prom.h> | ||
36 | |||
37 | const char *get_system_type(void) | ||
38 | { | ||
39 | return "XXS1500"; | ||
40 | } | ||
41 | |||
42 | void __init prom_init(void) | ||
43 | { | ||
44 | unsigned char *memsize_str; | ||
45 | unsigned long memsize; | ||
46 | |||
47 | prom_argc = fw_arg0; | ||
48 | prom_argv = (char **)fw_arg1; | ||
49 | prom_envp = (char **)fw_arg2; | ||
50 | |||
51 | prom_init_cmdline(); | ||
52 | |||
53 | memsize_str = prom_getenv("memsize"); | ||
54 | if (!memsize_str || strict_strtoul(memsize_str, 0, &memsize)) | ||
55 | memsize = 0x04000000; | ||
56 | |||
57 | add_memory_region(0, memsize, BOOT_MEM_RAM); | ||
58 | } | ||
59 | |||
60 | void prom_putchar(unsigned char c) | ||
61 | { | ||
62 | alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c); | ||
63 | } | ||
diff --git a/arch/mips/alchemy/xxs1500/platform.c b/arch/mips/alchemy/xxs1500/platform.c deleted file mode 100644 index 06a3a459b8aa..000000000000 --- a/arch/mips/alchemy/xxs1500/platform.c +++ /dev/null | |||
@@ -1,63 +0,0 @@ | |||
1 | /* | ||
2 | * XXS1500 board platform device registration | ||
3 | * | ||
4 | * Copyright (C) 2009 Manuel Lauss | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #include <linux/init.h> | ||
22 | #include <linux/platform_device.h> | ||
23 | |||
24 | #include <asm/mach-au1x00/au1000.h> | ||
25 | |||
26 | static struct resource xxs1500_pcmcia_res[] = { | ||
27 | { | ||
28 | .name = "pcmcia-io", | ||
29 | .flags = IORESOURCE_MEM, | ||
30 | .start = AU1000_PCMCIA_IO_PHYS_ADDR, | ||
31 | .end = AU1000_PCMCIA_IO_PHYS_ADDR + 0x000400000 - 1, | ||
32 | }, | ||
33 | { | ||
34 | .name = "pcmcia-attr", | ||
35 | .flags = IORESOURCE_MEM, | ||
36 | .start = AU1000_PCMCIA_ATTR_PHYS_ADDR, | ||
37 | .end = AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1, | ||
38 | }, | ||
39 | { | ||
40 | .name = "pcmcia-mem", | ||
41 | .flags = IORESOURCE_MEM, | ||
42 | .start = AU1000_PCMCIA_MEM_PHYS_ADDR, | ||
43 | .end = AU1000_PCMCIA_MEM_PHYS_ADDR + 0x000400000 - 1, | ||
44 | }, | ||
45 | }; | ||
46 | |||
47 | static struct platform_device xxs1500_pcmcia_dev = { | ||
48 | .name = "xxs1500_pcmcia", | ||
49 | .id = -1, | ||
50 | .num_resources = ARRAY_SIZE(xxs1500_pcmcia_res), | ||
51 | .resource = xxs1500_pcmcia_res, | ||
52 | }; | ||
53 | |||
54 | static struct platform_device *xxs1500_devs[] __initdata = { | ||
55 | &xxs1500_pcmcia_dev, | ||
56 | }; | ||
57 | |||
58 | static int __init xxs1500_dev_init(void) | ||
59 | { | ||
60 | return platform_add_devices(xxs1500_devs, | ||
61 | ARRAY_SIZE(xxs1500_devs)); | ||
62 | } | ||
63 | device_initcall(xxs1500_dev_init); | ||