libplatsupport: Remove imx31/kzm platform This is an ancient platform and has been unsupported for over a year. This is motivated by wanting to remove ARMv6 support from seL4. Signed-off-by: Kent McLeod <kent@kry10.com>
diff --git a/libplatsupport/CMakeLists.txt b/libplatsupport/CMakeLists.txt index 0cc7c97..345617e 100644 --- a/libplatsupport/CMakeLists.txt +++ b/libplatsupport/CMakeLists.txt
@@ -53,7 +53,6 @@ list(APPEND deps src/arch/arm/irqchip/gic.c) list(APPEND deps src/arch/arm/irqchip/tegra.c) list(APPEND deps src/arch/arm/irqchip/gicv3.c) - list(APPEND deps src/arch/arm/irqchip/avic.c) list(APPEND deps src/arch/arm/irqchip/omap3.c) # Link the IRQ chip parser modules list( @@ -82,7 +81,7 @@ list(APPEND deps src/mach/${KernelArmMach}/clock/exynos_common_clock.c) endif() -if(KernelPlatImx6 OR KernelPlatformImx7Sabre OR KernelPlatformKZM) +if(KernelPlatImx6 OR KernelPlatformImx7Sabre) list(APPEND deps src/mach/${KernelArmMach}/epit/epit.c) endif()
diff --git a/libplatsupport/plat_include/imx31/platsupport/plat/clock.h b/libplatsupport/plat_include/imx31/platsupport/plat/clock.h deleted file mode 100644 index 3f884e7..0000000 --- a/libplatsupport/plat_include/imx31/platsupport/plat/clock.h +++ /dev/null
@@ -1,17 +0,0 @@ -/* - * Copyright 2017, Data61, CSIRO (ABN 41 687 119 230) - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -enum clk_id { - CLK_MASTER, - NCLOCKS, -}; - -enum clock_gate { - NCLKGATES, -}; -
diff --git a/libplatsupport/plat_include/imx31/platsupport/plat/epit_constants.h b/libplatsupport/plat_include/imx31/platsupport/plat/epit_constants.h deleted file mode 100644 index 86833f3..0000000 --- a/libplatsupport/plat_include/imx31/platsupport/plat/epit_constants.h +++ /dev/null
@@ -1,11 +0,0 @@ -/* - * Copyright 2019, Data61, CSIRO (ABN 41 687 119 230) - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#define EPIT1_PATH "/soc/aips@53f00000/timer@53f94000" -#define EPIT2_PATH "/soc/aips@53f00000/timer@53f98000" -#define GPT_PATH "/soc/aips@53f00000/timer@53f90000"
diff --git a/libplatsupport/plat_include/imx31/platsupport/plat/gpt_constants.h b/libplatsupport/plat_include/imx31/platsupport/plat/gpt_constants.h deleted file mode 100644 index fd1bf5a..0000000 --- a/libplatsupport/plat_include/imx31/platsupport/plat/gpt_constants.h +++ /dev/null
@@ -1,12 +0,0 @@ -/* - * Copyright 2019, Data61, CSIRO (ABN 41 687 119 230) - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#define GPT_PATH "/soc/aips@53f00000/timer@53f90000" - -#define GPT_PRESCALER 1 -
diff --git a/libplatsupport/plat_include/imx31/platsupport/plat/i2c.h b/libplatsupport/plat_include/imx31/platsupport/plat/i2c.h deleted file mode 100644 index 40efe17..0000000 --- a/libplatsupport/plat_include/imx31/platsupport/plat/i2c.h +++ /dev/null
@@ -1,12 +0,0 @@ -/* - * Copyright 2017, Data61, CSIRO (ABN 41 687 119 230) - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -enum i2c_id { - NI2C -}; -
diff --git a/libplatsupport/plat_include/imx31/platsupport/plat/serial.h b/libplatsupport/plat_include/imx31/platsupport/plat/serial.h deleted file mode 100644 index c584b06..0000000 --- a/libplatsupport/plat_include/imx31/platsupport/plat/serial.h +++ /dev/null
@@ -1,38 +0,0 @@ -/* - * Copyright 2017, Data61, CSIRO (ABN 41 687 119 230) - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#define UART1_PADDR 0x43F90000 -#define UART2_PADDR 0x43F94000 -#define UART3_PADDR 0x5000C000 -#define UART4_PADDR 0x43FB0000 -#define UART5_PADDR 0x43FB4000 - -#define UART1_IRQ 45 -#define UART2_IRQ 32 -#define UART3_IRQ 18 -#define UART4_IRQ 46 -#define UART5_IRQ 47 - -/* official device names */ -enum chardev_id { - IMX31_UART1, - IMX31_UART2, - IMX31_UART3, - IMX31_UART4, - IMX31_UART5, - /* Aliases */ - PS_SERIAL0 = IMX31_UART1, - PS_SERIAL1 = IMX31_UART2, - PS_SERIAL2 = IMX31_UART3, - PS_SERIAL3 = IMX31_UART4, - /* defaults */ - PS_SERIAL_DEFAULT = IMX31_UART1 -}; - -#define DEFAULT_SERIAL_PADDR UART1_PADDR -#define DEFAULT_SERIAL_INTERRUPT UART1_IRQ
diff --git a/libplatsupport/plat_include/imx31/platsupport/plat/timer.h b/libplatsupport/plat_include/imx31/platsupport/plat/timer.h deleted file mode 100644 index 9ddba3b..0000000 --- a/libplatsupport/plat_include/imx31/platsupport/plat/timer.h +++ /dev/null
@@ -1,128 +0,0 @@ -/* - * Copyright 2019, Data61, CSIRO (ABN 41 687 119 230) - * - * SPDX-License-Identifier: BSD-2-Clause - */ -#pragma once - -#include <autoconf.h> -#include <platsupport/gen_config.h> -#include <platsupport/mach/gpt.h> -#include <platsupport/mach/epit.h> - -#define IPG_FREQ (500/8) /* 62.5MHz */ -#define GPT_FREQ IPG_FREQ - -#ifdef CONFIG_KERNEL_MCS -/* for RT, we use the EPIT as timestamp timer as the kernel is using the GPT */ - -typedef struct { - epit_t timestamp; - epit_t timeout; -} imx_timers_t; - -static inline uint64_t imx_get_time(imx_timers_t *timers) -{ - return epit_get_time(&timers->timestamp); -} - -static inline void imx_start_timestamp(imx_timers_t *timers) -{ - epit_set_timeout_ticks(&timers->timestamp, UINT32_MAX, true); -} - -static inline void imx_stop_timestamp(imx_timers_t *timers) -{ - epit_stop(&timers->timestamp); -} - -static inline int imx_init_timestamp(imx_timers_t *timers, ps_io_ops_t io_ops, ltimer_callback_fn_t user_callback, - void *user_callback_token) -{ - epit_config_t config = { - .io_ops = io_ops, - .user_callback = user_callback, - .user_callback_token = user_callback_token, - .device_path = EPIT1_PATH, - .is_timestamp = true, - .prescaler = 0, - }; - return epit_init(&timers->timestamp, config); -} - -static inline int imx_destroy_timestamp(imx_timers_t *timers) -{ - return epit_destroy(&timers->timestamp); -} -#else -/* for baseline, the timestamp timer is the GPT as the kernel is using EPIT1 */ - -typedef struct { - gpt_t timestamp; - epit_t timeout; -} imx_timers_t; - -static inline uint64_t imx_get_time(imx_timers_t *timers) -{ - return gpt_get_time(&timers->timestamp); -} - -static inline void imx_start_timestamp(imx_timers_t *timers) -{ - gpt_start(&timers->timestamp); -} - -static inline void imx_stop_timestamp(imx_timers_t *timers) -{ - gpt_stop(&timers->timestamp); -} - -static inline int imx_init_timestamp(imx_timers_t *timers, ps_io_ops_t io_ops, ltimer_callback_fn_t user_callback, - void *user_callback_token) -{ - gpt_config_t config = { - .io_ops = io_ops, - .user_callback = user_callback, - .user_callback_token = user_callback_token, - .device_path = GPT_PATH, - .prescaler = GPT_PRESCALER - }; - return gpt_init(&timers->timestamp, config); -} - -static inline int imx_destroy_timestamp(imx_timers_t *timers) -{ - return gpt_destroy(&timers->timestamp); -} -#endif - -/* for both kernel versions, we use EPIT2 as the timeout timer */ - -static inline int imx_set_timeout(imx_timers_t *timers, uint64_t ns, bool periodic) -{ - return epit_set_timeout(&timers->timeout, ns, periodic); -} - -static inline void imx_stop_timeout(imx_timers_t *timers) -{ - epit_stop(&timers->timeout); -} - -static inline int imx_init_timeout(imx_timers_t *timers, ps_io_ops_t io_ops, ltimer_callback_fn_t user_callback, - void *user_callback_token) -{ - epit_config_t config = { - .io_ops = io_ops, - .user_callback = user_callback, - .user_callback_token = user_callback_token, - .device_path = EPIT2_PATH, - .is_timestamp = false, - .prescaler = 0 - }; - return epit_init(&timers->timeout, config); -} - -static inline int imx_destroy_timeout(imx_timers_t *timers) -{ - return epit_destroy(&timers->timeout); -}
diff --git a/libplatsupport/src/arch/arm/irqchip/avic.c b/libplatsupport/src/arch/arm/irqchip/avic.c deleted file mode 100644 index fe079ab..0000000 --- a/libplatsupport/src/arch/arm/irqchip/avic.c +++ /dev/null
@@ -1,38 +0,0 @@ -/* - * Copyright 2019, Data61, CSIRO (ABN 41 687 119 230) - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include <assert.h> -#include <stdbool.h> - -#include <utils/util.h> - -#include "../../../irqchip.h" - -#define FSL_AVIC_INT_CELL_COUNT 1 - -static int parse_fsl_avic_interrupts(char *dtb_blob, int node_offset, int intr_controller_phandle, - irq_walk_cb_fn_t callback, void *token) -{ - bool is_extended = false; - int prop_len = 0; - const void *interrupts_prop = get_interrupts_prop(dtb_blob, node_offset, &is_extended, &prop_len); - assert(interrupts_prop != NULL); - int UNUSED total_cells = prop_len / sizeof(uint32_t); - /* There's only one interrupt cell for this IRQ chip */ - assert(total_cells == FSL_AVIC_INT_CELL_COUNT); - ps_irq_t irq = { .type = PS_INTERRUPT, .irq = { .number = READ_CELL(1, interrupts_prop, 0) }}; - int error = callback(irq, 0, FSL_AVIC_INT_CELL_COUNT, token); - if (error) { - return error; - } - return 0; -} - -char *fsl_avic_compatible_list[] = { - "fsl,imx31-avic", - NULL -}; -DEFINE_IRQCHIP_PARSER(fsl_avic, fsl_avic_compatible_list, parse_fsl_avic_interrupts);
diff --git a/libplatsupport/src/plat/imx31/chardev.c b/libplatsupport/src/plat/imx31/chardev.c deleted file mode 100644 index 1556c4e..0000000 --- a/libplatsupport/src/plat/imx31/chardev.c +++ /dev/null
@@ -1,50 +0,0 @@ -/* - * Copyright 2017, Data61, CSIRO (ABN 41 687 119 230) - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -/* - * Contains definitions for all character devices on this - * platform - */ - -#include "../../chardev.h" -#include "../../common.h" -#include <platsupport/serial.h> - -static const int uart1_irqs[] = {UART1_IRQ, -1}; -static const int uart2_irqs[] = {UART2_IRQ, -1}; -static const int uart3_irqs[] = {UART3_IRQ, -1}; -static const int uart4_irqs[] = {UART4_IRQ, -1}; -static const int uart5_irqs[] = {UART5_IRQ, -1}; - -#define UART_DEFN(devid) { \ - .id = IMX31_UART##devid, \ - .paddr = UART##devid##_PADDR, \ - .size = (1<<12), \ - .irqs = uart##devid##_irqs, \ - .init_fn = &uart_init \ - } - -static const struct dev_defn dev_defn[] = { - UART_DEFN(1), - UART_DEFN(2), - UART_DEFN(3), - UART_DEFN(4), - UART_DEFN(5) -}; - -/* It would be nice to reuse this, but it requires knowledge of the variable * - * sized 'dev_defn' */ -struct ps_chardevice* -ps_cdev_init(enum chardev_id id, const ps_io_ops_t* o, - struct ps_chardevice* d) { - unsigned int i; - for (i = 0; i < ARRAY_SIZE(dev_defn); i++) { - if (dev_defn[i].id == id) { - return (dev_defn[i].init_fn(dev_defn + i, o, d)) ? NULL : d; - } - } - return NULL; -}
diff --git a/libplatsupport/src/plat/imx31/clock.c b/libplatsupport/src/plat/imx31/clock.c deleted file mode 100644 index 3c391a0..0000000 --- a/libplatsupport/src/plat/imx31/clock.c +++ /dev/null
@@ -1,46 +0,0 @@ -/* - * Copyright 2017, Data61, CSIRO (ABN 41 687 119 230) - * - * SPDX-License-Identifier: BSD-2-Clause - */ -#include "../../arch/arm/clock.h" -#include "../../services.h" -#include <assert.h> -#include <string.h> -#include <utils/util.h> - -static volatile struct clock_regs { - int dummy; -} clk_regs; - -static int -imx31_gate_enable(clock_sys_t* clock_sys, enum clock_gate gate, enum clock_gate_mode mode) -{ - return -1; -} - -int -clock_sys_init(ps_io_ops_t* o, clock_sys_t* clock_sys) -{ - clock_sys->priv = (void*)&clk_regs; - clock_sys->get_clock = &ps_get_clock; - clock_sys->gate_enable = &imx31_gate_enable; - return 0; -} - -void -clk_print_clock_tree(clock_sys_t* sys) -{ - clk_t *clk = clk_get_clock(sys, CLK_MASTER); - clk_print_tree(clk, ""); -} - -static struct clock master_clk = { CLK_OPS_DEFAULT(MASTER) }; - -clk_t* ps_clocks[] = { - [CLK_MASTER] = &master_clk, -}; - -freq_t ps_freq_default[] = { - [CLK_MASTER] = 24 * MHZ, -};
diff --git a/libplatsupport/src/plat/imx31/mux.c b/libplatsupport/src/plat/imx31/mux.c deleted file mode 100644 index be4db67..0000000 --- a/libplatsupport/src/plat/imx31/mux.c +++ /dev/null
@@ -1,67 +0,0 @@ -/* - * Copyright 2017, Data61, CSIRO (ABN 41 687 119 230) - * - * SPDX-License-Identifier: BSD-2-Clause - */ -#include <stdint.h> -#include <utils/attribute.h> -#include <platsupport/mux.h> -#include "../../services.h" - -struct imx31_mux_regs { - int dummy; -}; - -static struct imx31_mux { - volatile struct imx31_mux_regs* mux; -} _mux; - -static inline struct imx31_mux* get_mux_priv(mux_sys_t* mux) { - return (struct imx31_mux*)mux->priv; -} - -static inline void set_mux_priv(mux_sys_t* mux, struct imx31_mux* imx31_mux) -{ - assert(mux != NULL); - assert(imx31_mux != NULL); - mux->priv = imx31_mux; -} - -static int -imx31_mux_feature_enable(mux_sys_t* mux, mux_feature_t mux_feature, UNUSED enum mux_gpio_dir mgd) -{ - struct imx31_mux* m; - if (mux == NULL || mux->priv == NULL) { - return -1; - } - m = get_mux_priv(mux); - - switch (mux_feature) { - default: - (void)m; - return -1; - } -} - -static int -imx31_mux_init_common(mux_sys_t* mux) -{ - set_mux_priv(mux, &_mux); - mux->feature_enable = &imx31_mux_feature_enable; - return 0; -} - -int -imx31_mux_init(void* bank1, - mux_sys_t* mux) -{ - (void)bank1; - return imx31_mux_init_common(mux); -} - -int -mux_sys_init(ps_io_ops_t* io_ops, UNUSED void *dependencies, mux_sys_t* mux) -{ - (void)io_ops; - return imx31_mux_init_common(mux); -}
diff --git a/libplatsupport/src/plat/imx31/serial.c b/libplatsupport/src/plat/imx31/serial.c deleted file mode 100644 index 4f48a38..0000000 --- a/libplatsupport/src/plat/imx31/serial.c +++ /dev/null
@@ -1,91 +0,0 @@ -/* - * Copyright 2017, Data61, CSIRO (ABN 41 687 119 230) - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include <stdlib.h> -#include <platsupport/serial.h> -#include <string.h> - -#include "../../chardev.h" - -#define IMXUART_DLL 0x000 -#define IMXUART_RHR 0x000 /* UXRD */ -#define IMXUART_THR 0x040 /* UTXD */ -#define IMXUART_UCR1 0x080 /* Control reg */ - -#define IMXUART_LSR 0x094 /* USR1 -- status reg */ -#define IMXUART_LSR_RXFIFIOE (1<<9) -#define IMXUART_LSR_RXOE (1<<1) -#define IMXUART_LSR_RXPE (1<<2) -#define IMXUART_LSR_RXFE (1<<3) -#define IMXUART_LSR_RXBI (1<<4) -#define IMXUART_LSR_TXFIFOE (1<<13) -#define IMXUART_LSR_TXSRE (1<<6) -#define IMXUART_LSR_RXFIFOSTS (1<<7) - -#define UART_RHR_READY_MASK (BIT(15)) -#define UART_BYTE_MASK 0xFF - -#define REG_PTR(base, offset) ((volatile uint32_t *)((char*)(base) + (offset))) - -int uart_getchar(ps_chardevice_t* d) -{ - int character = -1; - uint32_t data = 0; - - if (*REG_PTR(d->vaddr, IMXUART_LSR) & IMXUART_LSR_RXFIFIOE) { - data = *REG_PTR(d->vaddr, IMXUART_RHR); - if (data & UART_RHR_READY_MASK) { - character = data & UART_BYTE_MASK; - } - } - - return character; -} - -int uart_putchar(ps_chardevice_t* d, int c) -{ - if (*REG_PTR(d->vaddr, IMXUART_LSR) & IMXUART_LSR_TXFIFOE) { - *REG_PTR(d->vaddr, IMXUART_THR) = c; - if (c == '\n' && (d->flags & SERIAL_AUTO_CR)) { - uart_putchar(d, '\r'); - } - return c; - } else { - return -1; - } -} - -static void uart_handle_irq(ps_chardevice_t* d UNUSED) -{ - /* TODO */ -} - -int -uart_init(const struct dev_defn* defn, - const ps_io_ops_t* ops, - ps_chardevice_t* dev) -{ - - void* vaddr = chardev_map(defn, ops); - memset(dev, 0, sizeof(*dev)); - if (vaddr == NULL) { - return -1; - } - dev->id = defn->id; - dev->vaddr = vaddr; - dev->read = &uart_read; - dev->write = &uart_write; - dev->handle_irq = &uart_handle_irq; - dev->irqs = defn->irqs; - dev->ioops = *ops; - dev->flags = SERIAL_AUTO_CR; - - /* - * Enable interrupts for receiver - */ - *REG_PTR(dev->vaddr, IMXUART_UCR1) |= IMXUART_LSR_RXFIFIOE; - return 0; -}