Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

U-Boot for Acme Systems Arietta G25 based on the linux4sam_5.3 version #5

Merged
merged 4 commits into from
Aug 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions arch/arm/mach-at91/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ config TARGET_VINCO
select CPU_V7
select SUPPORT_SPL

config TARGET_ARIETTA_G25
bool "Acme Systems Arietta-G25 board"
select CPU_ARM926EJS
select SUPPORT_SPL

endchoice

config SYS_SOC
Expand Down Expand Up @@ -162,5 +167,6 @@ source "board/ronetix/pm9g45/Kconfig"
source "board/siemens/corvus/Kconfig"
source "board/siemens/taurus/Kconfig"
source "board/siemens/smartweb/Kconfig"
source "board/acmesystems/arietta_g25/Kconfig"

endif
15 changes: 15 additions & 0 deletions board/acmesystems/arietta_g25/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
if TARGET_ARIETTA_G25

config SYS_BOARD
default "arietta_g25"

config SYS_VENDOR
default "acmesystems"

config SYS_SOC
default "at91"

config SYS_CONFIG_NAME
default "arietta_g25"

endif
7 changes: 7 additions & 0 deletions board/acmesystems/arietta_g25/MAINTAINERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ACME SYSTEMS ARIETTA-G25 BOARD
M: Biagio Montaruli <[email protected]>
S: Maintained
F: board/acmesystems/arietta_g25/
F: include/configs/arietta_g25.h
F: configs/arietta_g25_128mb_defconfig
F: configs/arietta_g25_256mb_defconfig
19 changes: 19 additions & 0 deletions board/acmesystems/arietta_g25/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# (C) Copyright 2003-2008
# Wolfgang Denk, DENX Software Engineering, [email protected].
#
# (C) Copyright 2008
# Stelian Pop <[email protected]>
# Lead Tech Design <www.leadtechdesign.com>
#
# (C) Copyright 2012
# Bo Shen <[email protected]>
# Atmel corporation <www.atmel.com>
#
# (C) Copyright 2016
# Biagio Montaruli <[email protected]>
#
# SPDX-License-Identifier: GPL-2.0+
#

obj-y += arietta_g25.o
174 changes: 174 additions & 0 deletions board/acmesystems/arietta_g25/arietta_g25.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
/*
* Copyright (C) 2012 Atmel Corporation
*
* Based on at91sam9x5ek.c and modified by Biagio Montaruli <[email protected]>
* in order to configure U-Boot for Arietta-G25 SOM <http://www.acmesystems.it/arietta>
*
* SPDX-License-Identifier: GPL-2.0+
*/

#include <common.h>
#include <asm/io.h>
#include <asm/arch/at91sam9x5_matrix.h>
#include <asm/arch/at91sam9_smc.h>
#include <asm/arch/at91_common.h>
#include <asm/arch/at91_rstc.h>
#include <asm/arch/clk.h>
#include <asm/arch/gpio.h>
#include <atmel_mci.h>
#include <netdev.h>
#ifdef CONFIG_ATMEL_SPI
#include <spi.h>
#endif

DECLARE_GLOBAL_DATA_PTR;

/* ------------------------------------------------------------------------- */
/*
* Miscelaneous platform dependent initialisations
*/

/* SPI chip select control */
#ifdef CONFIG_ATMEL_SPI
int spi_cs_is_valid(unsigned int bus, unsigned int cs)
{
return bus == 0 && cs < 2;
}

void spi_cs_activate(struct spi_slave *slave)
{
switch (slave->cs) {
case 1:
at91_set_pio_output(AT91_PIO_PORTA, 7, 0);
break;
case 0:
default:
at91_set_pio_output(AT91_PIO_PORTA, 14, 0);
break;
}
}

void spi_cs_deactivate(struct spi_slave *slave)
{
switch (slave->cs) {
case 1:
at91_set_pio_output(AT91_PIO_PORTA, 7, 1);
break;
case 0:
default:
at91_set_pio_output(AT91_PIO_PORTA, 14, 1);
break;
}
}
#endif /* CONFIG_ATMEL_SPI */

#ifdef CONFIG_GENERIC_ATMEL_MCI
int board_mmc_init(bd_t *bd)
{
at91_mci_hw_init();

return atmel_mci_init((void *)ATMEL_BASE_HSMCI0);
}
#endif

int board_early_init_f(void)
{
at91_seriald_hw_init();
return 0;
}

int board_init(void)
{
/* arch number of AT91SAM9X5EK-Board */
gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9X5EK;

/* adress of boot parameters */
gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;

#ifdef CONFIG_ATMEL_SPI
at91_spi0_hw_init(1 << 4);
#endif

#if defined(CONFIG_USB_OHCI_NEW) || defined(CONFIG_USB_EHCI)
at91_uhp_hw_init();
#endif
return 0;
}

int dram_init(void)
{
gd->ram_size = get_ram_size((void *) CONFIG_SYS_SDRAM_BASE,
CONFIG_SYS_SDRAM_SIZE);
return 0;
}

#if defined(CONFIG_SPL_BUILD)
#include <spl.h>

void at91_spl_board_init(void)
{
#ifdef CONFIG_SYS_USE_MMC
at91_mci_hw_init();
#elif CONFIG_SYS_USE_SPIFLASH
at91_spi0_hw_init(1 << 4);
#endif
}

#include <asm/arch/atmel_mpddrc.h>
static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
{
ddr2->md = (ATMEL_MPDDRC_MD_DBW_16_BITS | ATMEL_MPDDRC_MD_DDR2_SDRAM);

ddr2->cr = (ATMEL_MPDDRC_CR_NC_COL_10 |
ATMEL_MPDDRC_CR_NR_ROW_13 |
ATMEL_MPDDRC_CR_CAS_DDR_CAS3 |
ATMEL_MPDDRC_CR_NB_8BANKS |
ATMEL_MPDDRC_CR_DECOD_INTERLEAVED);

ddr2->rtr = 0x411;

ddr2->tpr0 = (6 << ATMEL_MPDDRC_TPR0_TRAS_OFFSET |
2 << ATMEL_MPDDRC_TPR0_TRCD_OFFSET |
2 << ATMEL_MPDDRC_TPR0_TWR_OFFSET |
8 << ATMEL_MPDDRC_TPR0_TRC_OFFSET |
2 << ATMEL_MPDDRC_TPR0_TRP_OFFSET |
2 << ATMEL_MPDDRC_TPR0_TRRD_OFFSET |
2 << ATMEL_MPDDRC_TPR0_TWTR_OFFSET |
2 << ATMEL_MPDDRC_TPR0_TMRD_OFFSET);

ddr2->tpr1 = (2 << ATMEL_MPDDRC_TPR1_TXP_OFFSET |
200 << ATMEL_MPDDRC_TPR1_TXSRD_OFFSET |
19 << ATMEL_MPDDRC_TPR1_TXSNR_OFFSET |
18 << ATMEL_MPDDRC_TPR1_TRFC_OFFSET);

ddr2->tpr2 = (7 << ATMEL_MPDDRC_TPR2_TFAW_OFFSET |
2 << ATMEL_MPDDRC_TPR2_TRTP_OFFSET |
3 << ATMEL_MPDDRC_TPR2_TRPA_OFFSET |
7 << ATMEL_MPDDRC_TPR2_TXARDS_OFFSET |
2 << ATMEL_MPDDRC_TPR2_TXARD_OFFSET);
}

void mem_init(void)
{
struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
struct at91_matrix *matrix = (struct at91_matrix *)ATMEL_BASE_MATRIX;
struct atmel_mpddrc_config ddr2;
unsigned long csa;

ddr2_conf(&ddr2);

/* enable DDR2 clock */
writel(AT91_PMC_DDR, &pmc->scer);

/* Chip select 1 is for DDR2/SDRAM */
csa = readl(&matrix->ebicsa);
csa |= AT91_MATRIX_EBI_CS1A_SDRAMC;
csa &= ~AT91_MATRIX_EBI_DBPU_OFF;
csa |= AT91_MATRIX_EBI_DBPD_OFF;
csa |= AT91_MATRIX_EBI_EBI_IOSR_NORMAL;
writel(csa, &matrix->ebicsa);

/* DDRAM2 Controller initialize */
ddr2_init(ATMEL_BASE_DDRSDRC, ATMEL_BASE_CS1, &ddr2);
}
#endif
11 changes: 11 additions & 0 deletions configs/arietta_g25_128mb_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CONFIG_ARM=y
CONFIG_ARCH_AT91=y
CONFIG_TARGET_ARIETTA_G25=y
CONFIG_SYS_EXTRA_OPTIONS="AT91SAM9X5,SYS_USE_MMC,RAM_128MB"
CONFIG_SYS_PROMPT="U-Boot> "
CONFIG_AUTOBOOT_KEYED=y
CONFIG_AUTOBOOT_PROMPT="Press SPACE to abort autoboot in %d seconds\n"
CONFIG_AUTOBOOT_DELAY_STR="d"
CONFIG_AUTOBOOT_STOP_STR=" "
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_ATMEL=y
11 changes: 11 additions & 0 deletions configs/arietta_g25_256mb_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CONFIG_ARM=y
CONFIG_ARCH_AT91=y
CONFIG_TARGET_ARIETTA_G25=y
CONFIG_SYS_EXTRA_OPTIONS="AT91SAM9X5,SYS_USE_MMC,RAM_256MB"
CONFIG_SYS_PROMPT="U-Boot> "
CONFIG_AUTOBOOT_KEYED=y
CONFIG_AUTOBOOT_PROMPT="Press SPACE to abort autoboot in %d seconds\n"
CONFIG_AUTOBOOT_DELAY_STR="d"
CONFIG_AUTOBOOT_STOP_STR=" "
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_ATMEL=y
Loading