-
Notifications
You must be signed in to change notification settings - Fork 5
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
base: eos-s3-support
Are you sure you want to change the base?
Changes from 10 commits
8bc4dfe
e0d1cd8
c6d0b60
23a41e9
a41c59c
4fd38e5
ddf3b96
a4d3c29
6482500
b79b107
4d24409
a2f81ec
bebbda4
ef50ce5
d734cd4
077d7dc
0a68171
be93005
4c72824
09ce621
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we just name it There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we just name it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll rename to Kconfig.eos_s3_basic |
||
|
||
endif # LED |
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Without There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||
|
Large diffs are not rendered by default.
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 */ |
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(); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change to There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) |
There was a problem hiding this comment.
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.There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
containPWM_LITEX
? If not you must add separate config entry like explained here.There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.