-
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 all 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 |
---|---|---|
@@ -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. | ||
|
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_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_led_basic_ip.h" | ||
#include "eos_s3_led_config.h" | ||
|
||
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); | ||
|
||
} | ||
|
||
void program_fpga_ip(void) | ||
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 thought about loading bitstream inside other drivers and I came to conclusion that the best solution would be to introduce a new type of driver in Zephyr - FPGA manager. We should add |
||
{ | ||
/* Load bitstrem into FPGA */ | ||
load_fpga(sizeof(axFPGABitStream), axFPGABitStream); | ||
|
||
/* Configure IOs */ | ||
config_ios(); | ||
} | ||
|
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 |
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.