diff options
author | Jon Ringle <jon.ringle@comdial.com> | 2005-10-28 11:19:37 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-10-28 11:19:37 -0400 |
commit | 0b83f1400fa6e5f0d4afcff033628a16c163862a (patch) | |
tree | c6fa01fd5a8d156b415ba9203f8ad349165de8ec /arch/arm/mach-clps711x | |
parent | b57235215933d5fde4013e2448223b934b4ac2b7 (diff) |
[ARM] 2918/1: [update] Base port of Comdial MP1000 platfrom
Patch from Jon Ringle
Updated 2898/1 per comments:
- Removed fixup
- Moved code in mach-mp1000/ to mach-clps711x/
- Cleaned up code in mp1000-seprom.c. Eliminated code that displayed the contents of the eeprom
Please comment.
Signed-off-by: Jon Ringle
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-clps711x')
-rw-r--r-- | arch/arm/mach-clps711x/Kconfig | 11 | ||||
-rw-r--r-- | arch/arm/mach-clps711x/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-clps711x/mp1000-mach.c | 49 | ||||
-rw-r--r-- | arch/arm/mach-clps711x/mp1000-mm.c | 47 | ||||
-rw-r--r-- | arch/arm/mach-clps711x/mp1000-seprom.c | 195 |
5 files changed, 303 insertions, 0 deletions
diff --git a/arch/arm/mach-clps711x/Kconfig b/arch/arm/mach-clps711x/Kconfig index 0793dcf54f2e..d5c155045762 100644 --- a/arch/arm/mach-clps711x/Kconfig +++ b/arch/arm/mach-clps711x/Kconfig | |||
@@ -69,6 +69,17 @@ config EP72XX_ROM_BOOT | |||
69 | 69 | ||
70 | You almost surely want to say N here. | 70 | You almost surely want to say N here. |
71 | 71 | ||
72 | config MACH_MP1000 | ||
73 | bool "MACH_MP1000" | ||
74 | help | ||
75 | Say Y if you intend to run the kernel on the Comdial MP1000 platform. | ||
76 | |||
77 | config MP1000_90MHZ | ||
78 | bool "MP1000_90MHZ" | ||
79 | depends on MACH_MP1000 | ||
80 | help | ||
81 | Say Y if you have the MP1000 configured to be set at 90MHZ rather than 74MHZ | ||
82 | |||
72 | endmenu | 83 | endmenu |
73 | 84 | ||
74 | endif | 85 | endif |
diff --git a/arch/arm/mach-clps711x/Makefile b/arch/arm/mach-clps711x/Makefile index 4a197315f0cf..8a6dc1ccf8fe 100644 --- a/arch/arm/mach-clps711x/Makefile +++ b/arch/arm/mach-clps711x/Makefile | |||
@@ -15,6 +15,7 @@ obj-$(CONFIG_ARCH_CDB89712) += cdb89712.o | |||
15 | obj-$(CONFIG_ARCH_CLEP7312) += clep7312.o | 15 | obj-$(CONFIG_ARCH_CLEP7312) += clep7312.o |
16 | obj-$(CONFIG_ARCH_EDB7211) += edb7211-arch.o edb7211-mm.o | 16 | obj-$(CONFIG_ARCH_EDB7211) += edb7211-arch.o edb7211-mm.o |
17 | obj-$(CONFIG_ARCH_FORTUNET) += fortunet.o | 17 | obj-$(CONFIG_ARCH_FORTUNET) += fortunet.o |
18 | obj-$(CONFIG_MACH_MP1000) += mp1000-mach.o mp1000-mm.o mp1000-seprom.o | ||
18 | obj-$(CONFIG_ARCH_P720T) += p720t.o | 19 | obj-$(CONFIG_ARCH_P720T) += p720t.o |
19 | leds-$(CONFIG_ARCH_P720T) += p720t-leds.o | 20 | leds-$(CONFIG_ARCH_P720T) += p720t-leds.o |
20 | obj-$(CONFIG_LEDS) += $(leds-y) | 21 | obj-$(CONFIG_LEDS) += $(leds-y) |
diff --git a/arch/arm/mach-clps711x/mp1000-mach.c b/arch/arm/mach-clps711x/mp1000-mach.c new file mode 100644 index 000000000000..c2816bcde5e7 --- /dev/null +++ b/arch/arm/mach-clps711x/mp1000-mach.c | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-mp1000/mp1000.c | ||
3 | * | ||
4 | * Copyright (C) 2005 Comdial Corporation | ||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/types.h> | ||
22 | #include <linux/string.h> | ||
23 | |||
24 | #include <asm/setup.h> | ||
25 | #include <asm/mach-types.h> | ||
26 | #include <asm/mach/arch.h> | ||
27 | #include <asm/arch/mp1000-seprom.h> | ||
28 | |||
29 | #include "common.h" | ||
30 | |||
31 | extern void mp1000_map_io(void); | ||
32 | |||
33 | static void __init mp1000_init(void) | ||
34 | { | ||
35 | seprom_init(); | ||
36 | } | ||
37 | |||
38 | MACHINE_START(MP1000, "Comdial MP1000") | ||
39 | /* Maintainer: Jon Ringle */ | ||
40 | .phys_ram = 0xc0000000, | ||
41 | .phys_io = 0x80000000, | ||
42 | .io_pg_offst = ((0xff000000) >> 18) & 0xfffc, | ||
43 | .boot_params = 0xc0015100, | ||
44 | .map_io = mp1000_map_io, | ||
45 | .init_irq = clps711x_init_irq, | ||
46 | .init_machine = mp1000_init, | ||
47 | .timer = &clps711x_timer, | ||
48 | MACHINE_END | ||
49 | |||
diff --git a/arch/arm/mach-clps711x/mp1000-mm.c b/arch/arm/mach-clps711x/mp1000-mm.c new file mode 100644 index 000000000000..20e810b0ec0c --- /dev/null +++ b/arch/arm/mach-clps711x/mp1000-mm.c | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-mp1000/mm.c | ||
3 | * | ||
4 | * Extra MM routines for the MP1000 | ||
5 | * | ||
6 | * Copyright (C) 2005 Comdial Corporation | ||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | #include <linux/kernel.h> | ||
23 | #include <linux/init.h> | ||
24 | |||
25 | #include <asm/hardware.h> | ||
26 | #include <asm/page.h> | ||
27 | #include <asm/pgtable.h> | ||
28 | #include <asm/sizes.h> | ||
29 | |||
30 | #include <asm/mach/map.h> | ||
31 | |||
32 | extern void clps711x_map_io(void); | ||
33 | |||
34 | static struct map_desc mp1000_io_desc[] __initdata = { | ||
35 | { MP1000_EIO_BASE, MP1000_EIO_START, MP1000_EIO_SIZE, MT_DEVICE }, | ||
36 | { MP1000_FIO_BASE, MP1000_FIO_START, MP1000_FIO_SIZE, MT_DEVICE }, | ||
37 | { MP1000_LIO_BASE, MP1000_LIO_START, MP1000_LIO_SIZE, MT_DEVICE }, | ||
38 | { MP1000_NIO_BASE, MP1000_NIO_START, MP1000_NIO_SIZE, MT_DEVICE }, | ||
39 | { MP1000_IDE_BASE, MP1000_IDE_START, MP1000_IDE_SIZE, MT_DEVICE }, | ||
40 | { MP1000_DSP_BASE, MP1000_DSP_START, MP1000_DSP_SIZE, MT_DEVICE } | ||
41 | }; | ||
42 | |||
43 | void __init mp1000_map_io(void) | ||
44 | { | ||
45 | clps711x_map_io(); | ||
46 | iotable_init(mp1000_io_desc, ARRAY_SIZE(mp1000_io_desc)); | ||
47 | } | ||
diff --git a/arch/arm/mach-clps711x/mp1000-seprom.c b/arch/arm/mach-clps711x/mp1000-seprom.c new file mode 100644 index 000000000000..b22d0bebb851 --- /dev/null +++ b/arch/arm/mach-clps711x/mp1000-seprom.c | |||
@@ -0,0 +1,195 @@ | |||
1 | /*` | ||
2 | * mp1000-seprom.c | ||
3 | * | ||
4 | * This file contains the Serial EEPROM code for the MP1000 board | ||
5 | * | ||
6 | * Copyright (C) 2005 Comdial Corporation | ||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #include <linux/kernel.h> | ||
25 | #include <linux/init.h> | ||
26 | #include <asm/hardware.h> | ||
27 | #include <asm/hardware/clps7111.h> | ||
28 | #include <asm/arch/mp1000-seprom.h> | ||
29 | |||
30 | /* If SepromInit() can initialize and checksum the seprom successfully, */ | ||
31 | /* then it will point seprom_data_ptr at the shadow copy. */ | ||
32 | |||
33 | static eeprom_struct seprom_data; /* shadow copy of seprom content */ | ||
34 | |||
35 | eeprom_struct *seprom_data_ptr = 0; /* 0 => not initialized */ | ||
36 | |||
37 | /* | ||
38 | * Port D Bit 5 is Chip Select for EEPROM | ||
39 | * Port E Bit 0 is Input, Data out from EEPROM | ||
40 | * Port E Bit 1 is Output, Data in to EEPROM | ||
41 | * Port E Bit 2 is Output, CLK to EEPROM | ||
42 | */ | ||
43 | |||
44 | static char *port_d_ptr = (char *)(CLPS7111_VIRT_BASE + PDDR); | ||
45 | static char *port_e_ptr = (char *)(CLPS7111_VIRT_BASE + PEDR); | ||
46 | |||
47 | #define NO_OF_SHORTS 64 // Device is 64 x 16 bits | ||
48 | #define ENABLE_RW 0 | ||
49 | #define DISABLE_RW 1 | ||
50 | |||
51 | static inline void toggle_seprom_clock(void) | ||
52 | { | ||
53 | *port_e_ptr |= HwPortESepromCLK; | ||
54 | *port_e_ptr &= ~(HwPortESepromCLK); | ||
55 | } | ||
56 | |||
57 | static inline void select_eeprom(void) | ||
58 | { | ||
59 | *port_d_ptr |= HwPortDEECS; | ||
60 | *port_e_ptr &= ~(HwPortESepromCLK); | ||
61 | } | ||
62 | |||
63 | static inline void deselect_eeprom(void) | ||
64 | { | ||
65 | *port_d_ptr &= ~(HwPortDEECS); | ||
66 | *port_e_ptr &= ~(HwPortESepromDIn); | ||
67 | } | ||
68 | |||
69 | /* | ||
70 | * GetSepromDataPtr - returns pointer to shadow (RAM) copy of seprom | ||
71 | * and returns 0 if seprom is not initialized or | ||
72 | * has a checksum error. | ||
73 | */ | ||
74 | |||
75 | eeprom_struct* get_seprom_ptr(void) | ||
76 | { | ||
77 | return seprom_data_ptr; | ||
78 | } | ||
79 | |||
80 | unsigned char* get_eeprom_mac_address(void) | ||
81 | { | ||
82 | return seprom_data_ptr->variant.eprom_struct.mac_Address; | ||
83 | } | ||
84 | |||
85 | /* | ||
86 | * ReadSProm, Physically reads data from the Serial PROM | ||
87 | */ | ||
88 | static void read_sprom(short address, int length, eeprom_struct *buffer) | ||
89 | { | ||
90 | short data = COMMAND_READ | (address & 0x3F); | ||
91 | short bit; | ||
92 | int i; | ||
93 | |||
94 | select_eeprom(); | ||
95 | |||
96 | // Clock in 9 bits of the command | ||
97 | for (i = 0, bit = 0x100; i < 9; i++, bit >>= 1) { | ||
98 | if (data & bit) | ||
99 | *port_e_ptr |= HwPortESepromDIn; | ||
100 | else | ||
101 | *port_e_ptr &= ~(HwPortESepromDIn); | ||
102 | |||
103 | toggle_seprom_clock(); | ||
104 | } | ||
105 | |||
106 | // | ||
107 | // Now read one or more shorts of data from the Seprom | ||
108 | // | ||
109 | while (length-- > 0) { | ||
110 | data = 0; | ||
111 | |||
112 | // Read 16 bits at a time | ||
113 | for (i = 0; i < 16; i++) { | ||
114 | data <<= 1; | ||
115 | toggle_seprom_clock(); | ||
116 | data |= *port_e_ptr & HwPortESepromDOut; | ||
117 | |||
118 | } | ||
119 | |||
120 | buffer->variant.eprom_short_data[address++] = data; | ||
121 | } | ||
122 | |||
123 | deselect_eeprom(); | ||
124 | |||
125 | return; | ||
126 | } | ||
127 | |||
128 | |||
129 | |||
130 | /* | ||
131 | * ReadSerialPROM | ||
132 | * | ||
133 | * Input: Pointer to array of 64 x 16 Bits | ||
134 | * | ||
135 | * Output: if no problem reading data is filled in | ||
136 | */ | ||
137 | static void read_serial_prom(eeprom_struct *data) | ||
138 | { | ||
139 | read_sprom(0, 64, data); | ||
140 | } | ||
141 | |||
142 | |||
143 | // | ||
144 | // Compute Serial EEPROM checksum | ||
145 | // | ||
146 | // Input: Pointer to struct with Eprom data | ||
147 | // | ||
148 | // Output: The computed Eprom checksum | ||
149 | // | ||
150 | static short compute_seprom_checksum(eeprom_struct *data) | ||
151 | { | ||
152 | short checksum = 0; | ||
153 | int i; | ||
154 | |||
155 | for (i = 0; i < 126; i++) { | ||
156 | checksum += (short)data->variant.eprom_byte_data[i]; | ||
157 | } | ||
158 | |||
159 | return((short)(0x5555 - (checksum & 0xFFFF))); | ||
160 | } | ||
161 | |||
162 | // | ||
163 | // Make sure the data port bits for the SEPROM are correctly initialised | ||
164 | // | ||
165 | |||
166 | void __init seprom_init(void) | ||
167 | { | ||
168 | short checksum; | ||
169 | |||
170 | // Init Port D | ||
171 | *(char *)(CLPS7111_VIRT_BASE + PDDDR) = 0x0; | ||
172 | *(char *)(CLPS7111_VIRT_BASE + PDDR) = 0x15; | ||
173 | |||
174 | // Init Port E | ||
175 | *(int *)(CLPS7111_VIRT_BASE + PEDDR) = 0x06; | ||
176 | *(int *)(CLPS7111_VIRT_BASE + PEDR) = 0x04; | ||
177 | |||
178 | // | ||
179 | // Make sure that EEPROM struct size never exceeds 128 bytes | ||
180 | // | ||
181 | if (sizeof(eeprom_struct) > 128) { | ||
182 | panic("Serial PROM struct size > 128, aborting read\n"); | ||
183 | } | ||
184 | |||
185 | read_serial_prom(&seprom_data); | ||
186 | |||
187 | checksum = compute_seprom_checksum(&seprom_data); | ||
188 | |||
189 | if (checksum != seprom_data.variant.eprom_short_data[63]) { | ||
190 | panic("Serial EEPROM checksum failed\n"); | ||
191 | } | ||
192 | |||
193 | seprom_data_ptr = &seprom_data; | ||
194 | } | ||
195 | |||