Index: git/arch/arm/mach-at91/board-sam9x5cm.c =================================================================== --- git.orig/arch/arm/mach-at91/board-sam9x5cm.c 2013-12-27 14:27:13.000000000 -0600 +++ git/arch/arm/mach-at91/board-sam9x5cm.c 2014-02-06 16:31:32.817405456 -0600 @@ -18,6 +18,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -103,6 +106,31 @@ .irq = -1, }, #endif + { /* SPI1_NCS1 to ethernet switch */ + .modalias = "spidev", + .chip_select = 0, + .bus_num = 1, + }, + { /* SPI1_NCS2 to temp sensor */ + .modalias = "mts-io-board-temp", + .chip_select = 1, + .bus_num = 1, + }, + { /* SPI1_NCS3 to daughter card analog inputs */ + .modalias = "mts-io-dc-adc", + .chip_select = 2, + .bus_num = 1, + }, + { /* SPI1_NCS4 to daughter card digital inputs */ + .modalias = "mts-io-dc-din", + .chip_select = 3, + .bus_num = 1, + }, + { /* SPI1_NCS5 to daughter card digital outputs */ + .modalias = "mts-io-dc-dout", + .chip_select = 4, + .bus_num = 1, + }, #endif }; @@ -111,13 +139,48 @@ */ static struct mtd_partition __initdata cm_nand_partition[] = { { - .name = "Partition 1", + .name = "NANDFlash", + .offset = 0, + .size = 256*1024*1024, + }, + { + .name = "AT91Bootstrap", .offset = 0, - .size = SZ_64M, + .size = 256*1024, + }, + { + .name = "UBoot", + .offset = 256*1024, + .size = 512*1024, + }, + { + .name = "UBoot Config", + .offset = 768*1024, + .size = 640*1024, + }, + { + .name = "UBoot Redundant Config", + .offset = 1408*1024, + .size = 640*1024, + }, + { + .name = "uImage", + .offset = 2*1024*1024, + .size = 6*1024*1024, + }, + { + .name = "Config", + .offset = 8*1024*1024, + .size = 8*1024*1024, + }, + { + .name = "Oem Config", + .offset = 16*1024*1024, + .size = 8*1024*1024, }, { - .name = "Partition 2", - .offset = MTDPART_OFS_NXTBLK, + .name = "Rootfs", + .offset = 24*1024*1024, .size = MTDPART_SIZ_FULL, }, }; @@ -135,7 +198,8 @@ .enable_pin = AT91_PIN_PD4, .ecc_mode = NAND_ECC_HW, .has_pmecc = 1, - .pmecc_corr_cap = 2, +// MTOCGD2: 4-bit PMECC + .pmecc_corr_cap = 4, .pmecc_sector_size = 512, .pmecc_lookup_table_offset = 0x8000, .partition_info = nand_partitions, @@ -170,7 +234,13 @@ else cm_nand_smc_config.mode |= AT91_SMC_DBW_8; + // MTOCGD2 Rev B + cm_nand_data.bus_on_d0 = 0; + cm_nand_data.rdy_pin = AT91_PIN_PC31; + + // MTOCGD2: disable /* revision of board modify NAND wiring */ + /* if (cm_is_revA()) { cm_nand_data.bus_on_d0 = 1; cm_nand_data.rdy_pin = AT91_PIN_PD6; @@ -178,6 +248,7 @@ cm_nand_data.bus_on_d0 = 0; cm_nand_data.rdy_pin = AT91_PIN_PD5; } + */ /* configure chip-select 3 (NAND) */ sam9_smc_configure(3, &cm_nand_smc_config); @@ -189,17 +260,90 @@ * LEDs */ static struct gpio_led cm_leds[] = { - { /* "left" led, blue, userled1 */ - .name = "d1", - .gpio = AT91_PIN_PB18, + { /* default status LED */ + .name = "led-a", + .gpio = AT91_PIN_PA24, + .active_low = 1, .default_trigger = "heartbeat", }, - { /* "right" led, red, userled2 */ - .name = "d2", - .gpio = AT91_PIN_PD21, - .active_low = 1, - .default_trigger = "mmc0", + { + .name = "led-b", + .gpio = AT91_PIN_PA29, + .active_low = 1 + }, + { + .name = "led-c", + .gpio = AT91_PIN_PA25, + .active_low = 1 + }, + { + .name = "led-d", + .gpio = AT91_PIN_PA26, + .active_low = 1 + }, + { + .name = "led-e", + .gpio = AT91_PIN_PA27, + .active_low = 1 }, + { + .name = "led-f", + .gpio = AT91_PIN_PA28, + .active_low = 1 + }, +}; + + +uint8_t mts_id_eeprom[512]; +uint8_t mts_dc_eeprom[512]; + +EXPORT_SYMBOL(mts_id_eeprom); +EXPORT_SYMBOL(mts_dc_eeprom); + +/* + * On-board EEPROM + */ +static void mts_id_eeprom_load(struct memory_accessor *macc, void *context) +{ + int tmp; + + memset(mts_id_eeprom, 0, sizeof(mts_id_eeprom)); + + tmp = macc->read(macc, mts_id_eeprom, 0, sizeof(mts_id_eeprom)); + if (tmp != sizeof(mts_id_eeprom)) { + printk(KERN_ERR "sam9x5: id eeprom read failed: %d\n", tmp); + } else { + printk(KERN_INFO "sam9x5: read %d bytes from id eeprom\n", tmp); + } +} + +static struct at24_platform_data at24c04_data = { + .byte_len = SZ_4K / 8, + .page_size = 16, + .setup = mts_id_eeprom_load, +}; + +/* + * Daughter card EEPROM + */ +static void mts_dc_eeprom_load(struct memory_accessor *macc, void *context) +{ + int tmp; + + memset(mts_dc_eeprom, 0, sizeof(mts_id_eeprom)); + + tmp = macc->read(macc, mts_dc_eeprom, 0, sizeof(mts_dc_eeprom)); + if (tmp != sizeof(mts_dc_eeprom)) { + printk(KERN_INFO "sam9x5: dc eeprom read failed: %d\n", tmp); + } else { + printk(KERN_INFO "sam9x5: read %d bytes from dc eeprom\n", tmp); + } +} + +static struct at24_platform_data dc_data = { + .byte_len = SZ_4K / 8, + .page_size = 16, + .setup = mts_dc_eeprom_load, }; /* @@ -207,7 +351,12 @@ */ static struct i2c_board_info __initdata cm_i2c_devices[] = { { - I2C_BOARD_INFO("24c512", 0x50) + I2C_BOARD_INFO("24c04", 0x56), + .platform_data = &at24c04_data, + }, + { + I2C_BOARD_INFO("24c04", 0x50), + .platform_data = &dc_data, }, }; @@ -234,8 +383,12 @@ /* LEDs */ at91_gpio_leds(cm_leds, ARRAY_SIZE(cm_leds)); + printk(KERN_CRIT "AT91: MTOCGD2 board\n"); + + /* MTOCGD2: disable if (cm_is_revA()) printk(KERN_CRIT "AT91: CM rev A\n"); else printk(KERN_CRIT "AT91: CM rev B and higher\n"); + */ } Index: git/arch/arm/mach-at91/board-sam9x5ek.c =================================================================== --- git.orig/arch/arm/mach-at91/board-sam9x5ek.c 2013-12-27 14:27:13.000000000 -0600 +++ git/arch/arm/mach-at91/board-sam9x5ek.c 2014-02-06 15:18:45.409321681 -0600 @@ -23,6 +23,7 @@ #include #include #include +#include #include #include