Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

[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
Loading
Loading
Loading
Loading
+29 −1
Original line number Diff line number Diff line
@@ -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")
+59 −13
Original line number Diff line number Diff line
@@ -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 */
+29 −6
Original line number Diff line number Diff line
@@ -41,8 +41,10 @@
#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 */
+29 −6
Original line number Diff line number Diff line
@@ -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 */
+36 −1
Original line number Diff line number Diff line
@@ -42,7 +42,10 @@
#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 */
Loading