Commit 8cdae51a authored by Andrew Victor's avatar Andrew Victor Committed by Russell King

[ARM] 5289/1: [AT91] Convert boards to use sam9_smc_configure()

Convert the SAM9 and CAP9 board-specific files to make use of the
sam9_smc_configure() method to configure the memory-controller for
external peripherals.

The following boards have been modified:
 cam60 : NAND
 cap9adk : NAND, NOR
 qil-a9260 : NAND
 sam9-l9260 : NAND
 sam9260ek : NAND
 sam9261ek : DM9000 Ethernet, NAND
 sam9263 : NAND
 sam9g20ek : NAND
 sam9rlek : NAND
 usb-a9260 : NAND
 usb-a9263 .: NAND
Signed-off-by: default avatarAndrew Victor <linux@maxim.org.za>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 461d3b4d
...@@ -39,7 +39,9 @@ ...@@ -39,7 +39,9 @@
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h> #include <mach/gpio.h>
#include <mach/at91sam9_smc.h>
#include "sam9_smc.h"
#include "generic.h" #include "generic.h"
...@@ -151,6 +153,32 @@ static struct atmel_nand_data __initdata cam60_nand_data = { ...@@ -151,6 +153,32 @@ static struct atmel_nand_data __initdata cam60_nand_data = {
.partition_info = nand_partitions, .partition_info = nand_partitions,
}; };
static struct sam9_smc_config __initdata cam60_nand_smc_config = {
.ncs_read_setup = 0,
.nrd_setup = 1,
.ncs_write_setup = 0,
.nwe_setup = 1,
.ncs_read_pulse = 3,
.nrd_pulse = 3,
.ncs_write_pulse = 3,
.nwe_pulse = 3,
.read_cycle = 5,
.write_cycle = 5,
.mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
.tdf_cycles = 2,
};
static void __init cam60_add_device_nand(void)
{
/* configure chip-select 3 (NAND) */
sam9_smc_configure(3, &cam60_nand_smc_config);
at91_add_device_nand(&cam60_nand_data);
}
static void __init cam60_board_init(void) static void __init cam60_board_init(void)
{ {
...@@ -165,7 +193,7 @@ static void __init cam60_board_init(void) ...@@ -165,7 +193,7 @@ static void __init cam60_board_init(void)
at91_set_gpio_output(AT91_PIN_PB18, 1); at91_set_gpio_output(AT91_PIN_PB18, 1);
at91_add_device_usbh(&cam60_usbh_data); at91_add_device_usbh(&cam60_usbh_data);
/* NAND */ /* NAND */
at91_add_device_nand(&cam60_nand_data); cam60_add_device_nand();
} }
MACHINE_START(CAM60, "KwikByte CAM60") MACHINE_START(CAM60, "KwikByte CAM60")
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include <mach/at91cap9_matrix.h> #include <mach/at91cap9_matrix.h>
#include <mach/at91sam9_smc.h> #include <mach/at91sam9_smc.h>
#include "sam9_smc.h"
#include "generic.h" #include "generic.h"
...@@ -195,6 +196,43 @@ static struct atmel_nand_data __initdata cap9adk_nand_data = { ...@@ -195,6 +196,43 @@ static struct atmel_nand_data __initdata cap9adk_nand_data = {
#endif #endif
}; };
static struct sam9_smc_config __initdata cap9adk_nand_smc_config = {
.ncs_read_setup = 1,
.nrd_setup = 2,
.ncs_write_setup = 1,
.nwe_setup = 2,
.ncs_read_pulse = 6,
.nrd_pulse = 4,
.ncs_write_pulse = 6,
.nwe_pulse = 4,
.read_cycle = 8,
.write_cycle = 8,
.mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
.tdf_cycles = 1,
};
static void __init cap9adk_add_device_nand(void)
{
unsigned long csa;
csa = at91_sys_read(AT91_MATRIX_EBICSA);
at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_VDDIOMSEL_3_3V);
/* setup bus-width (8 or 16) */
if (cap9adk_nand_data.bus_width_16)
cap9adk_nand_smc_config.mode |= AT91_SMC_DBW_16;
else
cap9adk_nand_smc_config.mode |= AT91_SMC_DBW_8;
/* configure chip-select 3 (NAND) */
sam9_smc_configure(3, &cap9adk_nand_smc_config);
at91_add_device_nand(&cap9adk_nand_data);
}
/* /*
* NOR flash * NOR flash
...@@ -234,6 +272,24 @@ static struct platform_device cap9adk_nor_flash = { ...@@ -234,6 +272,24 @@ static struct platform_device cap9adk_nor_flash = {
.num_resources = ARRAY_SIZE(nor_flash_resources), .num_resources = ARRAY_SIZE(nor_flash_resources),
}; };
static struct sam9_smc_config __initdata cap9adk_nor_smc_config = {
.ncs_read_setup = 2,
.nrd_setup = 4,
.ncs_write_setup = 2,
.nwe_setup = 4,
.ncs_read_pulse = 10,
.nrd_pulse = 8,
.ncs_write_pulse = 10,
.nwe_pulse = 8,
.read_cycle = 16,
.write_cycle = 16,
.mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_WRITE | AT91_SMC_DBW_16,
.tdf_cycles = 1,
};
static __init void cap9adk_add_device_nor(void) static __init void cap9adk_add_device_nor(void)
{ {
unsigned long csa; unsigned long csa;
...@@ -241,18 +297,8 @@ static __init void cap9adk_add_device_nor(void) ...@@ -241,18 +297,8 @@ static __init void cap9adk_add_device_nor(void)
csa = at91_sys_read(AT91_MATRIX_EBICSA); csa = at91_sys_read(AT91_MATRIX_EBICSA);
at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_VDDIOMSEL_3_3V); at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_VDDIOMSEL_3_3V);
/* set the bus interface characteristics */ /* configure chip-select 0 (NOR) */
at91_sys_write(AT91_SMC_SETUP(0), AT91_SMC_NWESETUP_(4) | AT91_SMC_NCS_WRSETUP_(2) sam9_smc_configure(0, &cap9adk_nor_smc_config);
| AT91_SMC_NRDSETUP_(4) | AT91_SMC_NCS_RDSETUP_(2));
at91_sys_write(AT91_SMC_PULSE(0), AT91_SMC_NWEPULSE_(8) | AT91_SMC_NCS_WRPULSE_(10)
| AT91_SMC_NRDPULSE_(8) | AT91_SMC_NCS_RDPULSE_(10));
at91_sys_write(AT91_SMC_CYCLE(0), AT91_SMC_NWECYCLE_(16) | AT91_SMC_NRDCYCLE_(16));
at91_sys_write(AT91_SMC_MODE(0), AT91_SMC_READMODE | AT91_SMC_WRITEMODE
| AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_WRITE
| AT91_SMC_DBW_16 | AT91_SMC_TDF_(1));
platform_device_register(&cap9adk_nor_flash); platform_device_register(&cap9adk_nor_flash);
} }
...@@ -344,7 +390,7 @@ static void __init cap9adk_board_init(void) ...@@ -344,7 +390,7 @@ static void __init cap9adk_board_init(void)
/* Ethernet */ /* Ethernet */
at91_add_device_eth(&cap9adk_macb_data); at91_add_device_eth(&cap9adk_macb_data);
/* NAND */ /* NAND */
at91_add_device_nand(&cap9adk_nand_data); cap9adk_add_device_nand();
/* NOR Flash */ /* NOR Flash */
cap9adk_add_device_nor(); cap9adk_add_device_nor();
/* I2C */ /* I2C */
......
...@@ -41,8 +41,10 @@ ...@@ -41,8 +41,10 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h> #include <mach/gpio.h>
#include <mach/at91sam9_smc.h>
#include <mach/at91_shdwc.h> #include <mach/at91_shdwc.h>
#include "sam9_smc.h"
#include "generic.h" #include "generic.h"
...@@ -147,13 +149,34 @@ static struct atmel_nand_data __initdata ek_nand_data = { ...@@ -147,13 +149,34 @@ static struct atmel_nand_data __initdata ek_nand_data = {
.rdy_pin = AT91_PIN_PC13, .rdy_pin = AT91_PIN_PC13,
.enable_pin = AT91_PIN_PC14, .enable_pin = AT91_PIN_PC14,
.partition_info = nand_partitions, .partition_info = nand_partitions,
#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
.bus_width_16 = 1,
#else
.bus_width_16 = 0,
#endif
}; };
static struct sam9_smc_config __initdata ek_nand_smc_config = {
.ncs_read_setup = 0,
.nrd_setup = 1,
.ncs_write_setup = 0,
.nwe_setup = 1,
.ncs_read_pulse = 3,
.nrd_pulse = 3,
.ncs_write_pulse = 3,
.nwe_pulse = 3,
.read_cycle = 5,
.write_cycle = 5,
.mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
.tdf_cycles = 2,
};
static void __init ek_add_device_nand(void)
{
/* configure chip-select 3 (NAND) */
sam9_smc_configure(3, &ek_nand_smc_config);
at91_add_device_nand(&ek_nand_data);
}
/* /*
* MCI (SD/MMC) * MCI (SD/MMC)
*/ */
...@@ -227,7 +250,7 @@ static void __init ek_board_init(void) ...@@ -227,7 +250,7 @@ static void __init ek_board_init(void)
/* SPI */ /* SPI */
at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
/* NAND */ /* NAND */
at91_add_device_nand(&ek_nand_data); ek_add_device_nand();
/* I2C */ /* I2C */
at91_add_device_i2c(NULL, 0); at91_add_device_i2c(NULL, 0);
/* Ethernet */ /* Ethernet */
......
...@@ -38,7 +38,9 @@ ...@@ -38,7 +38,9 @@
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h> #include <mach/gpio.h>
#include <mach/at91sam9_smc.h>
#include "sam9_smc.h"
#include "generic.h" #include "generic.h"
...@@ -148,13 +150,34 @@ static struct atmel_nand_data __initdata ek_nand_data = { ...@@ -148,13 +150,34 @@ static struct atmel_nand_data __initdata ek_nand_data = {
.rdy_pin = AT91_PIN_PC13, .rdy_pin = AT91_PIN_PC13,
.enable_pin = AT91_PIN_PC14, .enable_pin = AT91_PIN_PC14,
.partition_info = nand_partitions, .partition_info = nand_partitions,
#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
.bus_width_16 = 1,
#else
.bus_width_16 = 0,
#endif
}; };
static struct sam9_smc_config __initdata ek_nand_smc_config = {
.ncs_read_setup = 0,
.nrd_setup = 1,
.ncs_write_setup = 0,
.nwe_setup = 1,
.ncs_read_pulse = 3,
.nrd_pulse = 3,
.ncs_write_pulse = 3,
.nwe_pulse = 3,
.read_cycle = 5,
.write_cycle = 5,
.mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
.tdf_cycles = 2,
};
static void __init ek_add_device_nand(void)
{
/* configure chip-select 3 (NAND) */
sam9_smc_configure(3, &ek_nand_smc_config);
at91_add_device_nand(&ek_nand_data);
}
/* /*
* MCI (SD/MMC) * MCI (SD/MMC)
...@@ -178,7 +201,7 @@ static void __init ek_board_init(void) ...@@ -178,7 +201,7 @@ static void __init ek_board_init(void)
/* SPI */ /* SPI */
at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
/* NAND */ /* NAND */
at91_add_device_nand(&ek_nand_data); ek_add_device_nand();
/* Ethernet */ /* Ethernet */
at91_add_device_eth(&ek_macb_data); at91_add_device_eth(&ek_macb_data);
/* MMC */ /* MMC */
......
...@@ -42,7 +42,10 @@ ...@@ -42,7 +42,10 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h> #include <mach/gpio.h>
#include <mach/at91sam9_smc.h>
#include <mach/at91_shdwc.h>
#include "sam9_smc.h"
#include "generic.h" #include "generic.h"
...@@ -195,6 +198,38 @@ static struct atmel_nand_data __initdata ek_nand_data = { ...@@ -195,6 +198,38 @@ static struct atmel_nand_data __initdata ek_nand_data = {
#endif #endif
}; };
static struct sam9_smc_config __initdata ek_nand_smc_config = {
.ncs_read_setup = 0,
.nrd_setup = 1,
.ncs_write_setup = 0,
.nwe_setup = 1,
.ncs_read_pulse = 3,
.nrd_pulse = 3,
.ncs_write_pulse = 3,
.nwe_pulse = 3,
.read_cycle = 5,
.write_cycle = 5,
.mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
.tdf_cycles = 2,
};
static void __init ek_add_device_nand(void)
{
/* setup bus-width (8 or 16) */
if (ek_nand_data.bus_width_16)
ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
else
ek_nand_smc_config.mode |= AT91_SMC_DBW_8;
/* configure chip-select 3 (NAND) */
sam9_smc_configure(3, &ek_nand_smc_config);
at91_add_device_nand(&ek_nand_data);
}
/* /*
* MCI (SD/MMC) * MCI (SD/MMC)
...@@ -303,7 +338,7 @@ static void __init ek_board_init(void) ...@@ -303,7 +338,7 @@ static void __init ek_board_init(void)
/* SPI */ /* SPI */
at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
/* NAND */ /* NAND */
at91_add_device_nand(&ek_nand_data); ek_add_device_nand();
/* Ethernet */ /* Ethernet */
at91_add_device_eth(&ek_macb_data); at91_add_device_eth(&ek_macb_data);
/* MMC */ /* MMC */
......
...@@ -47,7 +47,9 @@ ...@@ -47,7 +47,9 @@
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h> #include <mach/gpio.h>
#include <mach/at91sam9_smc.h> #include <mach/at91sam9_smc.h>
#include <mach/at91_shdwc.h>
#include "sam9_smc.h"
#include "generic.h" #include "generic.h"
...@@ -76,7 +78,7 @@ static void __init ek_init_irq(void) ...@@ -76,7 +78,7 @@ static void __init ek_init_irq(void)
* DM9000 ethernet device * DM9000 ethernet device
*/ */
#if defined(CONFIG_DM9000) #if defined(CONFIG_DM9000)
static struct resource at91sam9261_dm9000_resource[] = { static struct resource dm9000_resource[] = {
[0] = { [0] = {
.start = AT91_CHIPSELECT_2, .start = AT91_CHIPSELECT_2,
.end = AT91_CHIPSELECT_2 + 3, .end = AT91_CHIPSELECT_2 + 3,
...@@ -98,27 +100,42 @@ static struct dm9000_plat_data dm9000_platdata = { ...@@ -98,27 +100,42 @@ static struct dm9000_plat_data dm9000_platdata = {
.flags = DM9000_PLATF_16BITONLY, .flags = DM9000_PLATF_16BITONLY,
}; };
static struct platform_device at91sam9261_dm9000_device = { static struct platform_device dm9000_device = {
.name = "dm9000", .name = "dm9000",
.id = 0, .id = 0,
.num_resources = ARRAY_SIZE(at91sam9261_dm9000_resource), .num_resources = ARRAY_SIZE(dm9000_resource),
.resource = at91sam9261_dm9000_resource, .resource = dm9000_resource,
.dev = { .dev = {
.platform_data = &dm9000_platdata, .platform_data = &dm9000_platdata,
} }
}; };
/*
* SMC timings for the DM9000.
* Note: These timings were calculated for MASTER_CLOCK = 100000000 according to the DM9000 timings.
*/
static struct sam9_smc_config __initdata dm9000_smc_config = {
.ncs_read_setup = 0,
.nrd_setup = 2,
.ncs_write_setup = 0,
.nwe_setup = 2,
.ncs_read_pulse = 8,
.nrd_pulse = 4,
.ncs_write_pulse = 8,
.nwe_pulse = 4,
.read_cycle = 16,
.write_cycle = 16,
.mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_WRITE | AT91_SMC_DBW_16,
.tdf_cycles = 1,
};
static void __init ek_add_device_dm9000(void) static void __init ek_add_device_dm9000(void)
{ {
/* /* Configure chip-select 2 (DM9000) */
* Configure Chip-Select 2 on SMC for the DM9000. sam9_smc_configure(2, &dm9000_smc_config);
* Note: These timings were calculated for MASTER_CLOCK = 100000000
* according to the DM9000 timings.
*/
at91_sys_write(AT91_SMC_SETUP(2), AT91_SMC_NWESETUP_(2) | AT91_SMC_NCS_WRSETUP_(0) | AT91_SMC_NRDSETUP_(2) | AT91_SMC_NCS_RDSETUP_(0));
at91_sys_write(AT91_SMC_PULSE(2), AT91_SMC_NWEPULSE_(4) | AT91_SMC_NCS_WRPULSE_(8) | AT91_SMC_NRDPULSE_(4) | AT91_SMC_NCS_RDPULSE_(8));
at91_sys_write(AT91_SMC_CYCLE(2), AT91_SMC_NWECYCLE_(16) | AT91_SMC_NRDCYCLE_(16));
at91_sys_write(AT91_SMC_MODE(2), AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_WRITE | AT91_SMC_DBW_16 | AT91_SMC_TDF_(1));
/* Configure Reset signal as output */ /* Configure Reset signal as output */
at91_set_gpio_output(AT91_PIN_PC10, 0); at91_set_gpio_output(AT91_PIN_PC10, 0);
...@@ -126,7 +143,7 @@ static void __init ek_add_device_dm9000(void) ...@@ -126,7 +143,7 @@ static void __init ek_add_device_dm9000(void)
/* Configure Interrupt pin as input, no pull-up */ /* Configure Interrupt pin as input, no pull-up */
at91_set_gpio_input(AT91_PIN_PC11, 0); at91_set_gpio_input(AT91_PIN_PC11, 0);
platform_device_register(&at91sam9261_dm9000_device); platform_device_register(&dm9000_device);
} }
#else #else
static void __init ek_add_device_dm9000(void) {} static void __init ek_add_device_dm9000(void) {}
...@@ -197,6 +214,39 @@ static struct atmel_nand_data __initdata ek_nand_data = { ...@@ -197,6 +214,39 @@ static struct atmel_nand_data __initdata ek_nand_data = {
#endif #endif
}; };
static struct sam9_smc_config __initdata ek_nand_smc_config = {
.ncs_read_setup = 0,
.nrd_setup = 1,
.ncs_write_setup = 0,
.nwe_setup = 1,
.ncs_read_pulse = 3,
.nrd_pulse = 3,
.ncs_write_pulse = 3,
.nwe_pulse = 3,
.read_cycle = 5,
.write_cycle = 5,
.mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
.tdf_cycles = 2,
};
static void __init ek_add_device_nand(void)
{
/* setup bus-width (8 or 16) */
if (ek_nand_data.bus_width_16)
ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
else
ek_nand_smc_config.mode |= AT91_SMC_DBW_8;
/* configure chip-select 3 (NAND) */
sam9_smc_configure(3, &ek_nand_smc_config);
at91_add_device_nand(&ek_nand_data);
}
/* /*
* ADS7846 Touchscreen * ADS7846 Touchscreen
*/ */
...@@ -525,7 +575,7 @@ static void __init ek_board_init(void) ...@@ -525,7 +575,7 @@ static void __init ek_board_init(void)
/* I2C */ /* I2C */
at91_add_device_i2c(NULL, 0); at91_add_device_i2c(NULL, 0);
/* NAND */ /* NAND */
at91_add_device_nand(&ek_nand_data); ek_add_device_nand();
/* DM9000 ethernet */ /* DM9000 ethernet */
ek_add_device_dm9000(); ek_add_device_dm9000();
......
...@@ -46,7 +46,9 @@ ...@@ -46,7 +46,9 @@
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h> #include <mach/gpio.h>
#include <mach/at91sam9_smc.h> #include <mach/at91sam9_smc.h>
#include <mach/at91_shdwc.h>
#include "sam9_smc.h"
#include "generic.h" #include "generic.h"
...@@ -203,6 +205,38 @@ static struct atmel_nand_data __initdata ek_nand_data = { ...@@ -203,6 +205,38 @@ static struct atmel_nand_data __initdata ek_nand_data = {
#endif #endif
}; };
static struct sam9_smc_config __initdata ek_nand_smc_config = {
.ncs_read_setup = 0,
.nrd_setup = 1,
.ncs_write_setup = 0,
.nwe_setup = 1,
.ncs_read_pulse = 3,
.nrd_pulse = 3,
.ncs_write_pulse = 3,
.nwe_pulse = 3,
.read_cycle = 5,
.write_cycle = 5,
.mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
.tdf_cycles = 2,
};
static void __init ek_add_device_nand(void)
{
/* setup bus-width (8 or 16) */
if (ek_nand_data.bus_width_16)
ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
else
ek_nand_smc_config.mode |= AT91_SMC_DBW_8;
/* configure chip-select 3 (NAND) */
sam9_smc_configure(3, &ek_nand_smc_config);
at91_add_device_nand(&ek_nand_data);
}
/* /*
* I2C devices * I2C devices
...@@ -385,7 +419,7 @@ static void __init ek_board_init(void) ...@@ -385,7 +419,7 @@ static void __init ek_board_init(void)
/* Ethernet */ /* Ethernet */
at91_add_device_eth(&ek_macb_data); at91_add_device_eth(&ek_macb_data);
/* NAND */ /* NAND */
at91_add_device_nand(&ek_nand_data); ek_add_device_nand();
/* I2C */ /* I2C */
at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices)); at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices));
/* LCD Controller */ /* LCD Controller */
......
...@@ -37,7 +37,9 @@ ...@@ -37,7 +37,9 @@
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h> #include <mach/gpio.h>
#include <mach/at91sam9_smc.h>
#include "sam9_smc.h"
#include "generic.h" #include "generic.h"
...@@ -156,6 +158,38 @@ static struct atmel_nand_data __initdata ek_nand_data = { ...@@ -156,6 +158,38 @@ static struct atmel_nand_data __initdata ek_nand_data = {
#endif #endif
}; };
static struct sam9_smc_config __initdata ek_nand_smc_config = {
.ncs_read_setup = 0,
.nrd_setup = 2,
.ncs_write_setup = 0,
.nwe_setup = 2,
.ncs_read_pulse = 4,
.nrd_pulse = 4,
.ncs_write_pulse = 4,
.nwe_pulse = 4,
.read_cycle = 7,
.write_cycle = 7,
.mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
.tdf_cycles = 3,
};
static void __init ek_add_device_nand(void)
{
/* setup bus-width (8 or 16) */
if (ek_nand_data.bus_width_16)
ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
else
ek_nand_smc_config.mode |= AT91_SMC_DBW_8;
/* configure chip-select 3 (NAND) */
sam9_smc_configure(3, &ek_nand_smc_config);
at91_add_device_nand(&ek_nand_data);
}
/* /*
* MCI (SD/MMC) * MCI (SD/MMC)
...@@ -195,7 +229,7 @@ static void __init ek_board_init(void) ...@@ -195,7 +229,7 @@ static void __init ek_board_init(void)
/* SPI */ /* SPI */
at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
/* NAND */ /* NAND */
at91_add_device_nand(&ek_nand_data); ek_add_device_nand();
/* Ethernet */ /* Ethernet */
at91_add_device_eth(&ek_macb_data); at91_add_device_eth(&ek_macb_data);
/* MMC */ /* MMC */
......
...@@ -29,8 +29,9 @@ ...@@ -29,8 +29,9 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h> #include <mach/gpio.h>
#include <mach/at91sam9_smc.h> #include <mach/at91_shdwc.h>
#include "sam9_smc.h"
#include "generic.h" #include "generic.h"
...@@ -103,9 +104,34 @@ static struct atmel_nand_data __initdata ek_nand_data = { ...@@ -103,9 +104,34 @@ static struct atmel_nand_data __initdata ek_nand_data = {
.rdy_pin = AT91_PIN_PD17, .rdy_pin = AT91_PIN_PD17,
.enable_pin = AT91_PIN_PB6, .enable_pin = AT91_PIN_PB6,
.partition_info = nand_partitions, .partition_info = nand_partitions,
.bus_width_16 = 0,
}; };
static struct sam9_smc_config __initdata ek_nand_smc_config = {
.ncs_read_setup = 0,
.nrd_setup = 1,
.ncs_write_setup = 0,
.nwe_setup = 1,
.ncs_read_pulse = 3,
.nrd_pulse = 3,
.ncs_write_pulse = 3,
.nwe_pulse = 3,
.read_cycle = 5,
.write_cycle = 5,
.mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
.tdf_cycles = 2,
};
static void __init ek_add_device_nand(void)
{
/* configure chip-select 3 (NAND) */
sam9_smc_configure(3, &ek_nand_smc_config);
at91_add_device_nand(&ek_nand_data);
}
/* /*
* SPI devices * SPI devices
...@@ -188,7 +214,7 @@ static void __init ek_board_init(void) ...@@ -188,7 +214,7 @@ static void __init ek_board_init(void)
/* I2C */ /* I2C */
at91_add_device_i2c(NULL, 0); at91_add_device_i2c(NULL, 0);
/* NAND */ /* NAND */
at91_add_device_nand(&ek_nand_data); ek_add_device_nand();
/* SPI */ /* SPI */
at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
/* MMC */ /* MMC */
......
...@@ -41,8 +41,10 @@ ...@@ -41,8 +41,10 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h> #include <mach/gpio.h>
#include <mach/at91sam9_smc.h>
#include <mach/at91_shdwc.h> #include <mach/at91_shdwc.h>
#include "sam9_smc.h"
#include "generic.h" #include "generic.h"
...@@ -121,13 +123,34 @@ static struct atmel_nand_data __initdata ek_nand_data = { ...@@ -121,13 +123,34 @@ static struct atmel_nand_data __initdata ek_nand_data = {
.rdy_pin = AT91_PIN_PC13, .rdy_pin = AT91_PIN_PC13,
.enable_pin = AT91_PIN_PC14, .enable_pin = AT91_PIN_PC14,
.partition_info = nand_partitions, .partition_info = nand_partitions,
#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
.bus_width_16 = 1,
#else
.bus_width_16 = 0,
#endif
}; };
static struct sam9_smc_config __initdata ek_nand_smc_config = {
.ncs_read_setup = 0,
.nrd_setup = 1,
.ncs_write_setup = 0,
.nwe_setup = 1,
.ncs_read_pulse = 3,
.nrd_pulse = 3,
.ncs_write_pulse = 3,
.nwe_pulse = 3,
.read_cycle = 5,
.write_cycle = 5,
.mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
.tdf_cycles = 2,
};
static void __init ek_add_device_nand(void)
{
/* configure chip-select 3 (NAND) */
sam9_smc_configure(3, &ek_nand_smc_config);
at91_add_device_nand(&ek_nand_data);
}
/* /*
* GPIO Buttons * GPIO Buttons
*/ */
...@@ -189,7 +212,7 @@ static void __init ek_board_init(void) ...@@ -189,7 +212,7 @@ static void __init ek_board_init(void)
/* USB Device */ /* USB Device */
at91_add_device_udc(&ek_udc_data); at91_add_device_udc(&ek_udc_data);
/* NAND */ /* NAND */
at91_add_device_nand(&ek_nand_data); ek_add_device_nand();
/* I2C */ /* I2C */
at91_add_device_i2c(NULL, 0); at91_add_device_i2c(NULL, 0);
/* Ethernet */ /* Ethernet */
......
...@@ -40,8 +40,10 @@ ...@@ -40,8 +40,10 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h> #include <mach/gpio.h>
#include <mach/at91sam9_smc.h>
#include <mach/at91_shdwc.h> #include <mach/at91_shdwc.h>
#include "sam9_smc.h"
#include "generic.h" #include "generic.h"
...@@ -134,13 +136,35 @@ static struct atmel_nand_data __initdata ek_nand_data = { ...@@ -134,13 +136,35 @@ static struct atmel_nand_data __initdata ek_nand_data = {
.rdy_pin = AT91_PIN_PA22, .rdy_pin = AT91_PIN_PA22,
.enable_pin = AT91_PIN_PD15, .enable_pin = AT91_PIN_PD15,
.partition_info = nand_partitions, .partition_info = nand_partitions,
#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
.bus_width_16 = 1,
#else
.bus_width_16 = 0,
#endif
}; };
static struct sam9_smc_config __initdata ek_nand_smc_config = {
.ncs_read_setup = 0,
.nrd_setup = 1,
.ncs_write_setup = 0,
.nwe_setup = 1,
.ncs_read_pulse = 3,
.nrd_pulse = 3,
.ncs_write_pulse = 3,
.nwe_pulse = 3,
.read_cycle = 5,
.write_cycle = 5,
.mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
.tdf_cycles = 2,
};
static void __init ek_add_device_nand(void)
{
/* configure chip-select 3 (NAND) */
sam9_smc_configure(3, &ek_nand_smc_config);
at91_add_device_nand(&ek_nand_data);
}
/* /*
* GPIO Buttons * GPIO Buttons
*/ */
...@@ -206,7 +230,7 @@ static void __init ek_board_init(void) ...@@ -206,7 +230,7 @@ static void __init ek_board_init(void)
/* Ethernet */ /* Ethernet */
at91_add_device_eth(&ek_macb_data); at91_add_device_eth(&ek_macb_data);
/* NAND */ /* NAND */
at91_add_device_nand(&ek_nand_data); ek_add_device_nand();
/* I2C */ /* I2C */
at91_add_device_i2c(NULL, 0); at91_add_device_i2c(NULL, 0);
/* Push Buttons */ /* Push Buttons */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment