]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/atmel/at91sam9n12ek/at91sam9n12ek.c
Merge git://git.denx.de/u-boot-arm
[karo-tx-uboot.git] / board / atmel / at91sam9n12ek / at91sam9n12ek.c
index 8752794c8435f2e242a50966b9778fdc54a3d889..2ec32ebc21d6b5ab523ccc02d1a7b05af7e1e21b 100644 (file)
@@ -2,23 +2,7 @@
  * (C) Copyright 2013 Atmel Corporation
  * Josh Wu <josh.wu@atmel.com>
  *
- * 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>
@@ -33,6 +17,7 @@
 #include <lcd.h>
 #include <atmel_hlcdc.h>
 #include <atmel_mci.h>
+#include <netdev.h>
 
 #ifdef CONFIG_LCD_INFO
 #include <nand.h>
@@ -58,7 +43,7 @@ static void at91sam9n12ek_nand_hw_init(void)
        /* Configure databus */
        csa &= ~AT91_MATRIX_NFD0_ON_D16; /* nandflash connect to D0~D15 */
        /* Configure IO drive */
-       csa &= ~AT91_MATRIX_EBI_EBI_IOSR_NORMAL;
+       csa |= AT91_MATRIX_EBI_EBI_IOSR_NORMAL;
 
        writel(csa, &matrix->ebicsa);
 
@@ -190,6 +175,30 @@ int board_mmc_init(bd_t *bd)
 }
 #endif
 
+#ifdef CONFIG_KS8851_MLL
+void at91sam9n12ek_ks8851_hw_init(void)
+{
+       struct at91_smc *smc = (struct at91_smc *)ATMEL_BASE_SMC;
+
+       writel(AT91_SMC_SETUP_NWE(2) | AT91_SMC_SETUP_NCS_WR(0) |
+              AT91_SMC_SETUP_NRD(1) | AT91_SMC_SETUP_NCS_RD(0),
+              &smc->cs[2].setup);
+       writel(AT91_SMC_PULSE_NWE(7) | AT91_SMC_PULSE_NCS_WR(7) |
+              AT91_SMC_PULSE_NRD(7) | AT91_SMC_PULSE_NCS_RD(7),
+              &smc->cs[2].pulse);
+       writel(AT91_SMC_CYCLE_NWE(9) | AT91_SMC_CYCLE_NRD(9),
+              &smc->cs[2].cycle);
+       writel(AT91_SMC_MODE_RM_NRD | AT91_SMC_MODE_WM_NWE |
+              AT91_SMC_MODE_EXNW_DISABLE |
+              AT91_SMC_MODE_BAT | AT91_SMC_MODE_DBW_16 |
+              AT91_SMC_MODE_TDF_CYCLE(1),
+              &smc->cs[2].mode);
+
+       /* Configure NCS2 PIN */
+       at91_set_b_periph(AT91_PIO_PORTD, 19, 0);
+}
+#endif
+
 int board_early_init_f(void)
 {
        /* Enable clocks for all PIOs */
@@ -217,9 +226,20 @@ int board_init(void)
        at91_lcd_hw_init();
 #endif
 
+#ifdef CONFIG_KS8851_MLL
+       at91sam9n12ek_ks8851_hw_init();
+#endif
+
        return 0;
 }
 
+#ifdef CONFIG_KS8851_MLL
+int board_eth_init(bd_t *bis)
+{
+       return ks8851_mll_initialize(0, CONFIG_KS8851_MLL_BASEADDR);
+}
+#endif
+
 int dram_init(void)
 {
        gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,