os: name gpio_drv unambigously (ref #2190)

This commit is contained in:
Stefan Kalkowski 2019-04-17 14:13:20 +02:00 committed by Christian Helmuth
parent 911f4ada0a
commit 7c1e3c84ba
38 changed files with 44 additions and 175 deletions

View File

@ -87,6 +87,18 @@ proc acpi_drv_name { } {
return acpi_drv
}
##
# Return name of the gpio driver
#
proc gpio_drv { } {
if {[have_spec rpi]} { return rpi_gpio_drv }
if {[have_spec omap4]} { return omap4_gpio_drv }
if {[have_spec imx53]} { return imx53_gpio_drv }
if {[have_spec imx6]} { return imx6_gpio_drv }
if {[have_spec exynos4]} { return exynos4_gpio_drv }
return no_gpio_drv_available
}
proc platform_drv_build_components {} {
set drv_build_components ""
lappend_if [have_platform_drv] drv_build_components drivers/platform

View File

@ -75,10 +75,6 @@ append_platform_drv_build_components
build $build_components
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
create_boot_directory
#

View File

@ -78,10 +78,6 @@ append_platform_drv_build_components
build $build_components
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
create_boot_directory
#

View File

@ -36,10 +36,6 @@ append_platform_drv_build_components
build $build_components
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
create_boot_directory
#

View File

@ -26,10 +26,6 @@ append_platform_drv_build_components
build $build_components
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
create_boot_directory
#

View File

@ -16,10 +16,6 @@ set build_components {
lib/vfs/lwip
}
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components

View File

@ -16,10 +16,6 @@ set build_components {
lappend_if [have_spec gpio] build_components drivers/gpio
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components

View File

@ -11,10 +11,6 @@ if {[have_include power_on/qemu]} {
set usb_raw_device $::env(USB_RAW_DEVICE)
}
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
#
# Build
#

View File

@ -17,10 +17,6 @@ set build_components {
app/pointer
}
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
source ${genode_dir}/repos/base/run/platform_drv.inc
lappend_if [need_usb_hid] build_components drivers/usb

View File

@ -42,10 +42,6 @@ append_platform_drv_build_components
lappend_if [expr {[nic_drv_binary] == "nic_drv"}] build_components drivers/nic
lappend_if [expr {[nic_drv_binary] == "usb_drv"}] build_components drivers/usb
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
lappend_if [have_spec gpio] build_components drivers/gpio
build $build_components

View File

@ -17,10 +17,6 @@ set build_components {
server/report_rom
}
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
lappend_if [have_spec gpio] build_components drivers/gpio
source ${genode_dir}/repos/base/run/platform_drv.inc

View File

@ -43,10 +43,6 @@ set build_components {
lappend_if $use_usb_driver build_components drivers/usb
lappend_if [have_spec gpio] build_components drivers/gpio
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components

View File

@ -37,10 +37,6 @@ append_platform_drv_build_components
lappend_if [expr {[nic_drv_binary] == "nic_drv"}] build_components drivers/nic
lappend_if [expr {[nic_drv_binary] == "usb_drv"}] build_components drivers/usb
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
lappend_if [have_spec gpio] build_components drivers/gpio
build $build_components

View File

@ -108,10 +108,6 @@ proc drivers_build_components { feature_arg } {
return $build_components
}
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
#
# Configuration
#

View File

@ -31,10 +31,6 @@ set build_components {
test/smartcard
}
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
lappend_if [have_spec gpio] build_components drivers/gpio
source ${genode_dir}/repos/base/run/platform_drv.inc

View File

@ -20,10 +20,6 @@ set build_components {
server/report_rom server/rom_filter
}
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
source ${genode_dir}/repos/base/run/platform_drv.inc
lappend_if [need_usb_hid] build_components drivers/usb

View File

@ -27,10 +27,6 @@ create_boot_directory
# Generate config
#
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
append config {
<config>
<parent-provides>

View File

@ -12,10 +12,6 @@ set build_components {
test/gpio_drv
}
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
build $build_components
create_boot_directory

View File

@ -12,10 +12,6 @@ set build_components {
test/gpio_led
}
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
build $build_components
create_boot_directory

View File

@ -12,10 +12,6 @@ set build_components {
test/gpio_signal
}
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
build $build_components
create_boot_directory

View File

@ -25,10 +25,6 @@ set build_components {
server/dynamic_rom
}
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
lappend_if [have_spec gpio] build_components drivers/gpio
source ${genode_dir}/repos/base/run/platform_drv.inc

View File

@ -11,11 +11,6 @@ set build_components {
app/ping
}
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
lappend_if [have_spec gpio] build_components drivers/gpio
if {[have_spec foc] || [have_spec odroid_xu] || [have_spec linux] ||

View File

@ -12,11 +12,6 @@ set build_components {
app/ping
}
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
lappend_if [have_spec gpio] build_components drivers/gpio
if {[have_spec foc] || [have_spec odroid_xu] || [have_spec linux] ||

View File

@ -137,7 +137,7 @@ set config {
<default caps="100"/>}
append_if $trusted_led config {
<start name="gpio_drv">
<start name="imx53_gpio_drv">
<resource name="RAM" quantum="3M"/>
<provides><service name="Gpio"/></provides>
<config/>
@ -258,7 +258,7 @@ if { $mmc_rootfs } {
}
cd ..
lappend_if $trusted_led boot_modules gpio_drv
lappend_if $trusted_led boot_modules imx53_gpio_drv
build_boot_image [join $boot_modules " "]

View File

@ -13,10 +13,6 @@ set build_components {
test/block/bench
}
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
lappend_if [have_spec gpio] build_components drivers/gpio
source ${genode_dir}/repos/base/run/platform_drv.inc

View File

@ -1,5 +1,5 @@
TARGET = gpio_drv
REQUIRES = exynos4
TARGET = exynos4_gpio_drv
REQUIRES = arm_v7
SRC_CC = main.cc
LIBS = base
INC_DIR += $(PRG_DIR)

View File

@ -1,5 +1,5 @@
TARGET = gpio_drv
REQUIRES = imx53
TARGET = imx53_gpio_drv
REQUIRES = arm_v7
SRC_CC = main.cc
LIBS = base
INC_DIR += $(PRG_DIR) $(REP_DIR)/src/drivers/gpio/spec/imx

View File

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

View File

@ -1,5 +1,5 @@
TARGET = gpio_drv
REQUIRES = omap4
TARGET = omap4_gpio_drv
REQUIRES = arm_v7
SRC_CC = main.cc
LIBS = base
INC_DIR += $(PRG_DIR)

View File

@ -24,7 +24,6 @@
#include <irq_session/connection.h>
/* local includes */
#include <irq.h>
#include <gpio.h>
static int verbose = 1;
@ -35,7 +34,10 @@ class Gpio::Rpi_driver : public Driver
{
private:
enum { MAX_PINS = 54 };
enum {
IRQ = 49,
MAX_PINS = 54,
};
Reg _reg;
Genode::Irq_connection _irq;
@ -52,10 +54,10 @@ class Gpio::Rpi_driver : public Driver
});
}
Rpi_driver(Genode::Env &env)
Rpi_driver(Genode::Env &env, unsigned irq_offset)
:
_reg(env, Rpi::GPIO_CONTROLLER_BASE, 0, Rpi::GPIO_CONTROLLER_SIZE),
_irq(env, IRQ),
_irq(env, IRQ + irq_offset),
_dispatcher(env.ep(), *this, &Rpi_driver::_handle),
_async(false)
{

View File

@ -1,19 +0,0 @@
/*
* \brief GPIO interrupt number
* \author Reinier Millo Sánchez <rmillo@uclv.cu>
* \date 2015-07-27
*/
/*
* Copyright (C) 2015-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 _DRIVERS__GPIO__SPEC__RPI__SPEC__FOC__IRQ_H_
#define _DRIVERS__GPIO__SPEC__RPI__SPEC__FOC__IRQ_H_
namespace Gpio { enum { IRQ = 49 }; }
#endif /* _DRIVERS__GPIO__SPEC__RPI__SPEC__FOC__IRQ_H_ */

View File

@ -1,7 +0,0 @@
TARGET = foc_gpio_drv
REQUIRES = rpi
SRC_CC += main.cc
LIBS = base
INC_DIR += $(PRG_DIR) $(PRG_DIR)/..
vpath main.cc $(PRG_DIR)/..

View File

@ -1,25 +0,0 @@
/*
* \brief GPIO interrupt number
* \author Reinier Millo Sánchez <rmillo@uclv.cu>
* \date 2015-07-27
*/
/*
* Copyright (C) 2015-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 _DRIVERS__GPIO__SPEC__RPI__SPEC__HW__IRQ_H_
#define _DRIVERS__GPIO__SPEC__RPI__SPEC__HW__IRQ_H_
/* Genode includes */
#include <drivers/defs/rpi.h>
namespace Gpio
{
enum { IRQ = Rpi::GPU_IRQ_BASE + 49 };
}
#endif /* _DRIVERS__GPIO__SPEC__RPI__SPEC__HW__IRQ_H_ */

View File

@ -1,7 +0,0 @@
TARGET = hw_gpio_drv
REQUIRES = rpi
SRC_CC += main.cc
LIBS = base
INC_DIR += $(PRG_DIR) $(PRG_DIR)/..
vpath main.cc $(PRG_DIR)/..

View File

@ -18,6 +18,7 @@
#include <base/component.h>
#include <base/log.h>
#include <base/heap.h>
#include <drivers/defs/rpi.h>
#include <gpio/component.h>
#include <gpio/config.h>
@ -27,7 +28,14 @@
Gpio::Rpi_driver& Gpio::Rpi_driver::factory(Genode::Env &env)
{
static Rpi_driver driver(env);
unsigned irq_offset = 0;
static Genode::Attached_rom_dataspace rom { env, "platform_info" };
try {
String<32> kernel_name =
rom.xml().sub_node("kernel").attribute_value("name", String<32>());
if (kernel_name == "hw") irq_offset += Rpi::GPU_IRQ_BASE;
} catch (...) { }
static Rpi_driver driver(env, irq_offset);
return driver;
}

View File

@ -0,0 +1,7 @@
TARGET = rpi_gpio_drv
REQUIRES = arm_v6
SRC_CC += main.cc
LIBS = base
INC_DIR += $(PRG_DIR)
vpath main.cc $(PRG_DIR)

View File

@ -30,10 +30,6 @@ lappend_if $use_usb_driver build_components drivers/usb
lappend_if $use_nic_driver build_components drivers/nic
lappend_if [have_spec gpio] build_components drivers/gpio
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components

View File

@ -5,10 +5,6 @@
# \date 2013-04-18
#
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
if {[expr $use_nic_bridge && $use_nic_router]} {
puts "Cannot test with both NIC bridge and NIC router.";
exit 0