2013-04-29 14:53:49 +02:00
|
|
|
/*
|
|
|
|
* \brief Clock control module register description
|
|
|
|
* \author Nikolay Golikov <nik@ksyslabs.org>
|
|
|
|
* \author Stefan Kalkowski <stefan.kalkowski@genode-labs.com>
|
|
|
|
* \date 2013-04-29
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2017-02-13 20:51:27 +01:00
|
|
|
* Copyright (C) 2013-2017 Genode Labs GmbH
|
2013-04-29 14:53:49 +02:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
2017-02-20 13:23:52 +01:00
|
|
|
* under the terms of the GNU Affero General Public License version 3.
|
2013-04-29 14:53:49 +02:00
|
|
|
*/
|
|
|
|
|
2015-09-03 14:55:05 +02:00
|
|
|
#ifndef _DRIVERS__PLATFORM__SPEC__IMX53__CCM_H_
|
|
|
|
#define _DRIVERS__PLATFORM__SPEC__IMX53__CCM_H_
|
2013-04-29 14:53:49 +02:00
|
|
|
|
|
|
|
/* Genode includes */
|
|
|
|
#include <util/mmio.h>
|
2017-04-28 15:27:26 +02:00
|
|
|
#include <drivers/defs/imx53.h>
|
2017-01-30 11:35:12 +01:00
|
|
|
#include <base/attached_io_mem_dataspace.h>
|
2013-04-29 14:53:49 +02:00
|
|
|
|
|
|
|
class Ccm : public Genode::Attached_io_mem_dataspace,
|
|
|
|
Genode::Mmio
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Control divider register
|
|
|
|
*/
|
|
|
|
struct Ccdr : Register<0x4, 32>
|
|
|
|
{
|
|
|
|
struct Ipu_hs_mask : Bitfield <21, 1> { };
|
|
|
|
};
|
|
|
|
|
2013-04-30 15:19:18 +02:00
|
|
|
/**
|
|
|
|
* Serial Clock Multiplexer Register 2
|
|
|
|
*/
|
|
|
|
struct Cscmr2 : Register<0x20, 32> {};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* D1 Clock Divider Register
|
|
|
|
*/
|
|
|
|
struct Cdcdr : Register<0x30, 32> {};
|
|
|
|
|
2013-04-29 14:53:49 +02:00
|
|
|
/**
|
|
|
|
* Low power control register
|
|
|
|
*/
|
|
|
|
struct Clpcr : Register<0x54, 32>
|
|
|
|
{
|
|
|
|
struct Bypass_ipu_hs : Bitfield<18, 1> { };
|
|
|
|
};
|
|
|
|
|
2013-05-07 12:10:47 +02:00
|
|
|
struct Ccgr1 : Register<0x6c, 32>
|
|
|
|
{
|
|
|
|
struct I2c_1 : Bitfield<18, 2> { };
|
|
|
|
struct I2c_2 : Bitfield<20, 2> { };
|
|
|
|
struct I2c_3 : Bitfield<22, 2> { };
|
|
|
|
};
|
|
|
|
|
2013-04-30 15:19:18 +02:00
|
|
|
struct Ccgr5 : Register<0x7c, 32>
|
2013-04-29 14:53:49 +02:00
|
|
|
{
|
2013-05-07 12:10:47 +02:00
|
|
|
struct Ipu : Bitfield<10, 2> { };
|
2013-04-29 14:53:49 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2017-02-13 20:03:28 +01:00
|
|
|
Ccm(Genode::Env &env)
|
2017-04-28 15:27:26 +02:00
|
|
|
: Genode::Attached_io_mem_dataspace(env, Imx53::CCM_BASE,
|
|
|
|
Imx53::CCM_SIZE),
|
2013-05-07 12:10:47 +02:00
|
|
|
Genode::Mmio((Genode::addr_t)local_addr<void>()) { }
|
|
|
|
|
|
|
|
void i2c_1_enable(void) { write<Ccgr1::I2c_1>(3); }
|
|
|
|
void i2c_2_enable(void) { write<Ccgr1::I2c_2>(3); }
|
|
|
|
void i2c_3_enable(void) { write<Ccgr1::I2c_3>(3); }
|
2013-04-29 14:53:49 +02:00
|
|
|
|
|
|
|
void ipu_clk_enable(void)
|
|
|
|
{
|
2013-05-07 12:10:47 +02:00
|
|
|
write<Ccgr5::Ipu>(3);
|
2013-04-29 14:53:49 +02:00
|
|
|
write<Ccdr::Ipu_hs_mask>(0);
|
|
|
|
write<Clpcr::Bypass_ipu_hs>(0);
|
2013-04-30 15:19:18 +02:00
|
|
|
write<Cscmr2>(0xa2b32f0b);
|
|
|
|
write<Cdcdr>(0x14370092);
|
2013-04-29 14:53:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ipu_clk_disable(void)
|
|
|
|
{
|
2013-05-07 12:10:47 +02:00
|
|
|
write<Ccgr5::Ipu>(0);
|
2013-04-29 14:53:49 +02:00
|
|
|
write<Ccdr::Ipu_hs_mask>(1);
|
|
|
|
write<Clpcr::Bypass_ipu_hs>(1);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-09-03 14:55:05 +02:00
|
|
|
#endif /* _DRIVERS__PLATFORM__SPEC__IMX53__CCM_H_ */
|