bsps: Provide <bsp/fdt.h> for every BSP

Add bsp_fdt_map_intr() intended for the libbsd FDT support.
This commit is contained in:
Sebastian Huber
2017-03-07 10:57:46 +01:00
parent 36338fb312
commit 9cd20cde4d
7 changed files with 56 additions and 6 deletions

View File

@@ -37,6 +37,7 @@ include_bspdir = $(includedir)/bsp
include_bsp_HEADERS =
include_bsp_HEADERS += shared/include/default-initial-extension.h
include_bsp_HEADERS += shared/include/fatal.h
include_bsp_HEADERS += shared/include/fdt.h
include_bsp_HEADERS += shared/include/console-termios.h
include_bsp_HEADERS += shared/include/gpio.h

View File

@@ -22,7 +22,6 @@ include_bsp_HEADERS = include/irq.h \
../../shared/include/irq-generic.h \
../../shared/include/irq-info.h \
../../shared/include/bootcard.h \
../../shared/include/fdt.h \
../../shared/include/utility.h \
../shared/include/start.h \
../shared/include/tictac.h \

View File

@@ -7,7 +7,7 @@
*/
/*
* Copyright (c) 2010-2015 embedded brains GmbH. All rights reserved.
* Copyright (c) 2010, 2017 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Dornierstr. 4
@@ -37,6 +37,8 @@ extern "C" {
#define BSP_FEATURE_IRQ_EXTENSION
#define BSP_FDT_IS_SUPPORTED
#define QORIQ_CHIP(alpha, num) ((alpha) * 10000 + (num))
#define QORIQ_CHIP_P1020 QORIQ_CHIP('P', 1020)

View File

@@ -7,7 +7,7 @@
*/
/*
* Copyright (c) 2010-2015 embedded brains GmbH. All rights reserved.
* Copyright (c) 2010, 2017 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Dornierstr. 4
@@ -169,3 +169,8 @@ void bsp_start(void)
qoriq.lcc.bptr &= ~BPTR_EN;
#endif
}
uint32_t bsp_fdt_map_intr(uint32_t intr)
{
return intr - 16;
}

View File

@@ -26,6 +26,10 @@ $(PROJECT_INCLUDE)/bsp/fatal.h: shared/include/fatal.h $(PROJECT_INCLUDE)/bsp/$(
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/fatal.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/fatal.h
$(PROJECT_INCLUDE)/bsp/fdt.h: shared/include/fdt.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/fdt.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/fdt.h
$(PROJECT_INCLUDE)/bsp/console-termios.h: shared/include/console-termios.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/console-termios.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/console-termios.h

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015 embedded brains GmbH. All rights reserved.
* Copyright (c) 2015, 2017 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Dornierstr. 4
@@ -15,14 +15,50 @@
#ifndef LIBBSP_SHARED_FDT_H
#define LIBBSP_SHARED_FDT_H
#include <bsp.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*
* BSPs that implement the FDT support functions must define
* BSP_FDT_IS_SUPPORTED.
*/
/**
* @brief Copies the specified source FDT to a dedicated global data area.
*
* The source FDT is usually provided by a bootloader and may be located in a
* memory area that is used by the program. The low-level initialization
* should copy the FDT for later use.
*
* The copy can be accessed by bsp_fdt_get().
*
* @param[in] src The source FDT.
*/
void bsp_fdt_copy(const void *src);
/**
* @brief Returns the FDT of the BSP.
*
* @return The FDT of the BSP.
*/
const void *bsp_fdt_get(void);
/**
* @brief Maps the interrupt number of the FDT to the interrupt vector used by
* the interrupt management.
*
* This function is used by the libbsd to implement the OFW_BUS_MAP_INTR bus
* method.
*
* @param[in] intr The FDT interrupt number.
*
* @return The interrupt vector of the FDT interrupt number.
*/
uint32_t bsp_fdt_map_intr(uint32_t intr);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015 embedded brains GmbH. All rights reserved.
* Copyright (c) 2015, 2017 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Dornierstr. 4
@@ -16,10 +16,13 @@
#include <libfdt.h>
#include <bsp.h>
#include <bsp/fdt.h>
#include <bsp/linker-symbols.h>
#ifndef BSP_FDT_IS_SUPPORTED
#warning "BSP FDT support indication not defined"
#endif
#ifndef BSP_FDT_BLOB_SIZE_MAX
#define BSP_FDT_BLOB_SIZE_MAX 0
#endif