-
Notifications
You must be signed in to change notification settings - Fork 8k
Initial support for microchip cec1702 #5383
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
Conversation
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 board, SoC, and HAL import should all be separate commits. The HAL commit message should conform to what is specified in CONTRIBUTING.rst
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.
All *.c & *.h files should have copyright/SPDX license info.
Also missing board docs. All new boards require board docs.
@galak Thanks, will fix accordingly. Any comments on the Kconfig things? I was not fully sure how to name/use some of the board specifics, but I did what seemed to make sense and works.
I am next working on SPI and SPI Flash drivers. Is there any work on a generic SPI flash driver that I could reuse? I will need few flash specific overrides, but otherwise it's pretty generic chip on the demo board: SST26VF016B. PINCTRL and GPIO drivers will probably come too later. |
#ifdef CONFIG_UART_NS16550_PORT_0 | ||
PCR->CLK_REQ_2 |= 1 << 1; /* Clock: UART0 */ | ||
GPIO_100_137->GPIO_104_PIN_CONTROL = 1 << 12; /* GPIO104 Alt1 = UART0_TX */ | ||
GPIO_100_137->GPIO_105_PIN_CONTROL = 1 << 12; /* GPIO105 Alt1 = UART0_RX */ |
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.
We usually do pinmuxing in the board init rather than the SoC init
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.
Ah, ok. I'll move the board specifics there. Eventually the pinmuxing will be done from the dts when pinctrl driver works.
GPIO054 = LED Red | ||
GPIO053 = LED Green | ||
GPIO001 = LED Blue | ||
GPIO157 = LED White |
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.
This comment block should be removed
CONFIG_BOARD_SECUREIOT1702=y | ||
CONFIG_CORTEX_M_SYSTICK=y | ||
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=48000000 | ||
CONFIG_HAS_DTS=y |
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.
This line shouldn't be here
ext/hal/Kconfig
Outdated
|
||
source "ext/hal/altera/Kconfig" | ||
|
||
source "ext/hal/cec/Kconfig" |
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.
Let's use "ext/hal/microchip/cec" instead
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.
I make it cec1702 then. There's also cec1302 which is older version. Has same cpu but different peripheral blocks (especially the crypto side).
ext/hal/cec/include/system_MEC2016.h
Outdated
* CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF | ||
* FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. | ||
* MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE | ||
* OF THESE TERMS. |
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.
This looks like a new license and will need approval by the gov board
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.
This file should not be there. I'll remove it, it's unneeded.
Change requests addressed. Please review again. Copyright notices also added. This work from @CryptaLabs. |
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.
CPU_FAMILY_CEC seems undefined
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.
Right. This was little bit hazy for me on how and where to define SOC_FAMILY
, SOC_SERIES
and which type of CPU_{FAMILY,SERIES}_CEC
things to define. Having that config split to Kconfig
, Kconfig.soc
, Kconfig.defconfig
, etc. could be little bit less cluttered. I ended up not defining the family at all since there seems to be only two CEC CPUs at the moment. Maybe I'll just change this to CPU_SERIES_CEC
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.
SOC_PART_NUMBER_CEC1702 seems undefined
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.
Same here. I just change this to SOC_CEC1702
.
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.
Thanks for getting the documentation started. We've got a recommended template for board documentation at doc/templates/board.tmpl (in your cloned copy of the zephyr tree).
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.
Ok, will take it from there. I also have pending patches for IRQ support, and QMSPI host driver for CEC. As well as generic SPI flash (auto-detects way to access chip using SFDP) driver. I will possibly also work on gpio, pinmux, clock drivers.
f753b77
to
fd8e4a6
Compare
Can update this to current and I'll review again towards getting it in tree |
Rebase against master, addressed most checkpatch issues. |
Codecov Report
@@ Coverage Diff @@
## master #5383 +/- ##
=======================================
Coverage 48.25% 48.25%
=======================================
Files 293 293
Lines 44130 44130
Branches 10591 10591
=======================================
Hits 21296 21296
Misses 18567 18567
Partials 4267 4267 Continue to review full report at Codecov.
|
It seems to be pretty free. The header file carries this:
|
Do you mind bring this PR up to date w/latest mater. I need to start a license review for the HAL since its not using a standard license. I don't see any issues w/it. |
@galak The conflict is simple to resolve. But seems the SoC stuff resides in new directory. Could you point an example commit how to add a new soc / soc-family (+ soc-series if needed) on the new layout and what the Kconfig files should be named like? |
Sure, pretty much we just moved commit 537798d
|
@galak Mechanical rebase done. Builds again the hello sample. Unfortunately, have not boot tested yet. |
thanks, I submitted the license for review, with the Thanksgiving Holiday in the US its going to delay things a bit. |
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.
So the whole CONFIG_UART_NS16550_PORT_0_BRD_MASK needs to be changed.
- I don't see this used anywhere
- If we need this, do it for the more specific feature you need (ie alternate clock source)
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.
Some updates to the board code needed.
boards/arm/secureiot1702/board.h
Outdated
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.
remove board.h
boards/arm/secureiot1702/dts_fixup.h
Outdated
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.
clock frequency should be a property in the .dts file
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 qmspi change seems to be missing a dts binding file. Also I'd like to pull that PR out so its get seen by the SPI guys.
Found the following issues, please fix and resubmit: License/Copyright issues
|
@tbursztyka Can you look at the SPI driver in this PR. |
Fixed bunch of the review issues. Regarding Perhaps, I add a CONFIG_UART_NS16550_CEC_CLOCK_SELECT, and it will set the correct bit if CLK_FREQ >= 10Mhz or similar? Or even just add that to happen automatically if SOC_SERIES_CEC is defined? |
It is SOC / chip implementation specific feature, and does not always correspond to the IO access method. Signed-off-by: Timo Teräs <[email protected]>
Add the Microchip CEC1702 HAL sources from CEC1702 SDK. Origin: Microchip CEC1702 SDK URL: http://www.microchip.com/SWLibraryWeb/product.aspx?product=CEC1702_SDK Version: B0 build 0300 Purpose: Provides HAL support to Microchip CEC1702 Maintained-by: External Signed-off-by: Timo Teräs <[email protected]>
Basic support for the SoC and the UARTs in it. UART divider is reset to register value zero which the chip treats as 3. Thus the default baud rate for the chip is 38400. The SoC has external interrupt controller (EC) which is configured to pass-through all interrupts to NVIC. Support for the EC may need to be implemented better if/when deep sleep modes are implemented. Signed-off-by: Timo Teräs <[email protected]>
Add basic secureiot1072 support with serial ports. Tested with hello_world to run and work as expected. Signed-off-by: Timo Teräs <[email protected]>
CEC1702 ns16550 compatible UART has alternate high-speed clock selectable with the high bit of the baud rate divisor register. Signed-off-by: Timo Teräs <[email protected]>
This is the Quad Master-only SPI host driver. Signed-off-by: Timo Teräs <[email protected]>
@galak Ping. Reworked The NS16550 UART alternate clock select to have SoC specific block in the uart driver. That simplifies things quite a bit. Let me know if would have a better approach. I hope we could get this merged in soonish. It's been pending a long time... |
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.
Documentation is better, but still missing Flashing and Debugging section content.
I will work out the Flashing section. The vendor provider stuff is all Windows -based. Getting it done in generic way is doable, but may need some extras. Any way it boots from external SPI chip, so the thing is to have SPI flasher. What comes to Debugging, I don't have much experience as I never used hardware debugger. The SoC and board has standard JTAG support, but I basically never used it. So It is not really possible for me anything else that "Standard JTAG supported." or similar. Would that be sufficient for the time being?
Much of the time has been waiting review - or scheduling some cycles to this. Howevre, I am still happy to do requested changes as possible. I really hope we could get this to acceptable state so others can start building on it. I have had some private questions asked on this. There is now another demo board built on this SoC, and there is also four new SoCs (MEC1701, MEC1703, MEC1704 and MEC1705) which are of same core/family. |
closing as stale |
@galak Finally got to making this PR as promised way earlier. Please take a look if things are done in a sane way, or need fixing.