diff --git a/base/include/platform/imx53/drivers/board_base.h b/base/include/platform/imx53/drivers/board_base.h
index 4505c2103..0799b39bd 100644
--- a/base/include/platform/imx53/drivers/board_base.h
+++ b/base/include/platform/imx53/drivers/board_base.h
@@ -46,6 +46,9 @@ namespace Genode
AIPS_1_MMIO_BASE = 0x53f00000,
AIPS_2_MMIO_BASE = 0x63f00000,
+ IOMUXC_BASE = 0x53fa8000,
+ IOMUXC_SIZE = 0x00004000,
+
IPU_ERR_IRQ = 10,
IPU_SYNC_IRQ = 11,
IPU_BASE = 0x18000000,
diff --git a/os/include/platform/imx53/platform_session/capability.h b/os/include/platform/imx53/platform_session/capability.h
new file mode 100644
index 000000000..5c8fc91ed
--- /dev/null
+++ b/os/include/platform/imx53/platform_session/capability.h
@@ -0,0 +1,22 @@
+/*
+ * \brief Platform session capability type
+ * \author Stefan Kalkowski
+ * \date 2013-04-29
+ */
+
+/*
+ * Copyright (C) 2013 Genode Labs GmbH
+ *
+ * This file is part of the Genode OS framework, which is distributed
+ * under the terms of the GNU General Public License version 2.
+ */
+
+#ifndef _INCLUDE__PLATFORM_SESSION__CAPABILITY_H_
+#define _INCLUDE__PLATFORM_SESSION__CAPABILITY_H_
+
+#include
+#include
+
+namespace Platform { typedef Genode::Capability Session_capability; }
+
+#endif /* _INCLUDE__PLATFORM_SESSION__CAPABILITY_H_ */
diff --git a/os/include/platform/imx53/platform_session/client.h b/os/include/platform/imx53/platform_session/client.h
new file mode 100644
index 000000000..40bcb872e
--- /dev/null
+++ b/os/include/platform/imx53/platform_session/client.h
@@ -0,0 +1,35 @@
+/*
+ * \brief i.MX53 specific platform session client side
+ * \author Stefan Kalkowski
+#include
+#include
+
+namespace Platform {
+
+ struct Client : Genode::Rpc_client
+ {
+ explicit Client(Capability session)
+ : Genode::Rpc_client(session) { }
+
+ void enable(Device dev) { call(dev); }
+ void disable(Device dev) { call(dev); }
+ void clock_rate(Device dev, unsigned long rate) {
+ call(dev, rate); }
+ };
+}
+
+#endif /* _INCLUDE__PLATFORM_SESSION__CLIENT_H_ */
diff --git a/os/include/platform/imx53/platform_session/connection.h b/os/include/platform/imx53/platform_session/connection.h
new file mode 100644
index 000000000..d0949e909
--- /dev/null
+++ b/os/include/platform/imx53/platform_session/connection.h
@@ -0,0 +1,37 @@
+/*
+ * \brief Connection to platform service
+ * \author Stefan Kalkowski
+ * \date 2013-04-29
+ */
+
+/*
+ * Copyright (C) 2013 Genode Labs GmbH
+ *
+ * This file is part of the Genode OS framework, which is distributed
+ * under the terms of the GNU General Public License version 2.
+ */
+
+#ifndef _INCLUDE__PLATFORM_SESSION__CONNECTION_H_
+#define _INCLUDE__PLATFORM_SESSION__CONNECTION_H_
+
+#include
+#include
+#include
+
+namespace Platform {
+
+ class Connection : public Genode::Connection,
+ public Client
+ {
+ public:
+
+ /**
+ * Constructor
+ */
+ Connection()
+ : Genode::Connection(session("ram_quota=4K")),
+ Client(cap()) { }
+ };
+}
+
+#endif /* _INCLUDE__PLATFORM_SESSION__CONNECTION_H_ */
diff --git a/os/include/platform/imx53/platform_session/platform_session.h b/os/include/platform/imx53/platform_session/platform_session.h
new file mode 100644
index 000000000..3223e6912
--- /dev/null
+++ b/os/include/platform/imx53/platform_session/platform_session.h
@@ -0,0 +1,47 @@
+/*
+ * \brief i.MX53 specific platform session
+ * \author Stefan Kalkowski
+#include
+
+namespace Platform {
+
+ struct Session : Genode::Session
+ {
+ enum Device { IPU };
+
+ static const char *service_name() { return "Platform"; }
+
+ virtual ~Session() { }
+
+ virtual void enable(Device dev) = 0;
+ virtual void disable(Device dev) = 0;
+ virtual void clock_rate(Device dev, unsigned long rate) = 0;
+
+
+ /*********************
+ ** RPC declaration **
+ *********************/
+
+ GENODE_RPC(Rpc_enable, void, enable, Device);
+ GENODE_RPC(Rpc_disable, void, disable, Device);
+ GENODE_RPC(Rpc_clock_rate, void, clock_rate, Device, unsigned long);
+
+ GENODE_RPC_INTERFACE(Rpc_enable, Rpc_disable, Rpc_clock_rate);
+ };
+}
+
+#endif /* _INCLUDE__PLATFORM_SESSION__PLATFORM_SESSION_H_ */
diff --git a/os/run/demo.run b/os/run/demo.run
index 9713fdfb8..88811ced4 100644
--- a/os/run/demo.run
+++ b/os/run/demo.run
@@ -10,8 +10,9 @@ set build_components {
drivers/framebuffer drivers/pci drivers/input
}
-lappend_if [have_spec usb] build_components drivers/usb
-lappend_if [have_spec gpio] build_components drivers/gpio
+lappend_if [have_spec usb] build_components drivers/usb
+lappend_if [have_spec gpio] build_components drivers/gpio
+lappend_if [have_spec imx53] build_components drivers/platform
build $build_components
@@ -68,6 +69,14 @@ append_if [have_spec gpio] config {
}
+append_if [have_spec imx53] config {
+
+
+
+
+
+}
+
append_if [have_spec ps2] config {
@@ -116,6 +125,7 @@ lappend_if [have_spec ps2] boot_modules ps2_drv
lappend_if [have_spec framebuffer] boot_modules fb_drv
lappend_if [have_spec usb] boot_modules usb_drv
lappend_if [have_spec gpio] boot_modules gpio_drv
+lappend_if [have_spec imx53] boot_modules platform_drv
build_boot_image $boot_modules
diff --git a/os/src/drivers/framebuffer/imx53/ccm.h b/os/src/drivers/framebuffer/imx53/ccm.h
deleted file mode 100644
index 594679525..000000000
--- a/os/src/drivers/framebuffer/imx53/ccm.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * \brief Clock control module
- * \author Nikolay Golikov
- * \date 2012-10-09
- */
-
-/*
- * Copyright (C) 2012 Ksys Labs LLC
- * Copyright (C) 2012 Genode Labs GmbH
- *
- * This file is part of the Genode OS framework, which is distributed
- * under the terms of the GNU General Public License version 2.
- */
-
-#ifndef _CCM_H_
-#define _CCM_H_
-
-/* Genode includes */
-#include
-
-struct Ccm : Genode::Mmio
-{
- enum { IPU_CLK = 133000000 };
-
- /**
- * Control divider register
- */
- struct Ccdr : Register<0x4, 32>
- {
- struct Ipu_hs_mask : Bitfield <21, 1> { };
- };
-
- /**
- * Low power control register
- */
- struct Clpcr : Register<0x54, 32>
- {
- struct Bypass_ipu_hs : Bitfield<18, 1> { };
- };
-
- /**
- *
- */
- struct Cccr5 : Register<0x7c, 32>
- {
- struct Ipu_clk_en : Bitfield<10, 2> { };
- };
-
- void ipu_clk_enable(void)
- {
- write(3);
- write(0);
- write(0);
- }
-
- void ipu_clk_disable(void)
- {
- write(0);
- write(1);
- write(1);
- }
-
- Ccm(Genode::addr_t const mmio_base) : Genode::Mmio(mmio_base) { }
-
-};
-
-#endif /* _CCM_H_ */
diff --git a/os/src/drivers/framebuffer/imx53/driver.h b/os/src/drivers/framebuffer/imx53/driver.h
index dcd7cb146..1fdd46972 100644
--- a/os/src/drivers/framebuffer/imx53/driver.h
+++ b/os/src/drivers/framebuffer/imx53/driver.h
@@ -9,12 +9,11 @@
#include
#include
#include
+#include
#include
/* local includes */
#include
-#include
-#include
namespace Framebuffer {
@@ -27,18 +26,9 @@ class Framebuffer::Driver
{
private:
- /* Clocks control module */
- Attached_io_mem_dataspace _ccm_mmio;
- Ccm _ccm;
-
- /* System reset controller registers */
- Attached_io_mem_dataspace _src_mmio;
- Src _src;
-
- /* Image processing unit memory */
- Attached_io_mem_dataspace _ipu_mmio;
+ Platform::Connection _platform;
+ Attached_io_mem_dataspace _ipu_mmio; /* Image processing unit memory */
Ipu _ipu;
-
Gpio::Connection _gpio;
public:
@@ -64,19 +54,13 @@ class Framebuffer::Driver
Driver()
- : _ccm_mmio(Board_base::CCM_BASE, Board_base::CCM_SIZE),
- _ccm((addr_t)_ccm_mmio.local_addr()),
- _src_mmio(Board_base::SRC_BASE, Board_base::SRC_SIZE),
- _src((addr_t)_src_mmio.local_addr()),
- _ipu_mmio(Board_base::IPU_BASE, Board_base::IPU_SIZE),
+ : _ipu_mmio(Board_base::IPU_BASE, Board_base::IPU_SIZE),
_ipu((addr_t)_ipu_mmio.local_addr()) { }
bool init(addr_t phys_base)
{
- /* reset ipu over src */
- _src.write(1);
-
- _ccm.ipu_clk_enable();
+ /* enable IPU via platform driver */
+ _platform.enable(Platform::Session::IPU);
_ipu.init(WIDTH, HEIGHT, WIDTH * BYTES_PER_PIXEL, phys_base);
@@ -85,6 +69,5 @@ class Framebuffer::Driver
_gpio.direction_output(LCD_CONT_GPIO, true);
return true;
}
-
};
diff --git a/os/src/drivers/framebuffer/imx53/src.h b/os/src/drivers/framebuffer/imx53/src.h
deleted file mode 100644
index e0f5b57f5..000000000
--- a/os/src/drivers/framebuffer/imx53/src.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * \brief System reset controller registers
- * \author Nikolay Golikov
- * \date 2012-11-06
- */
-
-/*
- * Copyright (C) 2012 Ksys Labs LLC
- * Copyright (C) 2012 Genode Labs GmbH
- *
- * This file is part of the Genode OS framework, which is distributed
- * under the terms of the GNU General Public License version 2.
- */
-
-#ifndef _SRC_H_
-#define _SRC_H_
-
-/* Genode includes */
-#include
-
-struct Src : Genode::Mmio
-{
- Src(Genode::addr_t const mmio_base) : Genode::Mmio(mmio_base) { }
-
- struct Ctrl_reg : Register<0x0, 32>
- {
- struct Ipu_rst : Bitfield<3, 1> { };
- };
-};
-
-#endif /* _SRC_H_ */
diff --git a/os/src/drivers/platform/imx53/ccm.h b/os/src/drivers/platform/imx53/ccm.h
new file mode 100644
index 000000000..8e175fe15
--- /dev/null
+++ b/os/src/drivers/platform/imx53/ccm.h
@@ -0,0 +1,71 @@
+/*
+ * \brief Clock control module register description
+ * \author Nikolay Golikov
+ * \author Stefan Kalkowski
+ * \date 2013-04-29
+ */
+
+/*
+ * Copyright (C) 2013 Genode Labs GmbH
+ *
+ * This file is part of the Genode OS framework, which is distributed
+ * under the terms of the GNU General Public License version 2.
+ */
+
+#ifndef _DRIVERS__PLATFORM__IMX53__CCM_H_
+#define _DRIVERS__PLATFORM__IMX53__CCM_H_
+
+/* Genode includes */
+#include
+#include
+#include
+
+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> { };
+ };
+
+ /**
+ * Low power control register
+ */
+ struct Clpcr : Register<0x54, 32>
+ {
+ struct Bypass_ipu_hs : Bitfield<18, 1> { };
+ };
+
+ struct Cccr5 : Register<0x7c, 32>
+ {
+ struct Ipu_clk_en : Bitfield<10, 2> { };
+ };
+
+ public:
+
+ Ccm()
+ : Genode::Attached_io_mem_dataspace(Genode::Board_base::CCM_BASE,
+ Genode::Board_base::CCM_SIZE),
+ Genode::Mmio((Genode::addr_t)local_addr()) {}
+
+ void ipu_clk_enable(void)
+ {
+ write(3);
+ write(0);
+ write(0);
+ }
+
+ void ipu_clk_disable(void)
+ {
+ write(0);
+ write(1);
+ write(1);
+ }
+};
+
+#endif /* _DRIVERS__PLATFORM__IMX53__CCM_H_ */
diff --git a/os/src/drivers/platform/imx53/iomux.h b/os/src/drivers/platform/imx53/iomux.h
new file mode 100644
index 000000000..4f26be879
--- /dev/null
+++ b/os/src/drivers/platform/imx53/iomux.h
@@ -0,0 +1,33 @@
+/*
+ * \brief IOMUX controller register description
+ * \author Stefan Kalkowski
+ * \date 2013-04-29
+ */
+
+/*
+ * Copyright (C) 2013 Genode Labs GmbH
+ *
+ * This file is part of the Genode OS framework, which is distributed
+ * under the terms of the GNU General Public License version 2.
+ */
+
+#ifndef _DRIVERS__PLATFORM__IMX53__IOMUX_H_
+#define _DRIVERS__PLATFORM__IMX53__IOMUX_H_
+
+/* Genode includes */
+#include
+#include
+#include
+
+class Iomux : public Genode::Attached_io_mem_dataspace,
+ Genode::Mmio
+{
+ public:
+
+ Iomux()
+ : Genode::Attached_io_mem_dataspace(Genode::Board_base::IOMUXC_BASE,
+ Genode::Board_base::IOMUXC_SIZE),
+ Genode::Mmio((Genode::addr_t)local_addr()) {}
+};
+
+#endif /* _DRIVERS__PLATFORM__IMX53__IOMUX_H_ */
diff --git a/os/src/drivers/platform/imx53/main.cc b/os/src/drivers/platform/imx53/main.cc
new file mode 100644
index 000000000..217ded3ff
--- /dev/null
+++ b/os/src/drivers/platform/imx53/main.cc
@@ -0,0 +1,120 @@
+/*
+ * \brief Driver for i.MX53 specific platform devices (clocks, power, etc.)
+ * \author Stefan Kalkowski
+ * \date 2013-04-29
+ */
+
+/*
+ * Copyright (C) 2013 Genode Labs GmbH
+ *
+ * This file is part of the Genode OS framework, which is distributed
+ * under the terms of the GNU General Public License version 2.
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+
+namespace Platform {
+ class Session_component;
+ class Root;
+}
+
+
+class Platform::Session_component : public Genode::Rpc_object
+{
+ private:
+
+ Iomux &_iomux; /* I/O multiplexer device */
+ Ccm &_ccm; /* clock control module */
+ Src &_src; /* system reset controller */
+
+ public:
+
+ /**
+ * Constructor
+ */
+ Session_component(Iomux &iomux, Ccm &ccm, Src &src)
+ : _iomux(iomux), _ccm(ccm), _src(src) {}
+
+
+ /**********************************
+ ** Platform session interface **
+ **********************************/
+
+ void enable(Device dev)
+ {
+ switch (dev) {
+ case Session::IPU:
+ _src.reset_ipu();
+ _ccm.ipu_clk_enable();
+ break;
+ default:
+ PWRN("Invalid device");
+ };
+ }
+
+ void disable(Device dev)
+ {
+ switch (dev) {
+ case Session::IPU:
+ _ccm.ipu_clk_disable();
+ break;
+ default:
+ PWRN("Invalid device");
+ };
+ }
+
+ void clock_rate(Device dev, unsigned long rate)
+ {
+ switch (dev) {
+ default:
+ PWRN("Invalid device");
+ };
+ }
+};
+
+
+class Platform::Root : public Genode::Root_component
+{
+ private:
+
+ Iomux _iomux;
+ Ccm _ccm;
+ Src _src;
+
+ protected:
+
+ Session_component *_create_session(const char *args) {
+ return new (md_alloc()) Session_component(_iomux, _ccm, _src); }
+
+ public:
+
+ Root(Genode::Rpc_entrypoint *session_ep,
+ Genode::Allocator *md_alloc)
+ : Genode::Root_component(session_ep, md_alloc) { }
+};
+
+
+int main(int, char **)
+{
+ using namespace Genode;
+
+ PINF("--- i.MX53 platform driver ---\n");
+
+ static Cap_connection cap;
+ static Rpc_entrypoint ep(&cap, 4096, "imx53_plat_ep");
+ static Platform::Root plat_root(&ep, env()->heap());
+ env()->parent()->announce(ep.manage(&plat_root));
+
+ sleep_forever();
+ return 0;
+}
diff --git a/os/src/drivers/platform/imx53/src.h b/os/src/drivers/platform/imx53/src.h
new file mode 100644
index 000000000..efe4e7795
--- /dev/null
+++ b/os/src/drivers/platform/imx53/src.h
@@ -0,0 +1,43 @@
+/*
+ * \brief System reset controller register description
+ * \author Nikolay Golikov
+ * \author Stefan Kalkowski
+ * \date 2013-04-29
+ */
+
+/*
+ * Copyright (C) 2013 Genode Labs GmbH
+ *
+ * This file is part of the Genode OS framework, which is distributed
+ * under the terms of the GNU General Public License version 2.
+ */
+
+#ifndef _DRIVERS__PLATFORM__IMX53__SRC_H_
+#define _DRIVERS__PLATFORM__IMX53__SRC_H_
+
+/* Genode includes */
+#include
+#include
+#include
+
+class Src : public Genode::Attached_io_mem_dataspace,
+ Genode::Mmio
+{
+ private:
+
+ struct Ctrl_reg : Register<0x0, 32>
+ {
+ struct Ipu_rst : Bitfield<3, 1> { };
+ };
+
+ public:
+
+ Src()
+ : Genode::Attached_io_mem_dataspace(Genode::Board_base::SRC_BASE,
+ Genode::Board_base::SRC_SIZE),
+ Genode::Mmio((Genode::addr_t)local_addr()) {}
+
+ void reset_ipu() { write(1); }
+};
+
+#endif /* _DRIVERS__PLATFORM__IMX53__SRC_H_ */
diff --git a/os/src/drivers/platform/imx53/target.mk b/os/src/drivers/platform/imx53/target.mk
new file mode 100644
index 000000000..d0993e6d5
--- /dev/null
+++ b/os/src/drivers/platform/imx53/target.mk
@@ -0,0 +1,5 @@
+TARGET = platform_drv
+REQUIRES = imx53
+SRC_CC = main.cc
+INC_DIR += ${PRG_DIR}
+LIBS = base