fix non-working mvBL-M7
[oweals/u-boot.git] / include / asm-avr32 / arch-at32ap700x / clk.h
index 7e20d97b7f94132819ba737b0fa1421401d3eeb6..a9d8431a66c84d3ce326ccf7717356c56c9f4898 100644 (file)
@@ -22,6 +22,8 @@
 #ifndef __ASM_AVR32_ARCH_CLK_H__
 #define __ASM_AVR32_ARCH_CLK_H__
 
+#include <asm/arch/chip-features.h>
+
 #ifdef CONFIG_PLL
 #define MAIN_CLK_RATE ((CFG_OSC0_HZ / CFG_PLL0_DIV) * CFG_PLL0_MUL)
 #else
@@ -50,10 +52,13 @@ static inline unsigned long get_sdram_clk_rate(void)
 {
        return get_hsb_clk_rate();
 }
+#ifdef AT32AP700x_CHIP_HAS_USART
 static inline unsigned long get_usart_clk_rate(unsigned int dev_id)
 {
        return get_pba_clk_rate();
 }
+#endif
+#ifdef AT32AP700x_CHIP_HAS_MACB
 static inline unsigned long get_macb_pclk_rate(unsigned int dev_id)
 {
        return get_pbb_clk_rate();
@@ -62,9 +67,23 @@ static inline unsigned long get_macb_hclk_rate(unsigned int dev_id)
 {
        return get_hsb_clk_rate();
 }
+#endif
+#ifdef AT32AP700x_CHIP_HAS_MMCI
 static inline unsigned long get_mci_clk_rate(void)
 {
        return get_pbb_clk_rate();
 }
+#endif
+#ifdef AT32AP700x_CHIP_HAS_SPI
+static inline unsigned long get_spi_clk_rate(unsigned int dev_id)
+{
+       return get_pba_clk_rate();
+}
+#endif
+
+extern void clk_init(void);
+
+/* Board code may need the SDRAM base clock as a compile-time constant */
+#define SDRAMC_BUS_HZ  (MAIN_CLK_RATE >> CFG_CLKDIV_HSB)
 
 #endif /* __ASM_AVR32_ARCH_CLK_H__ */