Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Antmicro Code review changes #6

Merged
merged 3 commits into from
Jun 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions boards/arm/quick_feather/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ config BOARD
if PWM

config PWM_LITEX
select SOC_EOS_S3_FPGA
default n

config EOS_S3_PWM
select EOS_S3_PROGRAM_FPGA
default y

Expand Down
2 changes: 1 addition & 1 deletion boards/arm/quick_feather/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ static int eos_s3_board_init(struct device *arg)
eos_s3_io_mux(SPI_SS1_PAD, SPI_SS1_PAD_CFG);
#endif

#ifdef CONFIG_PWM_LITEX
#if defined CONFIG_PWM_LITEX || CONFIG_EOS_S3_PWM
eos_s3_io_mux(PWM0_PAD, PWM0_PAD_CFG);
eos_s3_io_mux(PWM1_PAD, PWM1_PAD_CFG);
eos_s3_io_mux(PWM2_PAD, PWM2_PAD_CFG);
Expand Down
2 changes: 1 addition & 1 deletion boards/arm/quick_feather/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#define SPI_SS1_PAD_CFG SPI_SS1_PAD39
#endif /* CONFIG_SPI_EOS_S3 */

#ifdef CONFIG_PWM_LITEX
#if defined CONFIG_PWM_LITEX || CONFIG_EOS_S3_PWM
/* FPGA IP core peripherals */
#define DT_PWM_GEN_EOS_S3_BASE_ADDRESS DT_QUICKLOGIC_EOS_S3_PWM_GEN_40020000_BASE_ADDRESS
#define DT_PWM_GEN_EOS_S3_DIVIDER DT_QUICKLOGIC_EOS_S3_PWM_GEN_40020000_DIVIDER
Expand Down
2 changes: 1 addition & 1 deletion drivers/led/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ zephyr_sources_ifdef(CONFIG_HT16K33 ht16k33.c)
zephyr_sources_ifdef(CONFIG_LP3943 lp3943.c)
zephyr_sources_ifdef(CONFIG_LP5562 lp5562.c)
zephyr_sources_ifdef(CONFIG_PCA9633 pca9633.c)
zephyr_sources_ifdef(CONFIG_EOS_S3_LED1 led_eos_s3_1.c)
zephyr_sources_ifdef(CONFIG_EOS_S3_LED_BASIC led_eos_s3_basic.c)

zephyr_sources_ifdef(CONFIG_USERSPACE led_handlers.c)
2 changes: 1 addition & 1 deletion drivers/led/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ source "drivers/led/Kconfig.ht16k33"
source "drivers/led/Kconfig.lp3943"
source "drivers/led/Kconfig.lp5562"
source "drivers/led/Kconfig.pca9633"
source "drivers/led/Kconfig.eos_s3_1"
source "drivers/led/Kconfig.eos_s3_basic"

endif # LED
8 changes: 0 additions & 8 deletions drivers/led/Kconfig.eos_s3_1

This file was deleted.

8 changes: 8 additions & 0 deletions drivers/led/Kconfig.eos_s3_basic
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright 2020 QuickLogic
# Licensed under the Apache License, Version 2.0

config EOS_S3_LED_BASIC
bool "EOS S3 basic LED driver"
help
Enable basic LED driver for QL S3.

File renamed without changes.
32 changes: 16 additions & 16 deletions drivers/led/led_eos_s3_1.c → drivers/led/led_eos_s3_basic.c
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
/*
* ==========================================================
*
* Copyright (C) 2020 QuickLogic Corporation
* Copyright (C) 2020 QuickLogic Corporation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* File : led_eos_s3_1.c
* Purpose : This is the driver for LED controller IP.
*
*
* File : led_eos_s3_basic.c
* Purpose : This is the driver for basic LED controller IP.
*
*
* ===========================================================
*
*/

#include <zephyr.h>
#include <soc.h>
#include <fpga_loader.h>
#include "eos_s3_led1_ip.h"
#include "eos_s3_led_basic_ip.h"
#include "eos_s3_led_config.h"

static void config_ios()
static void config_ios(void)
{
eos_s3_io_mux(FPGA_LED0_PAD, FPGA_LED0_PAD_CFG);
eos_s3_io_mux(FPGA_LED1_PAD, FPGA_LED1_PAD_CFG);
eos_s3_io_mux(FPGA_LED2_PAD, FPGA_LED2_PAD_CFG);

eos_s3_fbio_select(FPGA_LED0_PAD,FPGA_LED0_FBIO_SEL);
eos_s3_fbio_select(FPGA_LED1_PAD,FPGA_LED1_FBIO_SEL);
eos_s3_fbio_select(FPGA_LED2_PAD,FPGA_LED2_FBIO_SEL);
eos_s3_fbio_select(FPGA_LED0_PAD, FPGA_LED0_FBIO_SEL);
eos_s3_fbio_select(FPGA_LED1_PAD, FPGA_LED1_FBIO_SEL);
eos_s3_fbio_select(FPGA_LED2_PAD, FPGA_LED2_FBIO_SEL);

}

void program_fpga_ip()
void program_fpga_ip(void)
{
// Load bitstrem into FPGA
load_fpga(sizeof(axFPGABitStream),axFPGABitStream);
/* Load bitstrem into FPGA */
load_fpga(sizeof(axFPGABitStream), axFPGABitStream);

// Configure IOs
/* Configure IOs */
config_ios();
}

3 changes: 2 additions & 1 deletion drivers/pwm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ zephyr_library_sources_ifdef(CONFIG_PWM_SAM pwm_sam.c)
zephyr_library_sources_ifdef(CONFIG_PWM_MCUX pwm_mcux.c)
zephyr_library_sources_ifdef(CONFIG_PWM_XEC pwm_mchp_xec.c)
zephyr_library_sources_ifdef(CONFIG_PWM_LITEX pwm_litex.c)
zephyr_library_sources_ifdef(CONFIG_PWM_LITEX pwm_eos_s3.c)
zephyr_library_sources_ifdef(CONFIG_EOS_S3_PWM pwm_litex.c)
zephyr_library_sources_ifdef(CONFIG_EOS_S3_PWM pwm_eos_s3.c)

zephyr_library_sources_ifdef(CONFIG_USERSPACE pwm_handlers.c)
zephyr_library_sources_ifdef(CONFIG_PWM_SHELL pwm_shell.c)
2 changes: 2 additions & 0 deletions drivers/pwm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,6 @@ source "drivers/pwm/Kconfig.xec"

source "drivers/pwm/Kconfig.litex"

source "drivers/pwm/Kconfig.eos_s3"

endif # PWM
18 changes: 18 additions & 0 deletions drivers/pwm/Kconfig.eos_s3
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2020 QuickLogic
# Licensed under the Apache License, Version 2.0

menuconfig EOS_S3_PWM
bool "EOS S3 LiteX PWM driver"
depends on HAS_DTS
help
Set if PWM IP generated with EOS S3 tools

if EOS_S3_PWM

config PWM_LITEX_INIT_PRIORITY
int "Init priority"
default 70
help
PWM device driver initialization priority.

endif # PWM_LITEX
15 changes: 7 additions & 8 deletions drivers/pwm/pwm_eos_s3.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*
* ==========================================================
*
* Copyright (C) 2020 QuickLogic Corporation
* Copyright (C) 2020 QuickLogic Corporation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -14,20 +14,19 @@
*
* File : pwm_eos_s3.c
* Purpose : This file has the function to load pwm fpga ip
*
*
* ===========================================================
*
*
* ===========================================================
*/

#include <zephyr.h>
#include <soc.h>
#include <fpga_loader.h>
#include "eos_s3_pwm_ip.h"

void program_fpga_ip()
void program_fpga_ip(void)
{
// Load bitstrem into FPGA
load_fpga(sizeof(axFPGABitStream),axFPGABitStream);
/* Load bitstrem into FPGA */
load_fpga(sizeof(axFPGABitStream), axFPGABitStream);
}

8 changes: 0 additions & 8 deletions samples/drivers/led_eos_s3_1/sample.yaml

This file was deleted.

23 changes: 0 additions & 23 deletions samples/drivers/led_eos_s3_1/src/main.c

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2020 QuickLogic Corporation
# Licensed under the Apache License, Version 2.0

cmake_minimum_required(VERSION 3.13.1)
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(led_eos_s3_1)
project(led_eos_s3_basic)

FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.. _eos_s3_1:
.. _eos_s3_basic:

EOS_S3_1: Preconfigured LED
EOS_S3_BASIC: Preconfigured LED
###########################

Overview
********

This sample blinks the LEDs which is preconfigured in the FPGA IP:
This sample blinks the LEDs which is preconfigured in the FPGA IP


Building and Running
Expand All @@ -15,7 +15,7 @@ Building and Running
Build the application for the :ref:`quick_feather` board.

.. zephyr-app-commands::
:zephyr-app: samples/drivers/led_eos_s3_1
:zephyr-app: samples/drivers/led_eos_s3_basic
:board: quick_feather
:goals: build
:compact:
Expand Down
8 changes: 8 additions & 0 deletions samples/drivers/led_eos_s3_basic/sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
sample:
description: Demonstration of the eos_s3 basic LED driver
name: led_eos_s3_basic sample
tests:
sample.drivers.led.eos_s3_basic:
platform_whitelist: quick_feather
tags: led
harness: TBD
36 changes: 36 additions & 0 deletions samples/drivers/led_eos_s3_basic/src/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* ==========================================================
*
* Copyright (C) 2020 QuickLogic Corporation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* File : main.c
* Purpose : This file has simple prints.
* No other configuration needs to be done here
*
* ===========================================================
*/

#include <zephyr.h>
#include <device.h>
#include <soc.h>

void main(void)
{
printk("\n\n");
printk("##########################\n");
printk("Quicklogic Open Platform 2.0\n");
printk("SW Version: ");
printk(" OP2-QuickFeather-led-eos-s3-basic sample");
printk("\n");
printk(__DATE__ " " __TIME__ "\n");
printk("##########################\n\n");
}
4 changes: 3 additions & 1 deletion samples/drivers/spi_flash/src/main.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#error Unsupported flash driver
#endif

#define FLASH_TEST_REGION_OFFSET 0xff000
#define FLASH_TEST_REGION_OFFSET 0x100000
#define FLASH_SECTOR_SIZE 4096

void main(void)
Expand Down Expand Up @@ -68,6 +68,8 @@ void main(void)
printf("Flash write failed! %d\n", rc);
return;
}
// Sleep for a while
k_sleep(100); //in ms

memset(buf, 0, len);
rc = flash_read(flash_dev, FLASH_TEST_REGION_OFFSET, buf, len);
Expand Down
3 changes: 2 additions & 1 deletion soc/arm/quicklogic_eos_s3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ zephyr_include_directories(${ZEPHYR_BASE}/drivers)
zephyr_sources(
soc.c
irq_handlers.c
fpga_loader.c
)
zephyr_sources_ifdef(CONFIG_EOS_S3_PROGRAM_FPGA fpga_loader.c)

2 changes: 1 addition & 1 deletion soc/arm/quicklogic_eos_s3/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ config SPI_EOS_S3
endif # SPI

if LED
config EOS_S3_LED1
config EOS_S3_LED_BASIC
select EOS_S3_PROGRAM_FPGA
default y
endif # LED
Expand Down
Loading