Skip to content

Commit

Permalink
initial commit to add framebuffer support for imx6
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardsandberg committed Sep 17, 2018
1 parent 5dcf06d commit bb7ad09
Show file tree
Hide file tree
Showing 20 changed files with 1,669 additions and 52 deletions.
46 changes: 32 additions & 14 deletions repos/base/include/drivers/defs/imx6.h
Expand Up @@ -38,20 +38,38 @@ namespace Imx6 {
GPIO6_MMIO_SIZE = 0x4000,
GPIO7_MMIO_BASE = 0x020b4000,
GPIO7_MMIO_SIZE = 0x4000,
GPIO1_IRQL = 98,
GPIO1_IRQH = 99,
GPIO2_IRQL = 100,
GPIO2_IRQH = 101,
GPIO3_IRQL = 102,
GPIO3_IRQH = 103,
GPIO4_IRQL = 104,
GPIO4_IRQH = 105,
GPIO5_IRQL = 106,
GPIO5_IRQH = 107,
GPIO6_IRQL = 108,
GPIO6_IRQH = 109,
GPIO7_IRQL = 110,
GPIO7_IRQH = 111,
GPIO1_IRQL = 42,
GPIO1_IRQH = 43,
GPIO2_IRQL = 44,
GPIO2_IRQH = 45,
GPIO3_IRQL = 46,
GPIO3_IRQH = 47,
GPIO4_IRQL = 48,
GPIO4_IRQH = 49,
GPIO5_IRQL = 50,
GPIO5_IRQH = 51,
GPIO6_IRQL = 52,
GPIO6_IRQH = 53,
GPIO7_IRQL = 54,
GPIO7_IRQH = 56,

IPU_BASE = 0x2400000,
IPU_SIZE = 0x400000,

PWM2_BASE = 0x2084000,
PWM2_SIZE = 0x4000,

IIM_BASE = 0x21bc000,
IIM_SIZE = 0x4000,

CCM_BASE = 0x20c4000,
CCM_SIZE = 0x00004000,

IOMUXC_BASE = 0x20e0000,
IOMUXC_SIZE = 0x00004000,

SRC_BASE = 0x20d8000,
SRC_SIZE = 0x00004000

};
};
Expand Down
17 changes: 2 additions & 15 deletions repos/base/run/platform_drv.inc
Expand Up @@ -5,6 +5,7 @@ proc have_platform_drv {} {

return [expr [have_spec arndale] \
|| [have_spec imx53] \
|| [have_spec imx6] \
|| [have_spec rpi] \
|| [have_spec odroid_x2] \
|| [have_spec x86]]
Expand All @@ -30,20 +31,6 @@ proc need_usb_hid { } {
}


##
# Return name of the USB driver binary
#
proc usb_host_drv_binary { } {
if {[have_spec arndale]} { return arndale_usb_host_drv }
if {[have_spec panda]} { return panda_usb_host_drv }
if {[have_spec rpi]} { return rpi_usb_host_drv }
if {[have_spec wand_quad]} { return wand_quad_usb_host_drv }
if {[have_spec odroid_x2]} { return odroid_x2_usb_host_drv }
if {[have_spec x86]} { return x86_pc_usb_host_drv }
return no_usb_drv_available
}


##
# Return name of the NIC driver binary
#
Expand Down Expand Up @@ -151,7 +138,7 @@ proc platform_drv_policy {} {
<policy label_prefix="ahci_drv"> <pci class="AHCI"/> </policy>
<policy label_prefix="nvme_drv"> <pci class="NVME"/> </policy>
<policy label_prefix="audio_drv"> <pci class="AUDIO"/> <pci class="HDAUDIO"/> </policy>
<policy label_prefix="intel_fb_drv">
<policy label_prefix="intel_fb_drv" irq_mode="nomsi">
<pci class="VGA"/>
<pci bus="0" device="0" function="0"/>
<pci class="ISABRIDGE"/>
Expand Down
47 changes: 47 additions & 0 deletions repos/os/include/spec/imx6/imx_framebuffer_session/client.h
@@ -0,0 +1,47 @@
/*
* \brief Client-side i.MX6 specific framebuffer interface
* \author Stefan Kalkowski
* \date 2013-02-26
*/

/*
* Copyright (C) 2006-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/

#ifndef _INCLUDE__IMX_FRAMEBUFFER_SESSION__CLIENT_H_
#define _INCLUDE__IMX_FRAMEBUFFER_SESSION__CLIENT_H_

#include <framebuffer_session/capability.h>
#include <imx_framebuffer_session/imx_framebuffer_session.h>
#include <base/rpc_client.h>

namespace Framebuffer { struct Imx_client; }


struct Framebuffer::Imx_client : Genode::Rpc_client<Imx_session>
{
explicit Imx_client(Capability<Imx_session> session)
: Genode::Rpc_client<Imx_session>(session) { }

Genode::Dataspace_capability dataspace() override {
return call<Rpc_dataspace>(); }

Mode mode() const override { return call<Rpc_mode>(); }

void mode_sigh(Genode::Signal_context_capability sigh) override {
call<Rpc_mode_sigh>(sigh); }

void sync_sigh(Genode::Signal_context_capability sigh) override {
call<Rpc_sync_sigh>(sigh); }

void refresh(int x, int y, int w, int h) override {
call<Rpc_refresh>(x, y, w, h); }

void overlay(Genode::addr_t phys_addr, int x, int y, int alpha) override {
call<Rpc_overlay>(phys_addr, x, y, alpha); }
};

#endif /* _INCLUDE__IMX_FRAMEBUFFER_SESSION__CLIENT_H_ */
89 changes: 89 additions & 0 deletions repos/os/include/spec/imx6/imx_framebuffer_session/connection.h
@@ -0,0 +1,89 @@
/*
* \brief Connection to i.MX6 specific frame-buffer service
* \author Stefan Kalkowski
* \date 2013-02-26
*/

/*
* Copyright (C) 2008-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/

#ifndef _INCLUDE__IMX_FRAMEBUFFER_SESSION__CONNECTION_H_
#define _INCLUDE__IMX_FRAMEBUFFER_SESSION__CONNECTION_H_

#include <imx_framebuffer_session/client.h>
#include <util/arg_string.h>
#include <base/connection.h>

namespace Framebuffer { class Imx_connection; }


class Framebuffer::Imx_connection : public Genode::Connection<Imx_session>,
public Imx_client
{
private:

/**
* Create session and return typed session capability
*/
Capability<Imx_session> _connect(Genode::Parent &parent,
unsigned width, unsigned height,
Mode::Format format)
{
using namespace Genode;

enum { ARGBUF_SIZE = 128 };
char argbuf[ARGBUF_SIZE];

/* donate ram quota for storing server-side meta data */
strncpy(argbuf, "ram_quota=8K", sizeof(argbuf));

/* set optional session-constructor arguments */
if (width)
Arg_string::set_arg(argbuf, sizeof(argbuf), "fb_width", width);
if (height)
Arg_string::set_arg(argbuf, sizeof(argbuf), "fb_height", height);
if (format != Mode::INVALID)
Arg_string::set_arg(argbuf, sizeof(argbuf), "fb_format", format);

return session(parent, argbuf);
}

public:

/**
* Constructor
*
* \param mode desired size and pixel format
*
* The specified values are not enforced. After creating the
* session, you should validate the actual frame-buffer attributes
* by calling the 'info' method of the frame-buffer interface.
*/
Imx_connection(Genode::Env &env, Framebuffer::Mode mode)
:
Genode::Connection<Imx_session>(env, _connect(env.parent(),
mode.width(), mode.height(),
mode.format())),
Imx_client(cap())
{ }

/**
* Constructor
*
* \noapi
* \deprecated Use the constructor with 'Env &' as first
* argument instead
*/
Imx_connection(unsigned width = 0,
unsigned height = 0,
Mode::Format format = Mode::INVALID) __attribute__((deprecated))
: Genode::Connection<Imx_session>(_connect(*Genode::env_deprecated()->parent(),
width, height, format)),
Imx_client(cap()) { }
};

#endif /* _INCLUDE__IMX_FRAMEBUFFER_SESSION__CONNECTION_H_ */
@@ -0,0 +1,48 @@
/*
* \brief i.MX6 specific framebuffer session extension
* \author Stefan Kalkowski
* \date 2013-02-26
*/

/*
* Copyright (C) 2011-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/

#ifndef _INCLUDE__IMX_FRAMEBUFFER_SESSION__IMX_FRAMEBUFFER_SESSION_H_
#define _INCLUDE__IMX_FRAMEBUFFER_SESSION__IMX_FRAMEBUFFER_SESSION_H_

#include <base/capability.h>
#include <base/rpc.h>
#include <framebuffer_session/framebuffer_session.h>

namespace Framebuffer { struct Imx_session; }


struct Framebuffer::Imx_session : Session
{
virtual ~Imx_session() { }

/**
* Set overlay properties
*
* \param phys_base physical base address of overlay framebuffer
* \param x horizontal position in pixel
* \param y vertical position in pixel
* \param alpha alpha transparency value of overlay (0-255)
*/
virtual void overlay(Genode::addr_t phys_base, int x, int y, int alpha) = 0;


/*********************
** RPC declaration **
*********************/

GENODE_RPC(Rpc_overlay, void, overlay, Genode::addr_t, int, int, int);

GENODE_RPC_INTERFACE_INHERIT(Session, Rpc_overlay);
};

#endif /* _INCLUDE__IMX_FRAMEBUFFER_SESSION__IMX_FRAMEBUFFER_SESSION_H_ */
36 changes: 36 additions & 0 deletions repos/os/include/spec/imx6/platform_session/client.h
@@ -0,0 +1,36 @@
/*
* \brief i.MX6 specific platform session client side
* \author Stefan Kalkowski <stefan.kalkowski@genode-labs.com
* \date 2013-04-29
*/

/*
* Copyright (C) 2013-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/

#ifndef _INCLUDE__PLATFORM_SESSION__CLIENT_H_
#define _INCLUDE__PLATFORM_SESSION__CLIENT_H_

#include <base/capability.h>
#include <base/rpc_client.h>
#include <platform_session/platform_session.h>

namespace Platform { struct Client; }


struct Platform::Client : Genode::Rpc_client<Session>
{
explicit Client(Genode::Capability<Session> session)
: Genode::Rpc_client<Session>(session) { }

void enable(Device dev) override { call<Rpc_enable>(dev); }
void disable(Device dev) override { call<Rpc_disable>(dev); }
void clock_rate(Device dev, unsigned long rate) override {
call<Rpc_clock_rate>(dev, rate); }
Board_revision revision() override { return call<Rpc_revision>(); }
};

#endif /* _INCLUDE__PLATFORM_SESSION__CLIENT_H_ */
68 changes: 68 additions & 0 deletions repos/os/include/spec/imx6/platform_session/platform_session.h
@@ -0,0 +1,68 @@
/*
* \brief i.MX6 specific platform session
* \author Stefan Kalkowski <stefan.kalkowski@genode-labs.com
* \date 2013-04-29
*/

/*
* Copyright (C) 2013-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/

#ifndef _INCLUDE__PLATFORM_SESSION__PLATFORM_SESSION_H_
#define _INCLUDE__PLATFORM_SESSION__PLATFORM_SESSION_H_

#include <base/capability.h>
#include <base/rpc.h>

namespace Platform { struct Session; }


struct Platform::Session : Genode::Session
{
enum Device {
IPU,
I2C_2,
I2C_3,
BUTTONS,
PWM,
};

enum Board_revision {
WAND_QUAD = 4,
//SMD = 2, /* Freescale i.MX53 SMD Tablet */
//QSB = 3, /* Freescale i.MX53 low-cost Quickstart board */
UNKNOWN,
};

/**
* \noapi
*/
static const char *service_name() { return "Platform"; }

enum { CAP_QUOTA = 2 };

virtual ~Session() { }

virtual void enable(Device dev) = 0;
virtual void disable(Device dev) = 0;
virtual void clock_rate(Device dev, unsigned long rate) = 0;
virtual Board_revision revision() = 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(Rpc_revision, Board_revision, revision);

GENODE_RPC_INTERFACE(Rpc_enable, Rpc_disable, Rpc_clock_rate,
Rpc_revision);
};

#endif /* _INCLUDE__PLATFORM_SESSION__PLATFORM_SESSION_H_ */

0 comments on commit bb7ad09

Please sign in to comment.