[ARM] 5289/1: [AT91] Convert boards to use sam9_smc_configure()
authorAndrew Victor <linux@maxim.org.za>
Mon, 6 Oct 2008 19:05:35 +0000 (20:05 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Mon, 1 Dec 2008 17:18:13 +0000 (17:18 +0000)
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: Andrew Victor <linux@maxim.org.za>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-at91/board-cam60.c
arch/arm/mach-at91/board-cap9adk.c
arch/arm/mach-at91/board-qil-a9260.c
arch/arm/mach-at91/board-sam9-l9260.c
arch/arm/mach-at91/board-sam9260ek.c
arch/arm/mach-at91/board-sam9261ek.c
arch/arm/mach-at91/board-sam9263ek.c
arch/arm/mach-at91/board-sam9g20ek.c
arch/arm/mach-at91/board-sam9rlek.c
arch/arm/mach-at91/board-usb-a9260.c
arch/arm/mach-at91/board-usb-a9263.c

index cdddca54b938ce79fd7ec2b182a96b22df0d3ff1..d3ba29c5d8c83722b7276b7d98ed51cfecfac4a7 100644 (file)
@@ -39,7 +39,9 @@
 
 #include <mach/board.h>
 #include <mach/gpio.h>
+#include <mach/at91sam9_smc.h>
 
+#include "sam9_smc.h"
 #include "generic.h"
 
 
@@ -151,6 +153,32 @@ static struct atmel_nand_data __initdata cam60_nand_data = {
        .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)
 {
@@ -165,7 +193,7 @@ static void __init cam60_board_init(void)
        at91_set_gpio_output(AT91_PIN_PB18, 1);
        at91_add_device_usbh(&cam60_usbh_data);
        /* NAND */
-       at91_add_device_nand(&cam60_nand_data);
+       cam60_add_device_nand();
 }
 
 MACHINE_START(CAM60, "KwikByte CAM60")
index 201b89392dcc4ec91555b9d139ee87757b8a1004..43b37bc91e5feb069bd4eb14b1fc7ddd40647141 100644 (file)
@@ -47,6 +47,7 @@
 #include <mach/at91cap9_matrix.h>
 #include <mach/at91sam9_smc.h>
 
+#include "sam9_smc.h"
 #include "generic.h"
 
 
@@ -195,6 +196,43 @@ static struct atmel_nand_data __initdata cap9adk_nand_data = {
 #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
@@ -234,6 +272,24 @@ static struct platform_device cap9adk_nor_flash = {
        .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)
 {
        unsigned long csa;
@@ -241,18 +297,8 @@ static __init void cap9adk_add_device_nor(void)
        csa = at91_sys_read(AT91_MATRIX_EBICSA);
        at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_VDDIOMSEL_3_3V);
 
-       /* set the bus interface characteristics */
-       at91_sys_write(AT91_SMC_SETUP(0), AT91_SMC_NWESETUP_(4) | AT91_SMC_NCS_WRSETUP_(2)
-                       | 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));
+       /* configure chip-select 0 (NOR) */
+       sam9_smc_configure(0, &cap9adk_nor_smc_config);
 
        platform_device_register(&cap9adk_nor_flash);
 }
@@ -344,7 +390,7 @@ static void __init cap9adk_board_init(void)
        /* Ethernet */
        at91_add_device_eth(&cap9adk_macb_data);
        /* NAND */
-       at91_add_device_nand(&cap9adk_nand_data);
+       cap9adk_add_device_nand();
        /* NOR Flash */
        cap9adk_add_device_nor();
        /* I2C */
index cfb4571a2e275d00c52a587a8ed21d71d9d7b59a..4cff9a7e61d2d70b8af645e11bc38df30bfdd72a 100644 (file)
 #include <mach/hardware.h>
 #include <mach/board.h>
 #include <mach/gpio.h>
+#include <mach/at91sam9_smc.h>
 #include <mach/at91_shdwc.h>
 
+#include "sam9_smc.h"
 #include "generic.h"
 
 
@@ -147,13 +149,34 @@ static struct atmel_nand_data __initdata ek_nand_data = {
        .rdy_pin        = AT91_PIN_PC13,
        .enable_pin     = AT91_PIN_PC14,
        .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)
  */
@@ -227,7 +250,7 @@ static void __init ek_board_init(void)
        /* SPI */
        at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
        /* NAND */
-       at91_add_device_nand(&ek_nand_data);
+       ek_add_device_nand();
        /* I2C */
        at91_add_device_i2c(NULL, 0);
        /* Ethernet */
index 99bb4cc23a0950af07d18712b077696c2f6842c9..b4834697753499278b85aea36c710d990dd9ce49 100644 (file)
@@ -38,7 +38,9 @@
 
 #include <mach/board.h>
 #include <mach/gpio.h>
+#include <mach/at91sam9_smc.h>
 
+#include "sam9_smc.h"
 #include "generic.h"
 
 
@@ -148,13 +150,34 @@ static struct atmel_nand_data __initdata ek_nand_data = {
        .rdy_pin        = AT91_PIN_PC13,
        .enable_pin     = AT91_PIN_PC14,
        .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)
@@ -178,7 +201,7 @@ static void __init ek_board_init(void)
        /* SPI */
        at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
        /* NAND */
-       at91_add_device_nand(&ek_nand_data);
+       ek_add_device_nand();
        /* Ethernet */
        at91_add_device_eth(&ek_macb_data);
        /* MMC */
index b49eb6e4918acc52ba87fe400634fd3ec2ed1f80..93a0f8b100eb24e725326cc0cb1f497526d6224d 100644 (file)
 #include <mach/hardware.h>
 #include <mach/board.h>
 #include <mach/gpio.h>
+#include <mach/at91sam9_smc.h>
+#include <mach/at91_shdwc.h>
 
+#include "sam9_smc.h"
 #include "generic.h"
 
 
@@ -195,6 +198,38 @@ static struct atmel_nand_data __initdata ek_nand_data = {
 #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)
@@ -303,7 +338,7 @@ static void __init ek_board_init(void)
        /* SPI */
        at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
        /* NAND */
-       at91_add_device_nand(&ek_nand_data);
+       ek_add_device_nand();
        /* Ethernet */
        at91_add_device_eth(&ek_macb_data);
        /* MMC */
index 4977409d4fc6bcb72e3f17fa8a5646526040b9e5..d5266da553112651228679c4beb42944b89a2d42 100644 (file)
@@ -47,7 +47,9 @@
 #include <mach/board.h>
 #include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
+#include <mach/at91_shdwc.h>
 
+#include "sam9_smc.h"
 #include "generic.h"
 
 
@@ -76,7 +78,7 @@ static void __init ek_init_irq(void)
  * DM9000 ethernet device
  */
 #if defined(CONFIG_DM9000)
-static struct resource at91sam9261_dm9000_resource[] = {
+static struct resource dm9000_resource[] = {
        [0] = {
                .start  = AT91_CHIPSELECT_2,
                .end    = AT91_CHIPSELECT_2 + 3,
@@ -98,27 +100,42 @@ static struct dm9000_plat_data dm9000_platdata = {
        .flags          = DM9000_PLATF_16BITONLY,
 };
 
-static struct platform_device at91sam9261_dm9000_device = {
+static struct platform_device dm9000_device = {
        .name           = "dm9000",
        .id             = 0,
-       .num_resources  = ARRAY_SIZE(at91sam9261_dm9000_resource),
-       .resource       = at91sam9261_dm9000_resource,
+       .num_resources  = ARRAY_SIZE(dm9000_resource),
+       .resource       = dm9000_resource,
        .dev            = {
                .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)
 {
-       /*
-        * Configure Chip-Select 2 on SMC for the DM9000.
-        * 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 chip-select 2 (DM9000) */
+       sam9_smc_configure(2, &dm9000_smc_config);
 
        /* Configure Reset signal as output */
        at91_set_gpio_output(AT91_PIN_PC10, 0);
@@ -126,7 +143,7 @@ static void __init ek_add_device_dm9000(void)
        /* Configure Interrupt pin as input, no pull-up */
        at91_set_gpio_input(AT91_PIN_PC11, 0);
 
-       platform_device_register(&at91sam9261_dm9000_device);
+       platform_device_register(&dm9000_device);
 }
 #else
 static void __init ek_add_device_dm9000(void) {}
@@ -197,6 +214,39 @@ static struct atmel_nand_data __initdata ek_nand_data = {
 #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
  */
@@ -525,7 +575,7 @@ static void __init ek_board_init(void)
        /* I2C */
        at91_add_device_i2c(NULL, 0);
        /* NAND */
-       at91_add_device_nand(&ek_nand_data);
+       ek_add_device_nand();
        /* DM9000 ethernet */
        ek_add_device_dm9000();
 
index 8354015c6a23268817caeccfe58f26646d8a7c60..57d52528f2247950b90c9b4010af813595eeedcc 100644 (file)
@@ -46,7 +46,9 @@
 #include <mach/board.h>
 #include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
+#include <mach/at91_shdwc.h>
 
+#include "sam9_smc.h"
 #include "generic.h"
 
 
@@ -203,6 +205,38 @@ static struct atmel_nand_data __initdata ek_nand_data = {
 #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
@@ -385,7 +419,7 @@ static void __init ek_board_init(void)
        /* Ethernet */
        at91_add_device_eth(&ek_macb_data);
        /* NAND */
-       at91_add_device_nand(&ek_nand_data);
+       ek_add_device_nand();
        /* I2C */
        at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices));
        /* LCD Controller */
index b588ead14d68a4cb569f1ca8384c166a32bffb33..81439fe6fb3d7bc368ce1656870aa1d476d98b67 100644 (file)
@@ -37,7 +37,9 @@
 
 #include <mach/board.h>
 #include <mach/gpio.h>
+#include <mach/at91sam9_smc.h>
 
+#include "sam9_smc.h"
 #include "generic.h"
 
 
@@ -156,6 +158,38 @@ static struct atmel_nand_data __initdata ek_nand_data = {
 #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)
@@ -195,7 +229,7 @@ static void __init ek_board_init(void)
        /* SPI */
        at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
        /* NAND */
-       at91_add_device_nand(&ek_nand_data);
+       ek_add_device_nand();
        /* Ethernet */
        at91_add_device_eth(&ek_macb_data);
        /* MMC */
index 2708518643084f78d6eacd5d1e04c3a214ec53b9..9b937ee4815a804cd8b92dc5e32aca82e9c04d29 100644 (file)
@@ -29,8 +29,9 @@
 #include <mach/hardware.h>
 #include <mach/board.h>
 #include <mach/gpio.h>
-#include <mach/at91sam9_smc.h>
+#include <mach/at91_shdwc.h>
 
+#include "sam9_smc.h"
 #include "generic.h"
 
 
@@ -103,9 +104,34 @@ static struct atmel_nand_data __initdata ek_nand_data = {
        .rdy_pin        = AT91_PIN_PD17,
        .enable_pin     = AT91_PIN_PB6,
        .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
@@ -188,7 +214,7 @@ static void __init ek_board_init(void)
        /* I2C */
        at91_add_device_i2c(NULL, 0);
        /* NAND */
-       at91_add_device_nand(&ek_nand_data);
+       ek_add_device_nand();
        /* SPI */
        at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
        /* MMC */
index 7c350357333a0b708cc143d1efcb3df01ee61f05..d13304c0bc45eff75eabe5bb9310cf724bfcd74c 100644 (file)
 #include <mach/hardware.h>
 #include <mach/board.h>
 #include <mach/gpio.h>
+#include <mach/at91sam9_smc.h>
 #include <mach/at91_shdwc.h>
 
+#include "sam9_smc.h"
 #include "generic.h"
 
 
@@ -121,13 +123,34 @@ static struct atmel_nand_data __initdata ek_nand_data = {
        .rdy_pin        = AT91_PIN_PC13,
        .enable_pin     = AT91_PIN_PC14,
        .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
  */
@@ -189,7 +212,7 @@ static void __init ek_board_init(void)
        /* USB Device */
        at91_add_device_udc(&ek_udc_data);
        /* NAND */
-       at91_add_device_nand(&ek_nand_data);
+       ek_add_device_nand();
        /* I2C */
        at91_add_device_i2c(NULL, 0);
        /* Ethernet */
index 391b566c4571153ad345b67c1e6b903ab008df0e..d96405b7d5785908dd6d438b4a32b98c95c40825 100644 (file)
 #include <mach/hardware.h>
 #include <mach/board.h>
 #include <mach/gpio.h>
+#include <mach/at91sam9_smc.h>
 #include <mach/at91_shdwc.h>
 
+#include "sam9_smc.h"
 #include "generic.h"
 
 
@@ -134,13 +136,35 @@ static struct atmel_nand_data __initdata ek_nand_data = {
        .rdy_pin        = AT91_PIN_PA22,
        .enable_pin     = AT91_PIN_PD15,
        .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
  */
@@ -206,7 +230,7 @@ static void __init ek_board_init(void)
        /* Ethernet */
        at91_add_device_eth(&ek_macb_data);
        /* NAND */
-       at91_add_device_nand(&ek_nand_data);
+       ek_add_device_nand();
        /* I2C */
        at91_add_device_i2c(NULL, 0);
        /* Push Buttons */