galileo: add as a standalone platform

Change-Id: I8ca4856d9e6a9461208044242950fdde710c4ffd
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2015-09-19 23:49:34 -04:00
commit c842bdd76d
11 changed files with 719 additions and 7 deletions

View file

@ -1,3 +1,4 @@
obj-y += core/
obj-$(CONFIG_PLATFORM_IA32_PCI) += platforms/ia32_pci/
obj-$(CONFIG_PLATFORM_IA32) += platforms/ia32/
obj-$(CONFIG_PLATFORM_GALILEO) += platforms/galileo/

View file

@ -47,6 +47,19 @@ choice
prompt "Platform Selection"
default PLATFORM_IA32_PCI
config PLATFORM_GALILEO
bool "Galileo Gen2"
select HPET_TIMER
select EOI_HANDLER_SUPPORTED
select BOOTLOADER_UNKNOWN
select PCI
help
The Intel® Galileo Gen 2 development board is a microcontroller board
based on the Intel® Quark™ SoC X1000 application processor, a 32-bit
Intel® Pentium® brand system on a chip (SoC). It is the first board
based on Intel® architecture designed to be hardware and software
pin-compatible with shields designed for the Arduino Uno* R3.
config PLATFORM_IA32_PCI
bool "IA32 with PCI"
select HPET_TIMER
@ -297,6 +310,10 @@ if PLATFORM_IA32_PCI
source "arch/x86/platforms/ia32_pci/Kconfig"
endif
if PLATFORM_GALILEO
source "arch/x86/platforms/galileo/Kconfig"
endif
source "drivers/Kconfig"
source "net/Kconfig"

View file

@ -1,6 +1,5 @@
CONFIG_X86_32=y
CONFIG_MICROKERNEL=y
CONFIG_PLATFORM_IA32_PCI=y
CONFIG_PLATFORM_GALILEO=y
CONFIG_CPU_MINUTEIA=y
CONFIG_CONSOLE=y
CONFIG_SERIAL=y

View file

@ -1,8 +1,6 @@
CONFIG_MICROKERNEL=y
CONFIG_KERNEL_BIN_NAME="microkernel"
CONFIG_X86_32=y
CONFIG_MICROKERNEL=y
CONFIG_PLATFORM_IA32_PCI=y
CONFIG_PLATFORM_GALILEO=y
CONFIG_CPU_MINUTEIA=y
CONFIG_CONSOLE=y
CONFIG_SERIAL=y

View file

@ -1,8 +1,7 @@
CONFIG_NANOKERNEL=y
CONFIG_NANO_TIMERS=y
CONFIG_KERNEL_BIN_NAME="nanokernel"
CONFIG_X86_32=y
CONFIG_PLATFORM_IA32_PCI=y
CONFIG_PLATFORM_GALILEO=y
CONFIG_CPU_MINUTEIA=y
CONFIG_CONSOLE=y
CONFIG_SERIAL=y

View file

@ -0,0 +1,49 @@
# Kconfig - galileo platform configuration options
#
# Copyright (c) 2014-2015 Wind River Systems, Inc.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1) Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2) Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# 3) Neither the name of Wind River Systems nor the names of its contributors
# may be used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
config PLATFORM
string
default galileo
help
This option holds the directory name used by the build system to locate
the correct linker file.
config PHYS_LOAD_ADDR
default 0x00100000
config SYS_CLOCK_HW_CYCLES_PER_SEC
default 25000000 if HPET_TIMER
config UART_CONSOLE_INDEX
default 1

View file

@ -0,0 +1,7 @@
ccflags-y += -I$(srctree)/include/drivers
ccflags-y += -I$(srctree)/drivers
asflags-y := ${ccflags-y}
obj-y += galileo_config.o
obj-y += galileo.o

View file

@ -0,0 +1,216 @@
/* board.h - board configuration macros for the galileo platform */
/*
* Copyright (c) 2013-2015, Wind River Systems, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2) Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3) Neither the name of Wind River Systems nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
DESCRIPTION
This header file is used to specify and describe board-level aspects for
the 'galileo' platform.
*/
#ifndef __INCboardh
#define __INCboardh
#include <misc/util.h>
#ifndef _ASMLANGUAGE
#include <device.h>
#include <drivers/rand32.h>
#endif
#ifdef CONFIG_IOAPIC
#include <drivers/ioapic.h>
#ifdef CONFIG_SERIAL_INTERRUPT_LEVEL
#ifdef CONFIG_SERIAL_INTERRUPT_LOW
#define UART_IOAPIC_FLAGS (IOAPIC_LEVEL | IOAPIC_LOW)
#else
#define UART_IOAPIC_FLAGS (IOAPIC_LEVEL)
#endif
#else /* edge triggered interrupt */
#ifdef CONFIG_SERIAL_INTERRUPT_LOW
/* generate interrupt on falling edge */
#define UART_IOAPIC_FLAGS (IOAPIC_LOW)
#else
/* generate interrupt on raising edge */
#define UART_IOAPIC_FLAGS (0)
#endif
#endif
#endif
#define NUM_STD_IRQS 16 /* number of "standard" IRQs on an x86 platform */
#define INT_VEC_IRQ0 0x20 /* Vector number for IRQ0 */
/* serial port (aka COM port) information */
#define COM1_BAUD_RATE 115200
#define COM2_BAUD_RATE 115200
#define COM2_INT_LVL 0x11 /* COM2 connected to IRQ17 */
#define UART_REG_ADDR_INTERVAL 4 /* address diff of adjacent regs. */
#define UART_XTAL_FREQ (2764800 * 16)
/* uart configuration settings */
/* Generic definitions */
#define CONFIG_UART_PCI_VENDOR_ID 0x8086
#define CONFIG_UART_PCI_DEVICE_ID 0x0936
#define CONFIG_UART_PCI_BUS 0
#define CONFIG_UART_PCI_DEV 20
#define CONFIG_UART_PORT_0_FUNCTION 1
#define CONFIG_UART_PORT_1_FUNCTION 5
#define CONFIG_UART_PCI_BAR 0
#define CONFIG_UART_BAUDRATE COM1_BAUD_RATE
#ifndef _ASMLANGUAGE
extern struct device * const uart_devs[];
#endif
#if defined(CONFIG_UART_CONSOLE)
#define CONFIG_UART_CONSOLE_IRQ COM2_INT_LVL
#define CONFIG_UART_CONSOLE_INT_PRI 3
#define UART_CONSOLE_DEV (uart_devs[CONFIG_UART_CONSOLE_INDEX])
#endif /* CONFIG_UART_CONSOLE */
#ifdef CONFIG_GPIO_DW_0
#if defined(CONFIG_GPIO_DW_0_FALLING_EDGE)
#define GPIO_DW_0_IRQ_IOAPIC_FLAGS (IOAPIC_EDGE | IOAPIC_LOW)
#elif defined(CONFIG_GPIO_DW_0_RISING_EDGE)
#define GPIO_DW_0_IRQ_IOAPIC_FLAGS (IOAPIC_EDGE | IOAPIC_HIGH)
#elif defined(CONFIG_GPIO_DW_0_LEVEL_HIGH)
#define GPIO_DW_0_IRQ_IOAPIC_FLAGS (IOAPIC_LEVEL | IOAPIC_HIGH)
#elif defined(CONFIG_GPIO_DW_0_LEVEL_LOW)
#define GPIO_DW_0_IRQ_IOAPIC_FLAGS (IOAPIC_LEVEL | IOAPIC_LOW)
#endif
#endif /* GPIO_DW_0 */
/* Bluetooth UART definitions */
#if defined(CONFIG_BLUETOOTH_UART)
#define CONFIG_BLUETOOTH_UART_INDEX 1
#define CONFIG_BLUETOOTH_UART_IRQ COM2_INT_LVL
#define CONFIG_BLUETOOTH_UART_INT_PRI 3
#define CONFIG_BLUETOOTH_UART_FREQ UART_XTAL_FREQ
#define CONFIG_BLUETOOTH_UART_BAUDRATE CONFIG_UART_BAUDRATE
#define BT_UART_DEV (uart_devs[CONFIG_BLUETOOTH_UART_INDEX])
#endif /* CONFIG_BLUETOOTH_UART */
#ifdef CONFIG_I2C_DW_0
#include <drivers/ioapic.h>
#if defined(CONFIG_I2C_DW_0_IRQ_FALLING_EDGE)
#define I2C_DW_0_IRQ_IOAPIC_FLAGS (IOAPIC_EDGE | IOAPIC_LOW)
#elif defined(CONFIG_I2C_DW_0_IRQ_RISING_EDGE)
#define I2C_DW_0_IRQ_IOAPIC_FLAGS (IOAPIC_EDGE | IOAPIC_HIGH)
#elif defined(CONFIG_I2C_DW_0_IRQ_LEVEL_HIGH)
#define I2C_DW_0_IRQ_IOAPIC_FLAGS (IOAPIC_LEVEL | IOAPIC_HIGH)
#elif defined(CONFIG_I2C_DW_0_IRQ_LEVEL_LOW)
#define I2C_DW_0_IRQ_IOAPIC_FLAGS (IOAPIC_LEVEL | IOAPIC_LOW)
#endif
#endif /* CONFIG_I2C_DW_0 */
/*
* The irq_connect() API connects to a (virtualized) IRQ and the
* associated interrupt controller is programmed with the allocated vector.
* The Quark board virtualizes IRQs as follows:
*
* - The first CONFIG_IOAPIC_NUM_RTES IRQs are provided by the IOAPIC
* - The remaining IRQs are provided by the LOAPIC.
*
* Thus, for example, if the IOAPIC supports 24 IRQs:
*
* - IRQ0 to IRQ23 map to IOAPIC IRQ0 to IRQ23
* - IRQ24 to IRQ29 map to LOAPIC LVT entries as follows:
*
* IRQ24 -> LOAPIC_TIMER
* IRQ25 -> LOAPIC_THERMAL
* IRQ26 -> LOAPIC_PMC
* IRQ27 -> LOAPIC_LINT0
* IRQ28 -> LOAPIC_LINT1
* IRQ29 -> LOAPIC_ERROR
*/
/* PCI definitions */
#define PCI_BUS_NUMBERS 2
#define PCI_CTRL_ADDR_REG 0xCF8
#define PCI_CTRL_DATA_REG 0xCFC
#define PCI_INTA 1
#define PCI_INTB 2
#define PCI_INTC 3
#define PCI_INTD 4
/**
*
* @brief Convert PCI interrupt PIN to IRQ
*
* The routine uses "standard design consideration" and implies that
* INTA (pin 1) -> IRQ 16
* INTB (pin 2) -> IRQ 17
* INTC (pin 3) -> IRQ 18
* INTD (pin 4) -> IRQ 19
*
* @return IRQ number, -1 if the result is incorrect
*
*/
static inline int pci_pin2irq(int pin)
{
if ((pin < PCI_INTA) || (pin > PCI_INTD))
return -1;
return NUM_STD_IRQS + pin - 1;
}
/**
*
* @brief Convert IRQ to PCI interrupt pin
*
* @return pin number, -1 if the result is incorrect
*
*/
static inline int pci_irq2pin(int irq)
{
if ((irq < NUM_STD_IRQS) || (irq > NUM_STD_IRQS + PCI_INTD - 1))
return -1;
return irq - NUM_STD_IRQS + 1;
}
extern void _SysIntVecProgram(unsigned int vector, unsigned int);
#endif /* __INCboardh */

View file

@ -0,0 +1,176 @@
/* system.c - system/hardware module for the galileo platform */
/*
* Copyright (c) 2013-2015, Wind River Systems, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2) Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3) Neither the name of Wind River Systems nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
DESCRIPTION
This module provides routines to initialize and support board-level hardware
for the galileo platform.
Implementation Remarks:
Handlers for the secondary serial port have not been added.
*/
#include <nanokernel.h>
#include <init.h>
#include <device.h>
#include <misc/printk.h>
#include <misc/__assert.h>
#include "board.h"
#include <drivers/uart.h>
#include <drivers/ioapic.h>
#include <drivers/pic.h>
#include <drivers/pci/pci.h>
#include <drivers/pci/pci_mgr.h>
#include <drivers/loapic.h>
#include <drivers/ioapic.h>
#include <drivers/hpet.h>
#ifdef CONFIG_I2C_DW_0
static int dw_i2c0_irq_set(struct device *unused)
{
ARG_UNUSED(unused);
_ioapic_irq_set(CONFIG_I2C_DW_0_IRQ,
CONFIG_I2C_DW_0_IRQ + INT_VEC_IRQ0,
I2C_DW_0_IRQ_IOAPIC_FLAGS);
return 0;
}
DECLARE_DEVICE_INIT_CONFIG(i2cirq_0, "", dw_i2c0_irq_set, NULL);
pure_late_init(i2cirq_0, NULL);
#endif /* CONFIG_I2C_DW_0 */
#ifdef CONFIG_GPIO_DW_0
static int gpio_irq_set_0(struct device *unused) {
ARG_UNUSED(unused);
_ioapic_irq_set(CONFIG_GPIO_DW_0_IRQ,
CONFIG_GPIO_DW_0_IRQ + INT_VEC_IRQ0,
GPIO_DW_0_IRQ_IOAPIC_FLAGS);
return 0;
}
DECLARE_DEVICE_INIT_CONFIG(gpioirq_0, "", gpio_irq_set_0, NULL);
pure_early_init(gpioirq_0, NULL);
#endif /* CONFIG_GPIO_DW_0 */
/**
*
* @brief Perform basic hardware initialization
*
* Initialize the Intel LOAPIC and IOAPIC device driver and the
* Intel 8250 UART device driver.
* Also initialize the timer device driver, if required.
*
* @return 0
*/
static int galileo_init(struct device *arg)
{
ARG_UNUSED(arg);
#if defined(CONFIG_PCI_DEBUG) && defined(CONFIG_PCI_ENUMERATION)
/* Rescan PCI and display the list of PCI attached devices */
struct pci_dev_info info = {
.function = PCI_FUNCTION_ANY,
.bar = PCI_BAR_ANY,
};
pci_bus_scan_init();
while (pci_bus_scan(&info)) {
pci_show(&info);
info.class = 0;
info.vendor_id = 0;
info.device_id = 0;
info.function = PCI_FUNCTION_ANY;
info.bar = PCI_BAR_ANY;
}
#endif /* CONFIG_PCI_DEBUG && CONFIG_PCI_ENUMERATION */
return 0;
}
#ifdef CONFIG_CONSOLE_HANDLER
static int console_irq_set(struct device *unsued)
{
#if defined(CONFIG_UART_CONSOLE)
_ioapic_irq_set(CONFIG_UART_CONSOLE_IRQ,
CONFIG_UART_CONSOLE_IRQ + INT_VEC_IRQ0,
UART_IOAPIC_FLAGS);
#endif
return 0;
}
DECLARE_DEVICE_INIT_CONFIG(consoleirq, "", console_irq_set, NULL);
pure_late_init(consoleirq, NULL);
#endif /* CONFIG_CONSOLE_HANDLER */
#ifdef CONFIG_HPET_TIMER
static int hpet_irq_set(struct device *unused)
{
ARG_UNUSED(unused);
_ioapic_irq_set(CONFIG_HPET_TIMER_IRQ,
CONFIG_HPET_TIMER_IRQ + INT_VEC_IRQ0,
HPET_IOAPIC_FLAGS);
return 0;
}
DECLARE_DEVICE_INIT_CONFIG(hpetirq, "", hpet_irq_set, NULL);
pure_late_init(hpetirq, NULL);
#endif /* CONFIG_HPET_TIMER */
#ifdef CONFIG_IOAPIC
DECLARE_DEVICE_INIT_CONFIG(ioapic_0, "", _ioapic_init, NULL);
pure_early_init(ioapic_0, NULL);
#endif /* CONFIG_IOAPIC */
#ifdef CONFIG_LOAPIC
DECLARE_DEVICE_INIT_CONFIG(loapic_0, "", _loapic_init, NULL);
pure_early_init(loapic_0, NULL);
#endif /* CONFIG_LOAPIC */
#if defined(CONFIG_PIC_DISABLE)
DECLARE_DEVICE_INIT_CONFIG(pic_0, "", _i8259_init, NULL);
pure_early_init(pic_0, NULL);
#endif /* CONFIG_PIC_DISABLE */
DECLARE_DEVICE_INIT_CONFIG(galileo_0, "", galileo_init, NULL);
pure_early_init(galileo_0, NULL);

View file

@ -0,0 +1,177 @@
/*
* Copyright (c) 2015 Intel Corporation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2) Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3) Neither the name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @file Contains configuration for galileo platforms.
*/
#include <stdio.h>
#include <stdint.h>
#include <device.h>
#include <init.h>
#include "board.h"
#ifdef CONFIG_NS16550
#include <drivers/uart.h>
#include <bluetooth/uart.h>
#include <console/uart_console.h>
#include <serial/ns16550.h>
#if defined(CONFIG_UART_CONSOLE) || defined(CONFIG_BLUETOOTH_UART)
/**
* @brief Initialize NS16550 serial port #1
*
* @param dev The UART device struct
*
* @return DEV_OK if successful, otherwise failed.
*/
static int ns16550_uart_init(struct device *dev)
{
#if defined(CONFIG_UART_CONSOLE)
struct uart_init_info info = {
.baud_rate = CONFIG_UART_CONSOLE_BAUDRATE,
.sys_clk_freq = UART_XTAL_FREQ,
};
if (dev == UART_CONSOLE_DEV) {
uart_init(UART_CONSOLE_DEV, &info);
}
#endif
#if defined(CONFIG_BLUETOOTH_UART)
if (dev == BT_UART_DEV) {
bt_uart_init();
}
#endif
return DEV_OK;
}
#else
static int ns16550_uart_init(struct device *dev)
{
ARG_UNUSED(dev);
return DEV_OK;
}
#endif /* CONFIG_UART_CONSOLE || CONFIG_BLUETOOTH_UART */
/**
* @brief UART Device configuration.
*
* This contains the device configuration for UART.
*/
struct uart_device_config_t ns16550_uart_dev_cfg[] = {
{
.port = CONFIG_NS16550_PORT_0_BASE_ADDR,
.port_init = ns16550_uart_port_init,
#if defined(CONFIG_UART_CONSOLE) || defined(CONFIG_BLUETOOTH_UART)
.config_func = ns16550_uart_init,
#endif
.pci_dev.class = PCI_CLASS_COMM_CTLR,
.pci_dev.bus = CONFIG_UART_PCI_BUS,
.pci_dev.dev = CONFIG_UART_PCI_DEV,
.pci_dev.vendor_id = CONFIG_UART_PCI_VENDOR_ID,
.pci_dev.device_id = CONFIG_UART_PCI_DEVICE_ID,
.pci_dev.function = CONFIG_UART_PORT_0_FUNCTION,
.pci_dev.bar = CONFIG_UART_PCI_BAR,
},
{
.port = CONFIG_NS16550_PORT_1_BASE_ADDR,
.port_init = ns16550_uart_port_init,
#if defined(CONFIG_UART_CONSOLE) || defined(CONFIG_BLUETOOTH_UART)
.config_func = ns16550_uart_init,
#endif
.pci_dev.class = PCI_CLASS_COMM_CTLR,
.pci_dev.bus = CONFIG_UART_PCI_BUS,
.pci_dev.dev = CONFIG_UART_PCI_DEV,
.pci_dev.vendor_id = CONFIG_UART_PCI_VENDOR_ID,
.pci_dev.device_id = CONFIG_UART_PCI_DEVICE_ID,
.pci_dev.function = CONFIG_UART_PORT_1_FUNCTION,
.pci_dev.bar = CONFIG_UART_PCI_BAR,
},
/* Add pre-configured ports after this. */
};
/**< Device data */
static struct uart_ns16550_dev_data_t ns16550_uart_dev_data[2];
/* UART 0 */
DECLARE_DEVICE_INIT_CONFIG(ns16550_uart0,
CONFIG_UART_PORT_0_NAME,
&uart_platform_init,
&ns16550_uart_dev_cfg[0]);
#if (defined(CONFIG_EARLY_CONSOLE) && \
defined(CONFIG_UART_CONSOLE) && \
(CONFIG_UART_CONSOLE_INDEX == 0))
pure_early_init(ns16550_uart0, &ns16550_uart_dev_data[0]);
#else
pure_init(ns16550_uart0, &ns16550_uart_dev_data[0]);
#endif /* CONFIG_EARLY_CONSOLE */
/* UART 1 */
DECLARE_DEVICE_INIT_CONFIG(ns16550_uart1,
CONFIG_UART_PORT_1_NAME,
&uart_platform_init,
&ns16550_uart_dev_cfg[1]);
#if (defined(CONFIG_EARLY_CONSOLE) && \
defined(CONFIG_UART_CONSOLE) && \
(CONFIG_UART_CONSOLE_INDEX == 1))
pure_early_init(ns16550_uart1, &ns16550_uart_dev_data[1]);
#else
pure_init(ns16550_uart1, &ns16550_uart_dev_data[1]);
#endif /* CONFIG_EARLY_CONSOLE */
/**< UART Devices */
struct device * const uart_devs[] = {
#if (defined(CONFIG_EARLY_CONSOLE) && \
defined(CONFIG_UART_CONSOLE) && \
(CONFIG_UART_CONSOLE_INDEX == 0))
&__initconfig_ns16550_uart00,
#else
&__initconfig_ns16550_uart01,
#endif /* CONFIG_EARLY_CONSOLE */
#if (defined(CONFIG_EARLY_CONSOLE) && \
defined(CONFIG_UART_CONSOLE) && \
(CONFIG_UART_CONSOLE_INDEX == 1))
&__initconfig_ns16550_uart10,
#else
&__initconfig_ns16550_uart11,
#endif /* CONFIG_EARLY_CONSOLE */
};
#endif

View file

@ -0,0 +1,73 @@
/* linker.cmd - Linker command/script file */
/*
* Copyright (c) 2011-2014, Wind River Systems, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2) Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3) Neither the name of Wind River Systems nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
DESCRIPTION
This is the linker script for both standard images and XIP images.
*/
#include <autoconf.h>
/* physical address where the kernel is loaded */
#define PHYS_LOAD_ADDR CONFIG_PHYS_LOAD_ADDR
/* physical address of RAM */
#ifdef CONFIG_XIP
#define PHYS_RAM_ADDR 0x00400000
#else /* !CONFIG_XIP */
#define PHYS_RAM_ADDR PHYS_LOAD_ADDR
#endif /* CONFIG_XIP */
MEMORY
{
#ifdef CONFIG_XIP
ROM (rx) : ORIGIN = PHYS_LOAD_ADDR, LENGTH = 72K
RAM (wx) : ORIGIN = PHYS_RAM_ADDR, LENGTH = 128K
#else /* !CONFIG_XIP */
RAM (wx) : ORIGIN = PHYS_LOAD_ADDR, LENGTH = 192K
#endif /* CONFIG_XIP */
/*
* It doesn't matter where this region goes as it is stripped from the
* final ELF image. The address doesn't even have to be valid on the
* target. However, it shouldn't overlap any other regions.
*/
IDT_LIST : ORIGIN = 2K, LENGTH = 2K
}
#include <arch/x86/linker-common-sections.h>
/* start adding platform specific linker sections here */
/* no sections should appear after linker-epilog.h */
#include <arch/x86/linker-epilog.h>