|
15 | 15 | #include <linux/interrupt.h> |
16 | 16 | #include <linux/platform_device.h> |
17 | 17 | #include <linux/mtd/physmap.h> |
| 18 | +#include <linux/mtd/sh_flctl.h> |
18 | 19 | #include <linux/delay.h> |
19 | 20 | #include <linux/i2c.h> |
20 | 21 | #include <linux/smc911x.h> |
@@ -108,10 +109,45 @@ static struct platform_device ap325rxa_nor_flash_device = { |
108 | 109 | }, |
109 | 110 | }; |
110 | 111 |
|
| 112 | +static struct mtd_partition nand_partition_info[] = { |
| 113 | + { |
| 114 | + .name = "nand_data", |
| 115 | + .offset = 0, |
| 116 | + .size = MTDPART_SIZ_FULL, |
| 117 | + }, |
| 118 | +}; |
| 119 | + |
| 120 | +static struct resource nand_flash_resources[] = { |
| 121 | + [0] = { |
| 122 | + .start = 0xa4530000, |
| 123 | + .end = 0xa45300ff, |
| 124 | + .flags = IORESOURCE_MEM, |
| 125 | + } |
| 126 | +}; |
| 127 | + |
| 128 | +static struct sh_flctl_platform_data nand_flash_data = { |
| 129 | + .parts = nand_partition_info, |
| 130 | + .nr_parts = ARRAY_SIZE(nand_partition_info), |
| 131 | + .flcmncr_val = FCKSEL_E | TYPESEL_SET | NANWF_E, |
| 132 | + .has_hwecc = 1, |
| 133 | +}; |
| 134 | + |
| 135 | +static struct platform_device nand_flash_device = { |
| 136 | + .name = "sh_flctl", |
| 137 | + .resource = nand_flash_resources, |
| 138 | + .num_resources = ARRAY_SIZE(nand_flash_resources), |
| 139 | + .dev = { |
| 140 | + .platform_data = &nand_flash_data, |
| 141 | + }, |
| 142 | +}; |
| 143 | + |
111 | 144 | #define FPGA_LCDREG 0xB4100180 |
112 | 145 | #define FPGA_BKLREG 0xB4100212 |
113 | 146 | #define FPGA_LCDREG_VAL 0x0018 |
114 | 147 | #define PORT_MSELCRB 0xA4050182 |
| 148 | +#define PORT_HIZCRC 0xA405015C |
| 149 | +#define PORT_DRVCRA 0xA405018A |
| 150 | +#define PORT_DRVCRB 0xA405018C |
115 | 151 |
|
116 | 152 | static void ap320_wvga_power_on(void *board_data) |
117 | 153 | { |
@@ -282,6 +318,7 @@ static struct platform_device *ap325rxa_devices[] __initdata = { |
282 | 318 | #ifdef CONFIG_I2C |
283 | 319 | &camera_device, |
284 | 320 | #endif |
| 321 | + &nand_flash_device, |
285 | 322 | }; |
286 | 323 |
|
287 | 324 | static struct i2c_board_info __initdata ap325rxa_i2c_devices[] = { |
@@ -364,21 +401,36 @@ static int __init ap325rxa_devices_setup(void) |
364 | 401 |
|
365 | 402 | ctrl_outw(ctrl_inw(PORT_MSELCRB) & ~0x0001, PORT_MSELCRB); |
366 | 403 |
|
| 404 | + /* FLCTL */ |
| 405 | + gpio_request(GPIO_FN_FCE, NULL); |
| 406 | + gpio_request(GPIO_FN_NAF7, NULL); |
| 407 | + gpio_request(GPIO_FN_NAF6, NULL); |
| 408 | + gpio_request(GPIO_FN_NAF5, NULL); |
| 409 | + gpio_request(GPIO_FN_NAF4, NULL); |
| 410 | + gpio_request(GPIO_FN_NAF3, NULL); |
| 411 | + gpio_request(GPIO_FN_NAF2, NULL); |
| 412 | + gpio_request(GPIO_FN_NAF1, NULL); |
| 413 | + gpio_request(GPIO_FN_NAF0, NULL); |
| 414 | + gpio_request(GPIO_FN_FCDE, NULL); |
| 415 | + gpio_request(GPIO_FN_FOE, NULL); |
| 416 | + gpio_request(GPIO_FN_FSC, NULL); |
| 417 | + gpio_request(GPIO_FN_FWE, NULL); |
| 418 | + gpio_request(GPIO_FN_FRB, NULL); |
| 419 | + |
| 420 | + ctrl_outw(0, PORT_HIZCRC); |
| 421 | + ctrl_outw(0xFFFF, PORT_DRVCRA); |
| 422 | + ctrl_outw(0xFFFF, PORT_DRVCRB); |
| 423 | + |
367 | 424 | platform_resource_setup_memory(&ceu_device, "ceu", 4 << 20); |
368 | 425 |
|
369 | 426 | i2c_register_board_info(0, ap325rxa_i2c_devices, |
370 | 427 | ARRAY_SIZE(ap325rxa_i2c_devices)); |
371 | | - |
| 428 | + |
372 | 429 | return platform_add_devices(ap325rxa_devices, |
373 | 430 | ARRAY_SIZE(ap325rxa_devices)); |
374 | 431 | } |
375 | 432 | device_initcall(ap325rxa_devices_setup); |
376 | 433 |
|
377 | | -static void __init ap325rxa_setup(char **cmdline_p) |
378 | | -{ |
379 | | -} |
380 | | - |
381 | 434 | static struct sh_machine_vector mv_ap325rxa __initmv = { |
382 | 435 | .mv_name = "AP-325RXA", |
383 | | - .mv_setup = ap325rxa_setup, |
384 | 436 | }; |
0 commit comments