]> git.sur5r.net Git - u-boot/blobdiff - board/mini-box/picosam9g45/picosam9g45.c
Merge git://git.denx.de/u-boot-usb
[u-boot] / board / mini-box / picosam9g45 / picosam9g45.c
index afbd6ce59988a09a99c79557790e765b11443144..09ec24766333293bac0ea6f7c54414ee8f099b2a 100644 (file)
@@ -17,7 +17,6 @@
 #include <asm/arch/at91sam9g45_matrix.h>
 #include <asm/arch/at91sam9_smc.h>
 #include <asm/arch/at91_common.h>
-#include <asm/arch/at91_pmc.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/clk.h>
 #include <lcd.h>
@@ -28,6 +27,7 @@
 #include <net.h>
 #endif
 #include <netdev.h>
+#include <asm/mach-types.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -47,7 +47,7 @@ void at91_spl_board_init(void)
 }
 
 #include <asm/arch/atmel_mpddrc.h>
-static void ddr2_conf(struct atmel_mpddr *ddr2)
+static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
 {
        ddr2->md = (ATMEL_MPDDRC_MD_DBW_16_BITS | ATMEL_MPDDRC_MD_DDR2_SDRAM);
 
@@ -80,15 +80,13 @@ static void ddr2_conf(struct atmel_mpddr *ddr2)
 
 void mem_init(void)
 {
-       struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
        struct at91_matrix *mat = (struct at91_matrix *)ATMEL_BASE_MATRIX;
-       struct atmel_mpddr ddr2;
+       struct atmel_mpddrc_config ddr2;
        unsigned long csa;
 
        ddr2_conf(&ddr2);
 
-       /* enable DDR2 clock */
-       writel(AT91_PMC_DDR, &pmc->scer);
+       at91_system_clk_enable(AT91_PMC_DDR);
 
        /* Chip select 1 is for DDR2/SDRAM */
        csa = readl(&mat->ebicsa);
@@ -105,9 +103,7 @@ void mem_init(void)
 #ifdef CONFIG_CMD_USB
 static void picosam9g45_usb_hw_init(void)
 {
-       struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
-
-       writel(1 << ATMEL_ID_PIODE, &pmc->pcer);
+       at91_periph_clk_enable(ATMEL_ID_PIODE);
 
        at91_set_gpio_output(AT91_PIN_PD1, 0);
        at91_set_gpio_output(AT91_PIN_PD3, 0);
@@ -117,11 +113,9 @@ static void picosam9g45_usb_hw_init(void)
 #ifdef CONFIG_MACB
 static void picosam9g45_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_EMAC, &pmc->pcer);
+       at91_periph_clk_enable(ATMEL_ID_EMAC);
 
        /*
         * Disable pull-up on:
@@ -181,8 +175,6 @@ void lcd_disable(void)
 
 static void picosam9g45_lcd_hw_init(void)
 {
-       struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
-
        at91_set_A_periph(AT91_PIN_PE0, 0);     /* LCDDPWR */
        at91_set_A_periph(AT91_PIN_PE2, 0);     /* LCDCC */
        at91_set_A_periph(AT91_PIN_PE3, 0);     /* LCDVSYNC */
@@ -214,7 +206,7 @@ static void picosam9g45_lcd_hw_init(void)
        at91_set_A_periph(AT91_PIN_PE29, 0);    /* LCDD22 */
        at91_set_A_periph(AT91_PIN_PE30, 0);    /* LCDD23 */
 
-       writel(1 << ATMEL_ID_LCDC, &pmc->pcer);
+       at91_periph_clk_enable(ATMEL_ID_LCDC);
 
        gd->fb_base = CONFIG_AT91SAM9G45_LCD_BASE;
 }
@@ -292,7 +284,7 @@ int dram_init(void)
        return 0;
 }
 
-void dram_init_banksize(void)
+int dram_init_banksize(void)
 {
        gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
        gd->bd->bi_dram[0].size = get_ram_size((long *)PHYS_SDRAM_1,
@@ -300,6 +292,8 @@ void dram_init_banksize(void)
        gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
        gd->bd->bi_dram[1].size = get_ram_size((long *)PHYS_SDRAM_2,
                                                        PHYS_SDRAM_2_SIZE);
+
+       return 0;
 }
 
 #ifdef CONFIG_RESET_PHY_R