Skip to content

Commit c15524a

Browse files
committed
Merge branch 'for_linus' of git://github.com/at91linux/linux-2.6-at91
* 'for_linus' of git://github.com/at91linux/linux-2.6-at91: at91: Refactor Stamp9G20 and PControl G20 board file at91: Fix uhpck clock rate in upll case
2 parents a6ac1f0 + c20b4dd commit c15524a

File tree

5 files changed

+55
-136
lines changed

5 files changed

+55
-136
lines changed

arch/arm/mach-at91/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ obj-$(CONFIG_MACH_AT91SAM9G20EK) += board-sam9g20ek.o
6565
obj-$(CONFIG_MACH_CPU9G20) += board-cpu9krea.o
6666
obj-$(CONFIG_MACH_STAMP9G20) += board-stamp9g20.o
6767
obj-$(CONFIG_MACH_PORTUXG20) += board-stamp9g20.o
68-
obj-$(CONFIG_MACH_PCONTROL_G20) += board-pcontrol-g20.o
68+
obj-$(CONFIG_MACH_PCONTROL_G20) += board-pcontrol-g20.o board-stamp9g20.o
6969

7070
# AT91SAM9260/AT91SAM9G20 board-specific support
7171
obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o

arch/arm/mach-at91/board-pcontrol-g20.c

Lines changed: 3 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,15 @@
3131

3232
#include <mach/board.h>
3333
#include <mach/at91sam9_smc.h>
34+
#include <mach/stamp9g20.h>
3435

3536
#include "sam9_smc.h"
3637
#include "generic.h"
3738

3839

3940
static void __init pcontrol_g20_map_io(void)
4041
{
41-
/* Initialize processor: 18.432 MHz crystal */
42-
at91sam9260_initialize(18432000);
43-
44-
/* DGBU on ttyS0. (Rx, Tx) only TTL -> JTAG connector X7 17,19 ) */
45-
at91_register_uart(0, 0, 0);
42+
stamp9g20_map_io();
4643

4744
/* USART0 on ttyS1. (Rx, Tx, CTS, RTS) piggyback A2 */
4845
at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS
@@ -54,9 +51,6 @@ static void __init pcontrol_g20_map_io(void)
5451

5552
/* USART2 on ttyS3. (Rx, Tx) 9bit-Bus Multidrop-mode X4 */
5653
at91_register_uart(AT91SAM9260_ID_US4, 3, 0);
57-
58-
/* set serial console to ttyS0 (ie, DBGU) */
59-
at91_set_serial_console(0);
6054
}
6155

6256

@@ -66,38 +60,6 @@ static void __init init_irq(void)
6660
}
6761

6862

69-
/*
70-
* NAND flash 512MiB 1,8V 8-bit, sector size 128 KiB
71-
*/
72-
static struct atmel_nand_data __initdata nand_data = {
73-
.ale = 21,
74-
.cle = 22,
75-
.rdy_pin = AT91_PIN_PC13,
76-
.enable_pin = AT91_PIN_PC14,
77-
};
78-
79-
/*
80-
* Bus timings; unit = 7.57ns
81-
*/
82-
static struct sam9_smc_config __initdata nand_smc_config = {
83-
.ncs_read_setup = 0,
84-
.nrd_setup = 2,
85-
.ncs_write_setup = 0,
86-
.nwe_setup = 2,
87-
88-
.ncs_read_pulse = 4,
89-
.nrd_pulse = 4,
90-
.ncs_write_pulse = 4,
91-
.nwe_pulse = 4,
92-
93-
.read_cycle = 7,
94-
.write_cycle = 7,
95-
96-
.mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE
97-
| AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
98-
.tdf_cycles = 3,
99-
};
100-
10163
static struct sam9_smc_config __initdata pcontrol_smc_config[2] = { {
10264
.ncs_read_setup = 16,
10365
.nrd_setup = 18,
@@ -138,14 +100,6 @@ static struct sam9_smc_config __initdata pcontrol_smc_config[2] = { {
138100
.tdf_cycles = 1,
139101
} };
140102

141-
static void __init add_device_nand(void)
142-
{
143-
/* configure chip-select 3 (NAND) */
144-
sam9_smc_configure(3, &nand_smc_config);
145-
at91_add_device_nand(&nand_data);
146-
}
147-
148-
149103
static void __init add_device_pcontrol(void)
150104
{
151105
/* configure chip-select 4 (IO compatible to 8051 X4 ) */
@@ -155,23 +109,6 @@ static void __init add_device_pcontrol(void)
155109
}
156110

157111

158-
/*
159-
* MCI (SD/MMC)
160-
* det_pin, wp_pin and vcc_pin are not connected
161-
*/
162-
#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE)
163-
static struct mci_platform_data __initdata mmc_data = {
164-
.slot[0] = {
165-
.bus_width = 4,
166-
},
167-
};
168-
#else
169-
static struct at91_mmc_data __initdata mmc_data = {
170-
.wire4 = 1,
171-
};
172-
#endif
173-
174-
175112
/*
176113
* USB Host port
177114
*/
@@ -265,42 +202,13 @@ static struct spi_board_info pcontrol_g20_spi_devices[] = {
265202
};
266203

267204

268-
/*
269-
* Dallas 1-Wire DS2431
270-
*/
271-
static struct w1_gpio_platform_data w1_gpio_pdata = {
272-
.pin = AT91_PIN_PA29,
273-
.is_open_drain = 1,
274-
};
275-
276-
static struct platform_device w1_device = {
277-
.name = "w1-gpio",
278-
.id = -1,
279-
.dev.platform_data = &w1_gpio_pdata,
280-
};
281-
282-
static void add_wire1(void)
283-
{
284-
at91_set_GPIO_periph(w1_gpio_pdata.pin, 1);
285-
at91_set_multi_drive(w1_gpio_pdata.pin, 1);
286-
platform_device_register(&w1_device);
287-
}
288-
289-
290205
static void __init pcontrol_g20_board_init(void)
291206
{
292-
at91_add_device_serial();
293-
add_device_nand();
294-
#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE)
295-
at91_add_device_mci(0, &mmc_data);
296-
#else
297-
at91_add_device_mmc(0, &mmc_data);
298-
#endif
207+
stamp9g20_board_init();
299208
at91_add_device_usbh(&usbh_data);
300209
at91_add_device_eth(&macb_data);
301210
at91_add_device_i2c(pcontrol_g20_i2c_devices,
302211
ARRAY_SIZE(pcontrol_g20_i2c_devices));
303-
add_wire1();
304212
add_device_pcontrol();
305213
at91_add_device_spi(pcontrol_g20_spi_devices,
306214
ARRAY_SIZE(pcontrol_g20_spi_devices));

arch/arm/mach-at91/board-stamp9g20.c

Lines changed: 43 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,32 @@
3232
#include "generic.h"
3333

3434

35-
static void __init portuxg20_map_io(void)
35+
void __init stamp9g20_map_io(void)
3636
{
3737
/* Initialize processor: 18.432 MHz crystal */
3838
at91sam9260_initialize(18432000);
3939

4040
/* DGBU on ttyS0. (Rx & Tx only) */
4141
at91_register_uart(0, 0, 0);
4242

43+
/* set serial console to ttyS0 (ie, DBGU) */
44+
at91_set_serial_console(0);
45+
}
46+
47+
static void __init stamp9g20evb_map_io(void)
48+
{
49+
stamp9g20_map_io();
50+
51+
/* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
52+
at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
53+
| ATMEL_UART_DTR | ATMEL_UART_DSR
54+
| ATMEL_UART_DCD | ATMEL_UART_RI);
55+
}
56+
57+
static void __init portuxg20_map_io(void)
58+
{
59+
stamp9g20_map_io();
60+
4361
/* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
4462
at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
4563
| ATMEL_UART_DTR | ATMEL_UART_DSR
@@ -56,26 +74,6 @@ static void __init portuxg20_map_io(void)
5674

5775
/* USART5 on ttyS6. (Rx, Tx only) */
5876
at91_register_uart(AT91SAM9260_ID_US5, 6, 0);
59-
60-
/* set serial console to ttyS0 (ie, DBGU) */
61-
at91_set_serial_console(0);
62-
}
63-
64-
static void __init stamp9g20_map_io(void)
65-
{
66-
/* Initialize processor: 18.432 MHz crystal */
67-
at91sam9260_initialize(18432000);
68-
69-
/* DGBU on ttyS0. (Rx & Tx only) */
70-
at91_register_uart(0, 0, 0);
71-
72-
/* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
73-
at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
74-
| ATMEL_UART_DTR | ATMEL_UART_DSR
75-
| ATMEL_UART_DCD | ATMEL_UART_RI);
76-
77-
/* set serial console to ttyS0 (ie, DBGU) */
78-
at91_set_serial_console(0);
7977
}
8078

8179
static void __init init_irq(void)
@@ -156,7 +154,7 @@ static struct at91_udc_data __initdata portuxg20_udc_data = {
156154
.pullup_pin = 0, /* pull-up driven by UDC */
157155
};
158156

159-
static struct at91_udc_data __initdata stamp9g20_udc_data = {
157+
static struct at91_udc_data __initdata stamp9g20evb_udc_data = {
160158
.vbus_pin = AT91_PIN_PA22,
161159
.pullup_pin = 0, /* pull-up driven by UDC */
162160
};
@@ -190,7 +188,7 @@ static struct gpio_led portuxg20_leds[] = {
190188
}
191189
};
192190

193-
static struct gpio_led stamp9g20_leds[] = {
191+
static struct gpio_led stamp9g20evb_leds[] = {
194192
{
195193
.name = "D8",
196194
.gpio = AT91_PIN_PB18,
@@ -250,7 +248,7 @@ void add_w1(void)
250248
}
251249

252250

253-
static void __init generic_board_init(void)
251+
void __init stamp9g20_board_init(void)
254252
{
255253
/* Serial */
256254
at91_add_device_serial();
@@ -262,34 +260,40 @@ static void __init generic_board_init(void)
262260
#else
263261
at91_add_device_mmc(0, &mmc_data);
264262
#endif
265-
/* USB Host */
266-
at91_add_device_usbh(&usbh_data);
267-
/* Ethernet */
268-
at91_add_device_eth(&macb_data);
269-
/* I2C */
270-
at91_add_device_i2c(NULL, 0);
271263
/* W1 */
272264
add_w1();
273265
}
274266

275267
static void __init portuxg20_board_init(void)
276268
{
277-
generic_board_init();
278-
/* SPI */
279-
at91_add_device_spi(portuxg20_spi_devices, ARRAY_SIZE(portuxg20_spi_devices));
269+
stamp9g20_board_init();
270+
/* USB Host */
271+
at91_add_device_usbh(&usbh_data);
280272
/* USB Device */
281273
at91_add_device_udc(&portuxg20_udc_data);
274+
/* Ethernet */
275+
at91_add_device_eth(&macb_data);
276+
/* I2C */
277+
at91_add_device_i2c(NULL, 0);
278+
/* SPI */
279+
at91_add_device_spi(portuxg20_spi_devices, ARRAY_SIZE(portuxg20_spi_devices));
282280
/* LEDs */
283281
at91_gpio_leds(portuxg20_leds, ARRAY_SIZE(portuxg20_leds));
284282
}
285283

286-
static void __init stamp9g20_board_init(void)
284+
static void __init stamp9g20evb_board_init(void)
287285
{
288-
generic_board_init();
286+
stamp9g20_board_init();
287+
/* USB Host */
288+
at91_add_device_usbh(&usbh_data);
289289
/* USB Device */
290-
at91_add_device_udc(&stamp9g20_udc_data);
290+
at91_add_device_udc(&stamp9g20evb_udc_data);
291+
/* Ethernet */
292+
at91_add_device_eth(&macb_data);
293+
/* I2C */
294+
at91_add_device_i2c(NULL, 0);
291295
/* LEDs */
292-
at91_gpio_leds(stamp9g20_leds, ARRAY_SIZE(stamp9g20_leds));
296+
at91_gpio_leds(stamp9g20evb_leds, ARRAY_SIZE(stamp9g20evb_leds));
293297
}
294298

295299
MACHINE_START(PORTUXG20, "taskit PortuxG20")
@@ -305,7 +309,7 @@ MACHINE_START(STAMP9G20, "taskit Stamp9G20")
305309
/* Maintainer: taskit GmbH */
306310
.boot_params = AT91_SDRAM_BASE + 0x100,
307311
.timer = &at91sam926x_timer,
308-
.map_io = stamp9g20_map_io,
312+
.map_io = stamp9g20evb_map_io,
309313
.init_irq = init_irq,
310-
.init_machine = stamp9g20_board_init,
314+
.init_machine = stamp9g20evb_board_init,
311315
MACHINE_END

arch/arm/mach-at91/clock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ static void __init at91_upll_usbfs_clock_init(unsigned long main_clock)
658658
/* Now set uhpck values */
659659
uhpck.parent = &utmi_clk;
660660
uhpck.pmc_mask = AT91SAM926x_PMC_UHP;
661-
uhpck.rate_hz = utmi_clk.parent->rate_hz;
661+
uhpck.rate_hz = utmi_clk.rate_hz;
662662
uhpck.rate_hz /= 1 + ((at91_sys_read(AT91_PMC_USB) & AT91_PMC_OHCIUSBDIV) >> 8);
663663
}
664664

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#ifndef __MACH_STAMP9G20_H
2+
#define __MACH_STAMP9G20_H
3+
4+
void stamp9g20_map_io(void);
5+
void stamp9g20_board_init(void);
6+
7+
#endif

0 commit comments

Comments
 (0)