Stefan Agner c9857ad52a vf6xx: calculate core clocks
Extend the clock controller module with a function to calculate
core clocks from the current registers settings. On Vybrid, we
assume that the core clocks are setup by the main operating system
running on the Cortex-A5. Nevertheless we need to know their actual
values in order to calculate other clocks or baud rates.

Verified on a Colibri VF61, which calculates following values:
ccm_core_clk: 500210526
ccm_platform_bus_clk: 166736842
ccm_ipg_bus_clk: 83368421
2014-10-15 19:31:02 +02:00

56 lines
1.8 KiB
C

/*
* This file is part of the libopencm3 project.
*
* Copyright (C) 2014 Stefan Agner <stefan@agner.ch>
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This library 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBOPENCM3_MEMORYMAP_H
#define LIBOPENCM3_MEMORYMAP_H
#include <libopencm3/cm3/memorymap.h>
/* --- VF6xx specific peripheral definitions ----------------------------- */
/* Memory map for all busses */
#define PERIPH_BASE (0x40000000U)
#define PERIPH_BASE_AIPS0 (PERIPH_BASE + 0x00000)
#define PERIPH_BASE_AIPS1 (PERIPH_BASE + 0x80000)
/* Pheripheral addresses */
/* AIPS0 */
#define MSCM_BASE (PERIPH_BASE_AIPS0 + 0x01000)
#define SEMA4_BASE (PERIPH_BASE_AIPS0 + 0x1D000)
#define UART0_BASE (PERIPH_BASE_AIPS0 + 0x27000)
#define UART1_BASE (PERIPH_BASE_AIPS0 + 0x28000)
#define UART2_BASE (PERIPH_BASE_AIPS0 + 0x29000)
#define UART3_BASE (PERIPH_BASE_AIPS0 + 0x2A000)
#define SPI0_BASE (PERIPH_BASE_AIPS0 + 0x2C000)
#define SPI1_BASE (PERIPH_BASE_AIPS0 + 0x2D000)
#define ANADIG_BASE (PERIPH_BASE_AIPS0 + 0x50000)
#define CCM_BASE (PERIPH_BASE_AIPS0 + 0x6B000)
/* AIPS1 */
#define UART4_BASE (PERIPH_BASE_AIPS1 + 0x29000)
#define UART5_BASE (PERIPH_BASE_AIPS1 + 0x2A000)
#endif