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

New QL LED driver #3

Open
wants to merge 20 commits into
base: eos-s3-support
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
8bc4dfe
Modified e0s-s3-hal remote path
spingaliQL May 27, 2020
e0d1cd8
Merge pull request #1 from QuickLogic-Corp/manifest_changes
spingaliQL May 27, 2020
c6d0b60
added new led driver for S3. Added qf_helloworldhw sample. The led dr…
spingaliQL May 29, 2020
23a41e9
Merge pull request #2 from QuickLogic-Corp/qf_helloworldhw
spingaliQL May 29, 2020
a41c59c
Load litex PWM FPGA from M4
spingaliQL Jun 5, 2020
4fd38e5
Merge pull request #3 from QuickLogic-Corp/eos_s3_pwm_loader
spingaliQL Jun 5, 2020
ddf3b96
moved qf_hellowworld sample to led driver samples
spingaliQL Jun 9, 2020
a4d3c29
Merge pull request #4 from QuickLogic-Corp/eos_s3_led_sample1
spingaliQL Jun 15, 2020
6482500
Fix:Removed Hello world print.
spingaliQL Jun 15, 2020
b79b107
Merge pull request #5 from QuickLogic-Corp/eos_s3_led_sample1
spingaliQL Jun 15, 2020
4d24409
Changed offset and added sleep after write
spingaliQL Jun 17, 2020
a2f81ec
Changes for flash samples
spingaliQL Jun 25, 2020
bebbda4
Merge branch 'eos-s3-support' of https://github.com/QuickLogic-Corp/z…
spingaliQL Jun 26, 2020
ef50ce5
Changes for Antmicro code review
spingaliQL Jun 26, 2020
d734cd4
Merge branch 'code_review_changes1' into spi_flash_samples
spingaliQL Jun 26, 2020
077d7dc
Merge pull request #6 from QuickLogic-Corp/code_review_changes1
spingaliQL Jun 26, 2020
0a68171
Merge branch 'eos-s3-support' of https://github.com/QuickLogic-Corp/z…
spingaliQL Jun 26, 2020
be93005
Merge pull request #7 from QuickLogic-Corp/spi_flash_samples
spingaliQL Jun 26, 2020
4c72824
spi flash sample offset fix
spingaliQL Jul 7, 2020
09ce621
Merge pull request #8 from QuickLogic-Corp/spi_flash_sample_fix
spingaliQL Jul 7, 2020
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
2 changes: 1 addition & 1 deletion boards/arm/quick_feather/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ config BOARD
if PWM

config PWM_LITEX
select SOC_EOS_S3_FPGA
select EOS_S3_PROGRAM_FPGA

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not change this selection, because SOC_EOS_S3_FPGA configuration tells software if we want to initialize FPGA or not here. Without it clocks won't be set up.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main change I made in these commits is to program FPGA from M4 program itself, instead of doing it outside using Jlink. To enable this feature I have added EOS_S3_PROGRAM_FPGA. If someone wants to use the old way, one can enable SOC_EOS_S3_FPGA. I have not made any changes in this flow. Since all clocks are enabled with EOS_S3_PROGRAM_FPGA, other is not required. So EOS_S3_PROGRAM_FPGA and SOC_EOS_S3_FPGA are mutually exclusive.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does eos_s3_pwm_ip.h contain PWM_LITEX? If not you must add separate config entry like explained here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it doesn't.
I'll add separate config entry.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added new configuration. However I understand from our H/W team that we are using litex pwm IP only, the bit stream is generated using symbi flow tools (with EOS S3 support). Our driver just loads the FPGA IP. It doesn't have full functions. For that I have to use pwm litex driver. So I have included that too.

default y

kowalewskijan marked this conversation as resolved.
Show resolved Hide resolved
endif # PWM
Expand Down
1 change: 1 addition & 0 deletions drivers/led/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just name it led_eos_s3.c ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are planning to have one more version of LED controller. I'll call this led_eos_s3_basic.c. "_1" is not giving good meaning. I'll apply this change in all related files/config.


zephyr_sources_ifdef(CONFIG_USERSPACE led_handlers.c)
1 change: 1 addition & 0 deletions drivers/led/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +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"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just name it Kconfig.eos_s3 ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll rename to Kconfig.eos_s3_basic


endif # LED
8 changes: 8 additions & 0 deletions drivers/led/Kconfig.eos_s3_1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) 2018 Workaround GmbH
spingaliQL marked this conversation as resolved.
Show resolved Hide resolved
# SPDX-License-Identifier: Apache-2.0

config EOS_S3_LED1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without 1? I'm not sure why you use this nomenclature with 1 at the end. Will it be more versions of driver?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a simple LED controller and an advanced one. I'll call all "1" as "basic"

bool "EOS S3 LED driver 1"
help
Enable LED driver 1 for QL S3.

1,901 changes: 1,901 additions & 0 deletions drivers/led/eos_s3_led1_ip.h

Large diffs are not rendered by default.

58 changes: 58 additions & 0 deletions drivers/led/eos_s3_led_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* ==========================================================
*
* 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 : eos_s3_led_config.h
* Purpose : This file contains the IO mux definitions for LEDs
*
*
* ===========================================================
*
*/


#ifndef _INC_EOS_S3_LED_CONFIG
#define _INC_EOS_S3_LED_CONFIG

#include <soc_pinmap.h>

/* Set FPGA_LED0 to PAD18 */
#define FPGA_LED0_PAD18 (PAD_CTRL_SEL_FPGA | PAD_OEN_NORMAL \
| PAD_P_Z | PAD_SR_SLOW | PAD_E_4MA \
| PAD_REN_DISABLE | PAD_SMT_DISABLE)
#define FPGA_LED0_PAD18_FBIO PAD18_FUNC_SEL_FBIO_18

/* Set FPGA_LED1 to PAD21 */
#define FPGA_LED1_PAD21 (PAD_CTRL_SEL_FPGA | PAD_OEN_NORMAL \
| PAD_P_Z | PAD_SR_SLOW | PAD_E_4MA \
| PAD_REN_DISABLE | PAD_SMT_DISABLE)
#define FPGA_LED1_PAD21_FBIO PAD21_FUNC_SEL_FBIO_21

/* Set FPGA_LED2 to PAD22 */
#define FPGA_LED2_PAD22 (PAD_CTRL_SEL_FPGA | PAD_OEN_NORMAL \
| PAD_P_Z | PAD_SR_SLOW | PAD_E_4MA \
| PAD_REN_DISABLE | PAD_SMT_DISABLE)
#define FPGA_LED2_PAD22_FBIO PAD22_FUNC_SEL_FBIO_22

#define FPGA_LED0_PAD 18
#define FPGA_LED0_PAD_CFG FPGA_LED0_PAD18
#define FPGA_LED0_FBIO_SEL FPGA_LED0_PAD18_FBIO
#define FPGA_LED1_PAD 21
#define FPGA_LED1_PAD_CFG FPGA_LED1_PAD21
#define FPGA_LED1_FBIO_SEL FPGA_LED1_PAD21_FBIO
#define FPGA_LED2_PAD 22
#define FPGA_LED2_PAD_CFG FPGA_LED2_PAD22
#define FPGA_LED2_FBIO_SEL FPGA_LED2_PAD22_FBIO


#endif /* _INC_EOS_S3_LED_CONFIG */
49 changes: 49 additions & 0 deletions drivers/led/led_eos_s3_1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* ==========================================================
*
* 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 : led_eos_s3_1.c
* Purpose : This is the driver for LED controller IP.
*
*
* ===========================================================
*
*/

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

static void config_ios()
{
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);

}

void program_fpga_ip()
spingaliQL marked this conversation as resolved.
Show resolved Hide resolved
{
// Load bitstrem into FPGA
spingaliQL marked this conversation as resolved.
Show resolved Hide resolved
load_fpga(sizeof(axFPGABitStream),axFPGABitStream);
spingaliQL marked this conversation as resolved.
Show resolved Hide resolved

// Configure IOs
spingaliQL marked this conversation as resolved.
Show resolved Hide resolved
config_ios();
}

1 change: 1 addition & 0 deletions drivers/pwm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ 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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to CONFIG_PWM_EOS_S3

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. Will do.


zephyr_library_sources_ifdef(CONFIG_USERSPACE pwm_handlers.c)
zephyr_library_sources_ifdef(CONFIG_PWM_SHELL pwm_shell.c)
Loading