Merge tag 'u-boot-atmel-fixes-2020.07-a' of https://gitlab.denx.de/u-boot/custodians...
[oweals/u-boot.git] / board / bluewater / snapper9260 / snapper9260.c
index 95633b0d2e87074fd07d6f3ddb09852ac93622c5..8e2b7e000f358d9f47ebe3e590e8d882d1ef0252 100644 (file)
@@ -1,27 +1,29 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Bluewater Systems Snapper 9260/9G20 modules
  *
  * (C) Copyright 2011 Bluewater Systems
  *   Author: Andre Renaud <andre@bluewatersys.com>
  *   Author: Ryan Mallon <ryan@bluewatersys.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <dm.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
+#include <asm/mach-types.h>
 #include <asm/arch/at91sam9260_matrix.h>
 #include <asm/arch/at91sam9_smc.h>
 #include <asm/arch/at91_common.h>
-#include <asm/arch/at91_pmc.h>
+#include <asm/arch/clk.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/atmel_serial.h>
 #include <net.h>
 #include <netdev.h>
 #include <i2c.h>
 #include <pca953x.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -31,11 +33,9 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static void macb_hw_init(void)
 {
-       struct at91_pmc *pmc   = (struct at91_pmc  *)ATMEL_BASE_PMC;
        struct at91_port *pioa = (struct at91_port *)ATMEL_BASE_PIOA;
 
-       /* Enable clock */
-       writel(1 << ATMEL_ID_EMAC0, &pmc->pcer);
+       at91_periph_clk_enable(ATMEL_ID_EMAC0);
 
        /* Disable pull-ups to prevent PHY going into test mode */
        writel(pin_to_mask(AT91_PIN_PA14) |
@@ -108,12 +108,9 @@ static void nand_hw_init(void)
 
 int board_init(void)
 {
-       struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
-
-       /* Enable PIO clocks */
-       writel((1 << ATMEL_ID_PIOA) |
-              (1 << ATMEL_ID_PIOB) |
-              (1 << ATMEL_ID_PIOC), &pmc->pcer);
+       at91_periph_clk_enable(ATMEL_ID_PIOA);
+       at91_periph_clk_enable(ATMEL_ID_PIOB);
+       at91_periph_clk_enable(ATMEL_ID_PIOC);
 
        /* The mach-type is the same for both Snapper 9260 and 9G20 */
        gd->bd->bi_arch_number = MACH_TYPE_SNAPPER_9260;