* BuS Elektronik GmbH & Co. KG <www.bus-elektronik.de>
* Jens Scharsig <esw@bus-elektronik.de>
*
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
#include <asm/arch/at91_pio.h>
#include <asm/arch/at91_pmc.h>
#include <asm/arch/at91_mc.h>
+#include <asm/arch/at91_common.h>
#ifdef CONFIG_STATUS_LED
#include <status_led.h>
int board_init(void)
{
- at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
- /* Enable Ctrlc */
- console_init_f();
+ at91_pio_t *pio = (at91_pio_t *) ATMEL_BASE_PIO;
/* Correct IRDA resistor problem / Set PA23_TXD in Output */
- writel(AT91_PMX_AA_TXD2, &pio->pioa.oer);
+ writel(ATMEL_PMX_AA_TXD2, &pio->pioa.oer);
gd->bd->bi_arch_number = MACH_TYPE_EB_CPUX9K2;
/* adress of boot parameters */
- gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
+ gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
#ifdef CONFIG_STATUS_LED
status_led_set(STATUS_LED_BOOT, STATUS_LED_ON);
return 0;
}
+int board_early_init_f(void)
+{
+ at91_seriald_hw_init();
+ return 0;
+}
+
#ifdef CONFIG_MISC_INIT_R
int misc_init_r(void)
uchar midx;
uchar macn6, macn7;
-#ifdef CONFIG_NET_MULTI
if (getenv("ethaddr") == NULL) {
if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0x00,
CONFIG_SYS_I2C_EEPROM_ADDR_LEN,
puts("Error: invalid MAC at EEPROM\n");
}
}
-#endif
- gd->jt[XF_do_reset] = (void *) do_reset;
+ gd->jt->do_reset = do_reset;
#ifdef CONFIG_STATUS_LED
status_led_set(STATUS_LED_BOOT, STATUS_LED_BLINKING);
void reset_phy(void)
{
udelay(10000);
- eth_init(gd->bd);
+ eth_init();
}
#endif
int dram_init(void)
{
- gd->bd->bi_dram[0].start = PHYS_SDRAM;
- gd->bd->bi_dram[0].size =
- get_ram_size((volatile long *) PHYS_SDRAM, PHYS_SDRAM_SIZE);
+ gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE,
+ CONFIG_SYS_SDRAM_SIZE);
return 0;
}
int board_eth_init(bd_t *bis)
{
int rc = 0;
- rc = at91emac_register(bis, (u32) AT91_EMAC_BASE);
+ rc = at91emac_register(bis, (u32) ATMEL_BASE_EMAC);
return rc;
}
#endif
void cpux9k2_nand_hw_init(void)
{
unsigned long csr;
- at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
- at91_pmc_t *pmc = (at91_pmc_t *) AT91_PMC_BASE;
- at91_mc_t *mc = (at91_mc_t *) AT91_MC_BASE;
+ at91_pio_t *pio = (at91_pio_t *) ATMEL_BASE_PIO;
+ at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC;
+ at91_mc_t *mc = (at91_mc_t *) ATMEL_BASE_MC;
/* Setup Smart Media, fitst enable the address range of CS3 */
writel(readl(&mc->ebi.csa) | AT91_EBI_CSA_CS3A, &mc->ebi.csa);
AT91_SMC_CSR_WSEN;
writel(csr, &mc->smc.csr[3]);
- writel(AT91_PMX_CA_SMOE | AT91_PMX_CA_SMWE, &pio->pioc.asr);
- writel(AT91_PMX_CA_BFCK | AT91_PMX_CA_SMOE | AT91_PMX_CA_SMWE,
+ writel(ATMEL_PMX_CA_SMOE | ATMEL_PMX_CA_SMWE, &pio->pioc.asr);
+ writel(ATMEL_PMX_CA_BFCK | ATMEL_PMX_CA_SMOE | ATMEL_PMX_CA_SMWE,
&pio->pioc.pdr);
/* Configure PC2 as input (signal Nand READY ) */
- writel(AT91_PMX_CA_BFAVD, &pio->pioc.per);
- writel(AT91_PMX_CA_BFAVD, &pio->pioc.odr); /* disable output */
- writel(AT91_PMX_CA_BFCK, &pio->pioc.codr);
+ writel(ATMEL_PMX_CA_BFAVD, &pio->pioc.per);
+ writel(ATMEL_PMX_CA_BFAVD, &pio->pioc.odr); /* disable output */
+ writel(ATMEL_PMX_CA_BFCK, &pio->pioc.codr);
/* PIOC clock enabling */
- writel(1 << AT91_ID_PIOC, &pmc->pcer);
+ writel(1 << ATMEL_ID_PIOC, &pmc->pcer);
}
static void board_nand_hwcontrol(struct mtd_info *mtd,
int cmd, unsigned int ctrl)
{
- at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
+ at91_pio_t *pio = (at91_pio_t *) ATMEL_BASE_PIO;
struct nand_chip *this = mtd->priv;
ulong IO_ADDR_W = (ulong) this->IO_ADDR_W;
static int board_nand_dev_ready(struct mtd_info *mtd)
{
- at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
+ at91_pio_t *pio = (at91_pio_t *) ATMEL_BASE_PIO;
return ((readl(&pio->pioc.pdsr) & (1 << 2)) != 0);
}
#endif
char *s;
unsigned long csr;
- at91_pmc_t *pmc = (at91_pmc_t *) AT91_PMC_BASE;
- at91_mc_t *mc = (at91_mc_t *) AT91_MC_BASE;
+ at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC;
+ at91_mc_t *mc = (at91_mc_t *) ATMEL_BASE_MC;
printf("Init Video as ");
s = getenv("displaywidth");
display_height = 256;
printf("%ld x %ld pixel matrix\n", display_width, display_height);
- /* RWH = 7 | RWS =7 | TDF = 15 | NWS = 0x7F */
- csr = AT91_SMC_CSR_RWHOLD(7) | AT91_SMC_CSR_RWSETUP(7) |
- AT91_SMC_CSR_TDF(15) | AT91_SMC_CSR_NWS(127) |
+ /* RWH = 2 | RWS =2 | TDF = 4 | NWS = 0x6 */
+ csr = AT91_SMC_CSR_RWHOLD(2) | AT91_SMC_CSR_RWSETUP(2) |
+ AT91_SMC_CSR_TDF(4) | AT91_SMC_CSR_NWS(6) |
AT91_SMC_CSR_ACSS_STANDARD | AT91_SMC_CSR_DBW_16 |
AT91_SMC_CSR_BAT_16 | AT91_SMC_CSR_WSEN;
writel(csr, &mc->smc.csr[2]);
- writel(1 << AT91_ID_PIOB, &pmc->pcer);
+ writel(1 << ATMEL_ID_PIOB, &pmc->pcer);
vcxk_init(display_width, display_height);
#ifdef CONFIG_SPLASH_SCREEN
}
#endif
-#ifdef CONFIG_SOFT_I2C
+#ifdef CONFIG_SYS_I2C_SOFT
void i2c_init_board(void)
{
u32 pin;
- at91_pmc_t *pmc = (at91_pmc_t *) AT91_PMC_BASE;
- at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
+ at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC;
+ at91_pio_t *pio = (at91_pio_t *) ATMEL_BASE_PIO;
- writel(1 << AT91_ID_PIOA, &pmc->pcer);
- pin = AT91_PMX_AA_TWD | AT91_PMX_AA_TWCK;
+ writel(1 << ATMEL_ID_PIOA, &pmc->pcer);
+ pin = ATMEL_PMX_AA_TWD | ATMEL_PMX_AA_TWCK;
writel(pin, &pio->pioa.idr);
writel(pin, &pio->pioa.pudr);
writel(pin, &pio->pioa.per);
void __led_toggle(led_id_t mask)
{
- at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
+ at91_pio_t *pio = (at91_pio_t *) ATMEL_BASE_PIO;
if (readl(&pio->piod.odsr) & mask)
writel(mask, &pio->piod.codr);
void __led_init(led_id_t mask, int state)
{
- at91_pmc_t *pmc = (at91_pmc_t *) AT91_PMC_BASE;
- at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
+ at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC;
+ at91_pio_t *pio = (at91_pio_t *) ATMEL_BASE_PIO;
- writel(1 << AT91_ID_PIOD, &pmc->pcer); /* Enable PIOB clock */
+ writel(1 << ATMEL_ID_PIOD, &pmc->pcer); /* Enable PIOB clock */
/* Disable peripherals on LEDs */
writel(STATUS_LED_BIT | STATUS_LED_BIT1, &pio->piod.per);
/* Enable pins as outputs */
void __led_set(led_id_t mask, int state)
{
- at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
+ at91_pio_t *pio = (at91_pio_t *) ATMEL_BASE_PIO;
if (state == STATUS_LED_ON)
writel(mask, &pio->piod.codr);
else
/*---------------------------------------------------------------------------*/
-int do_brightness(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+int do_brightness(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
int rcode = 0;
ulong side;