gpio_drv: add support for i.MX6

Fix #2750
This commit is contained in:
Stefan Kalkowski 2018-02-22 15:25:14 +01:00 committed by Christian Helmuth
parent ca108222c6
commit f653be1ebc
9 changed files with 117 additions and 36 deletions

View File

@ -22,6 +22,37 @@ namespace Imx6 {
SDHC_IRQ = 54, SDHC_IRQ = 54,
SDHC_MMIO_BASE = 0x02190000, SDHC_MMIO_BASE = 0x02190000,
SDHC_MMIO_SIZE = 0x00004000, SDHC_MMIO_SIZE = 0x00004000,
/* GPIO */
GPIO1_MMIO_BASE = 0x0209c000,
GPIO1_MMIO_SIZE = 0x4000,
GPIO2_MMIO_BASE = 0x020a0000,
GPIO2_MMIO_SIZE = 0x4000,
GPIO3_MMIO_BASE = 0x020a4000,
GPIO3_MMIO_SIZE = 0x4000,
GPIO4_MMIO_BASE = 0x020a8000,
GPIO4_MMIO_SIZE = 0x4000,
GPIO5_MMIO_BASE = 0x020ac000,
GPIO5_MMIO_SIZE = 0x4000,
GPIO6_MMIO_BASE = 0x020b0000,
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,
}; };
}; };

View File

@ -1,4 +1,4 @@
SPECS += cortex_a9 SPECS += cortex_a9 gpio
REP_INC_DIR += include/spec/imx6 REP_INC_DIR += include/spec/imx6

View File

@ -1,5 +1,5 @@
/* /*
* \brief Gpio driver for the i.MX53 * \brief Gpio driver for Freescale
* \author Ivan Loskutov <ivan.loskutov@ksyslabs.org> * \author Ivan Loskutov <ivan.loskutov@ksyslabs.org>
* \author Nikolay Golikov <nik@ksyslabs.org> * \author Nikolay Golikov <nik@ksyslabs.org>
* \author Stefan Kalkowski <stefan.kalkowski@genode-labs.com> * \author Stefan Kalkowski <stefan.kalkowski@genode-labs.com>
@ -14,21 +14,21 @@
* under the terms of the GNU Affero General Public License version 3. * under the terms of the GNU Affero General Public License version 3.
*/ */
#ifndef _DRIVERS__GPIO__SPEC__IMX53__DRIVER_H_ #ifndef _DRIVERS__GPIO__SPEC__IMX__DRIVER_H_
#define _DRIVERS__GPIO__SPEC__IMX53__DRIVER_H_ #define _DRIVERS__GPIO__SPEC__IMX__DRIVER_H_
/* Genode includes */ /* Genode includes */
#include <drivers/defs/imx53.h>
#include <gpio/driver.h> #include <gpio/driver.h>
#include <irq_session/connection.h> #include <irq_session/connection.h>
#include <timer_session/connection.h> #include <timer_session/connection.h>
#include <os/server.h> #include <os/server.h>
/* local includes */ /* local includes */
#include "gpio.h" #include <board.h>
#include <gpio.h>
class Imx53_driver : public Gpio::Driver class Imx_driver : public Gpio::Driver
{ {
private: private:
@ -152,22 +152,22 @@ class Imx53_driver : public Gpio::Driver
int _gpio_index(int gpio) { return gpio & 0x1f; } int _gpio_index(int gpio) { return gpio & 0x1f; }
Imx53_driver(Genode::Env &env) Imx_driver(Genode::Env &env)
: :
_gpio_bank_0(env, Imx53::GPIO1_MMIO_BASE, Imx53::GPIO1_MMIO_SIZE, _gpio_bank_0(env, Board::GPIO1_MMIO_BASE, Board::GPIO1_MMIO_SIZE,
Imx53::GPIO1_IRQL, Imx53::GPIO1_IRQH), Board::GPIO1_IRQL, Board::GPIO1_IRQH),
_gpio_bank_1(env, Imx53::GPIO2_MMIO_BASE, Imx53::GPIO2_MMIO_SIZE, _gpio_bank_1(env, Board::GPIO2_MMIO_BASE, Board::GPIO2_MMIO_SIZE,
Imx53::GPIO2_IRQL, Imx53::GPIO2_IRQH), Board::GPIO2_IRQL, Board::GPIO2_IRQH),
_gpio_bank_2(env, Imx53::GPIO3_MMIO_BASE, Imx53::GPIO3_MMIO_SIZE, _gpio_bank_2(env, Board::GPIO3_MMIO_BASE, Board::GPIO3_MMIO_SIZE,
Imx53::GPIO3_IRQL, Imx53::GPIO3_IRQH), Board::GPIO3_IRQL, Board::GPIO3_IRQH),
_gpio_bank_3(env, Imx53::GPIO4_MMIO_BASE, Imx53::GPIO4_MMIO_SIZE, _gpio_bank_3(env, Board::GPIO4_MMIO_BASE, Board::GPIO4_MMIO_SIZE,
Imx53::GPIO4_IRQL, Imx53::GPIO4_IRQH), Board::GPIO4_IRQL, Board::GPIO4_IRQH),
_gpio_bank_4(env, Imx53::GPIO5_MMIO_BASE, Imx53::GPIO5_MMIO_SIZE, _gpio_bank_4(env, Board::GPIO5_MMIO_BASE, Board::GPIO5_MMIO_SIZE,
Imx53::GPIO5_IRQL, Imx53::GPIO5_IRQH), Board::GPIO5_IRQL, Board::GPIO5_IRQH),
_gpio_bank_5(env, Imx53::GPIO6_MMIO_BASE, Imx53::GPIO6_MMIO_SIZE, _gpio_bank_5(env, Board::GPIO6_MMIO_BASE, Board::GPIO6_MMIO_SIZE,
Imx53::GPIO6_IRQL, Imx53::GPIO6_IRQH), Board::GPIO6_IRQL, Board::GPIO6_IRQH),
_gpio_bank_6(env, Imx53::GPIO7_MMIO_BASE, Imx53::GPIO7_MMIO_SIZE, _gpio_bank_6(env, Board::GPIO7_MMIO_BASE, Board::GPIO7_MMIO_SIZE,
Imx53::GPIO7_IRQL, Imx53::GPIO7_IRQH) Board::GPIO7_IRQL, Board::GPIO7_IRQH)
{ {
for (unsigned i = 0; i < MAX_BANKS; ++i) { for (unsigned i = 0; i < MAX_BANKS; ++i) {
Gpio_reg *regs = _gpio_bank(i << PIN_SHIFT)->regs(); Gpio_reg *regs = _gpio_bank(i << PIN_SHIFT)->regs();
@ -182,7 +182,7 @@ class Imx53_driver : public Gpio::Driver
public: public:
static Imx53_driver &factory(Genode::Env &env); static Imx_driver &factory(Genode::Env &env);
/****************************** /******************************
** Gpio::Driver interface ** ** Gpio::Driver interface **

View File

@ -1,5 +1,5 @@
/* /*
* \brief Gpio driver for the i.MX53 * \brief Gpio driver for Freescale
* \author Nikolay Golikov <nik@ksyslabs.org> * \author Nikolay Golikov <nik@ksyslabs.org>
* \author Stefan Kalkowski <stefan.kalkowski@genode-labs.com> * \author Stefan Kalkowski <stefan.kalkowski@genode-labs.com>
* \date 2012-12-06 * \date 2012-12-06
@ -13,8 +13,8 @@
* under the terms of the GNU Affero General Public License version 3. * under the terms of the GNU Affero General Public License version 3.
*/ */
#ifndef _DRIVERS__GPIO__SPEC__IMX53__GPIO_H_ #ifndef _DRIVERS__GPIO__SPEC__IMX__GPIO_H_
#define _DRIVERS__GPIO__SPEC__IMX53__GPIO_H_ #define _DRIVERS__GPIO__SPEC__IMX__GPIO_H_
/* Genode includes */ /* Genode includes */
#include <base/attached_io_mem_dataspace.h> #include <base/attached_io_mem_dataspace.h>
@ -46,4 +46,4 @@ struct Gpio_reg : Genode::Attached_io_mem_dataspace, Genode::Mmio
struct Edge_sel : Register_array<0x1c, 32, 32, 1> {}; struct Edge_sel : Register_array<0x1c, 32, 32, 1> {};
}; };
#endif /* _DRIVERS__GPIO__SPEC__IMX53__GPIO_H_ */ #endif /* _DRIVERS__GPIO__SPEC__IMX__GPIO_H_ */

View File

@ -1,5 +1,5 @@
/* /*
* \brief Gpio driver for the i.MX53 * \brief Gpio driver for Freescale
* \author Ivan Loskutov <ivan.loskutov@ksyslabs.org> * \author Ivan Loskutov <ivan.loskutov@ksyslabs.org>
* \author Nikolay Golikov <nik@ksyslabs.org> * \author Nikolay Golikov <nik@ksyslabs.org>
* \author Stefan Kalkowski <stefan.kalkowski@genode-labs.com> * \author Stefan Kalkowski <stefan.kalkowski@genode-labs.com>
@ -26,9 +26,9 @@
#include <driver.h> #include <driver.h>
Imx53_driver &Imx53_driver::factory(Genode::Env &env) Imx_driver &Imx_driver::factory(Genode::Env &env)
{ {
static Imx53_driver driver(env); static Imx_driver driver(env);
return driver; return driver;
} }
@ -37,7 +37,7 @@ struct Main
{ {
Genode::Env &env; Genode::Env &env;
Genode::Sliced_heap sliced_heap; Genode::Sliced_heap sliced_heap;
Imx53_driver &driver; Imx_driver &driver;
Gpio::Root root; Gpio::Root root;
Genode::Attached_rom_dataspace config_rom { env, "config" }; Genode::Attached_rom_dataspace config_rom { env, "config" };
@ -46,12 +46,12 @@ struct Main
: :
env(env), env(env),
sliced_heap(env.ram(), env.rm()), sliced_heap(env.ram(), env.rm()),
driver(Imx53_driver::factory(env)), driver(Imx_driver::factory(env)),
root(&env.ep().rpc_ep(), &sliced_heap, driver) root(&env.ep().rpc_ep(), &sliced_heap, driver)
{ {
using namespace Genode; using namespace Genode;
log("--- i.MX53 gpio driver ---"); log("--- Freescale gpio driver ---");
Gpio::process_config(config_rom.xml(), driver); Gpio::process_config(config_rom.xml(), driver);

View File

@ -0,0 +1,22 @@
/*
* \brief Gpio driver for the i.MX53
* \author Stefan Kalkowski <stefan.kalkowski@genode-labs.com>
* \date 2018-02-22
*/
/*
* Copyright (C) 2018 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 _DRIVERS__GPIO__SPEC__IMX53__BOARD_H_
#define _DRIVERS__GPIO__SPEC__IMX53__BOARD_H_
/* Genode includes */
#include <drivers/defs/imx53.h>
namespace Board { using namespace Imx53; }
#endif /* _DRIVERS__GPIO__SPEC__IMX53__BOARD_H_ */

View File

@ -2,7 +2,6 @@ TARGET = gpio_drv
REQUIRES = imx53 REQUIRES = imx53
SRC_CC = main.cc SRC_CC = main.cc
LIBS = base LIBS = base
INC_DIR += $(PRG_DIR) INC_DIR += $(PRG_DIR) $(REP_DIR)/src/drivers/gpio/spec/imx
vpath main.cc $(PRG_DIR)
vpath main.cc $(REP_DIR)/src/drivers/gpio/spec/imx

View File

@ -0,0 +1,22 @@
/*
* \brief Gpio driver for the i.MX6 SoCs
* \author Stefan Kalkowski <stefan.kalkowski@genode-labs.com>
* \date 2018-02-22
*/
/*
* Copyright (C) 2018 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 _DRIVERS__GPIO__SPEC__IMX6__BOARD_H_
#define _DRIVERS__GPIO__SPEC__IMX6__BOARD_H_
/* Genode includes */
#include <drivers/defs/imx6.h>
namespace Board { using namespace Imx6; }
#endif /* _DRIVERS__GPIO__SPEC__IMX6__BOARD_H_ */

View File

@ -0,0 +1,7 @@
TARGET = gpio_drv
REQUIRES = imx6
SRC_CC = main.cc
LIBS = base
INC_DIR += $(PRG_DIR) $(REP_DIR)/src/drivers/gpio/spec/imx
vpath main.cc $(REP_DIR)/src/drivers/gpio/spec/imx