U-Boot
Threads by month
- ----- 2025 -----
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2000 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
May 2021
- 191 participants
- 563 discussions

[PATCH u-boot-dm + u-boot-spi v4 00/10] Support SPI NORs and OF partitions in `mtd list`
by Marek Behún 09 Jul '21
by Marek Behún 09 Jul '21
09 Jul '21
Hello,
this is v4 of patchset that adds support for U-Boot to parse MTD
partitions from device-tree, and also improves support for SPI NOR
access via the `mtd` command.
Small rebase was needed since last version.
Finally passing CI since LTO is now merged and can optimize away the
code increase. CI at https://github.com/u-boot/u-boot/pull/55
Changes since v3:
- rebased against current master (removed first patch, not needed
anymore)
- check for CONFIG_OF_CONTROL in addition to CONFIG_DM, since we are
also using ofnode_* functions
- match mtd's name in a separate function to make code more readable.
Also add non-DM version of this name matching function, since #if
macro must be used (otherwise CI will fail for configurations with
disabled DM)
- addressed Simon's comments about using IS_ENABLED instead of #ifdefs
- added Miquel's Reviewed-by and Patrice's Tested-by to the whole series
Changes since v2:
- addressed Pali's comments in patch that adds partition parsing (4/7 in
this version): no check for whether the `compatible` property is
present in a partition node and added comment explaining mask flags)
- added 4 more patches:
1) adding ofnode_get_path() function
2) printing OF path in `mtd list`
3) in `mtd read <name> ...`, <name> can now also be DM's device name
or OF path
4) the fact from 3) is added to `mtd help`
Changes since v1:
- added tests of ofnode_get_addr_size_index() and
ofnode_get_addr_size_index_notrans() as requested by Simon
- the last patch now probes SPI NORs in both versions of
mtd_probe_devices(), that is when MTDPARTS is enabled or disabled
Marek
Cc: Jagan Teki <jagan(a)amarulasolutions.com>
Cc: Priyanka Jain <priyanka.jain(a)nxp.com>
Cc: Simon Glass <sjg(a)chromium.org>
Cc: Heiko Schocher <hs(a)denx.de>
Cc: Jagan Teki <jagan(a)amarulasolutions.com>
Cc: Patrick Delaunay <patrick.delaunay(a)st.com>
Cc: Patrice CHOTARD <patrice.chotard(a)foss.st.com>
Cc: Miquel Raynal <miquel.raynal(a)bootlin.com>
Marek Behún (10):
dm: core: add non-translating version of ofnode_get_addr_size_index()
dm: core: add ofnode_get_path()
mtd: add support for parsing partitions defined in OF
mtd: spi-nor: allow registering multiple MTDs when DM is enabled
mtd: spi-nor: fill-in mtd->dev member
mtd: remove mtd_probe() function
mtd: probe SPI NOR devices in mtd_probe_devices()
cmd: mtd: print device OF path in listing
mtd: compare also with OF path and device name in get_mtd_device_nm()
cmd: mtd: expand <name> argument definition in command help
cmd/mtd.c | 9 ++-
drivers/core/ofnode.c | 44 ++++++++++-
drivers/mtd/mtd-uclass.c | 15 ----
drivers/mtd/mtd_uboot.c | 129 ++++++++++++++++++++-------------
drivers/mtd/mtdcore.c | 35 +++++++++
drivers/mtd/mtdpart.c | 63 ++++++++++++++++
drivers/mtd/spi/sf_internal.h | 4 +-
drivers/mtd/spi/sf_mtd.c | 19 ++++-
drivers/mtd/spi/sf_probe.c | 6 +-
drivers/mtd/spi/spi-nor-core.c | 1 +
drivers/mtd/spi/spi-nor-tiny.c | 1 +
include/dm/ofnode.h | 27 +++++++
include/linux/mtd/mtd.h | 10 +++
include/mtd.h | 1 -
test/dm/ofnode.c | 26 +++++++
15 files changed, 315 insertions(+), 75 deletions(-)
--
2.26.3
4
19

RE: [TF-A] Proposal: TF-A to adopt hand-off blocks (HOBs) for information passing between boot stages
by Madhukar Pappireddy 08 Jul '21
by Madhukar Pappireddy 08 Jul '21
08 Jul '21
Attached slides presented by Manish in the TF-A tech forum.
-----Original Message-----
From: TF-A <tf-a-bounces(a)lists.trustedfirmware.org> On Behalf Of Madhukar Pappireddy via TF-A
Sent: Tuesday, May 18, 2021 8:59 PM
To: Joanna Farley <Joanna.Farley(a)arm.com>; Okash Khawaja <okash.khawaja(a)gmail.com>; Simon Glass <sjg(a)chromium.org>
Cc: Harb Abdulhamid OS <abdulhamid(a)os.amperecomputing.com>; Boot Architecture Mailman List <boot-architecture(a)lists.linaro.org>; Ed Stuber <edstuber(a)amperecomputing.com>; Arjun Khare <akhare(a)amperecomputing.com>; U-Boot Mailing List <u-boot(a)lists.denx.de>; tf-a(a)lists.trustedfirmware.org; Paul Isaac's <paul.isaacs(a)linaro.org>; Ron Minnich <rminnich(a)google.com>; Moe Ammar <moe(a)amperecomputing.com>
Subject: Re: [TF-A] Proposal: TF-A to adopt hand-off blocks (HOBs) for information passing between boot stages
Hi,
I tried to summarize the discussions in the previous TF-A tech forum regarding the proposal to adopt Hand-off Blocks (HOBs) for passing information along the boot chain. I am certain I could not capture all suggestions/concerns brought up during the call. I apologize if I missed and/or misinterpreted any comments and would appreciate it if everyone could share their thoughts in response to this email thread.
The idea is to share information to other boot phases:
> Dynamic information: Created during runtime. Shared in the form of a chain of blobs(built as a linked list of C structure objects i.e., HOB list).
> Static information: Known at compile time. Historically, shared through the use of Device Tree/ACPI tables
Both the above requirements are common in many ecosystems and need to co-exist.
There are broadly 3 problems to solve:
1. Format of HOB structures: It looks like the consensus is that we could use existing mechanisms for this (BL_AUX_PARAM in TF-A or bloblist in u-boot).
2. Identification of HOB list entries: There is a debate about whether tags would suffice or if the HOB list producer and consumer would depend on UUID/GUIDs for identifying a specific HOB structure. Another suggestion was to use a hybrid approach. Reserve a single tag ID for identifying/constructing a HOB structure that further leverages UUID based identifier. This way, the generic HOB list doesn't need to support UUIDs and can work with tags.
3. The design contract for the static interface between two boot phases: The problem at hand is whether to pass a pointer to a HOB list or a device tree blob through the general-purpose registers for configuration hand-off between two boot phases. Some proposals that came up:
> Proposal 1: Always pass a pointer to the device tree blob through the GP register and capture the pointer to the HOB list as a property of a node that is uniquely identifiable by the downstream boot phase. This needs to define a device tree binding such that producer and consumer agree on the information passed.
> Proposal 2: Pass a pointer to a generic container through the GP register that can be interpreted appropriately by both boot loaders(i.e., producer and consumer of the boot info). This container can either be a dtb or a HOB list which can be simply inferred by checking for a magic header that indicates if the buffer appears to be a flattened device tree.
> One another concern that was brought up offline is to make sure we don't break current design contracts between various boot loader phases in TF-A. Many of the general-purpose registers have a designated purpose such as to share configurations between BL images( such as firmware config dtb, SoC config dtb, Non trusted firmware config dtb, memory layout, entry point info, etc.).
If I am not mistaken, a single design may not fit the needs of every segment(client, Infra, embedded) and the forum is open to solutions tailored for individual segments. Joanna will be sending a follow up email with more information about future TF-A tech forums that serves as a platform for further discussions.
Thanks,
Madhukar
-----Original Message-----
From: TF-A <tf-a-bounces(a)lists.trustedfirmware.org> On Behalf Of Joanna Farley via TF-A
Sent: Sunday, May 16, 2021 5:19 AM
To: Okash Khawaja <okash.khawaja(a)gmail.com>; Simon Glass <sjg(a)chromium.org>
Cc: Harb Abdulhamid OS <abdulhamid(a)os.amperecomputing.com>; Boot Architecture Mailman List <boot-architecture(a)lists.linaro.org>; tf-a(a)lists.trustedfirmware.org; Ed Stuber <edstuber(a)amperecomputing.com>; Arjun Khare <akhare(a)amperecomputing.com>; U-Boot Mailing List <u-boot(a)lists.denx.de>; Paul Isaac's <paul.isaacs(a)linaro.org>; Ron Minnich <rminnich(a)google.com>; Moe Ammar <moe(a)amperecomputing.com>
Subject: Re: [TF-A] Proposal: TF-A to adopt hand-off blocks (HOBs) for information passing between boot stages
Apologies I failed with the recording. Manish/Madhu will reply early next week with the slides and some notes to help with a follow up session which we hope to hold this Thursday. Invite and agenda will also be sent out early next week.
Thanks
Joanna
On 14/05/2021, 13:30, "TF-A on behalf of Okash Khawaja via TF-A" <tf-a-bounces(a)lists.trustedfirmware.org on behalf of tf-a(a)lists.trustedfirmware.org> wrote:
Hi,
Do we have slides and video from last week's discussion?
Thanks,
Okash
On Wed, May 5, 2021 at 11:52 PM Simon Glass via TF-A
<tf-a(a)lists.trustedfirmware.org> wrote:
>
> Hi Harb,
>
> Thanks for the idea. I am still not completely sure what benefit UUID provides to an open project. I'd like to propose something different, more in the spirit of open collaboration. I also worry that the word 'standard' seems to be a synonym for UUIDs, UEFI, etc., i.e. enabling/preferring closed-source firmware and the continued decline of open-source projects. It really should not be.
>
> So I suggest: Use simple integer IDs and reserve some area for 'private' use. If you want to collaborate across projects outside your company, you either need to allocate a 'public' ID or agree privately between the parties which private ID to use.
>
> This means that the default and easiest option is for collaboration and a public ID, with private ones (whose purpose may be secret) reserved just for private use.
>
> Regards,
> Simon
>
> On Wed, 5 May 2021 at 11:42, Harb Abdulhamid OS <abdulhamid(a)os.amperecomputing.com> wrote:
>>
>> Hey Folks,
>>
>> We wanted to put out a middle-ground proposal to help guide the discussion on the call tomorrow.
>>
>>
>>
>> A proposal that we have been discussing offline involves reserving a single tag ID for the purpose of construction UEFI PI HOB List structure, and that tag would be used to identify a HOB-specific structure that does leverage UUID based identifier. This will eliminate the burden of having to support UUID as the tag, and this enables projects that require UUID based identifiers for the broad range of HOB structures that need to be produced during the booting of the platform. Once we have a tag for a HOB list, this will enable various HOB producers that can add/extend the HOB list in TF-A code (or even pre-TF-A code), with a HOB consumer for that UUID/GUID on the other side (i.e. whatever the BL33 image is booting on that platform).
>>
>>
>>
>> Essentially, the idea is if someone would like to support HOB structures in a standard way using TF-A, they would wrap it up in a BL_AUX_PARAM/BLOB structure (whatever the group decides) and the way we identify the structure as a HOB list is with this new reserved tag.
>>
>>
>>
>> Hopefully that makes sense and less contentious. Look forward to discuss this further on the call.
>>
>>
>>
>> Thanks,
>>
>> --Harb
>>
>>
>>
>> From: Manish Pandey2 <Manish.Pandey2(a)arm.com>
>> Sent: Friday, April 30, 2021 8:14 AM
>> To: François Ozog <francois.ozog(a)linaro.org>
>> Cc: Simon Glass <sjg(a)chromium.org>; Julius Werner <jwerner(a)chromium.org>; Harb Abdulhamid OS <abdulhamid(a)os.amperecomputing.com>; Boot Architecture Mailman List <boot-architecture(a)lists.linaro.org>; tf-a(a)lists.trustedfirmware.org; U-Boot Mailing List <u-boot(a)lists.denx.de>; Paul Isaac's <paul.isaacs(a)linaro.org>; Ron Minnich <rminnich(a)google.com>
>> Subject: Re: [TF-A] Proposal: TF-A to adopt hand-off blocks (HOBs) for information passing between boot stages
>>
>>
>>
>> Hi All,
>>
>>
>>
>> Please find invite for next TF-A Tech Forum session to continue our discussions on HOB implementation, feel free to forward it to others.
>>
>>
>>
>> The next TF-A Tech Forum is scheduled for Thu 6th May 2021 16:00 – 17:00 (BST).
>>
>>
>>
>> Agenda:
>>
>> Discussion Session: Static and Dynamic Information Handling in TF-A
>>
>> Lead by Manish Pandey and Madhukar Pappireddy
>>
>> · There is ongoing mailing lists discussion[1] related with adopting a mechanism to pass information through boot stages.
>>
>> The requirement is two-fold:
>>
>> 1. Passing static information(config files)
>>
>> 2. Passing dynamic information (Hob list)
>>
>> In the upcoming TF-A tech forum, we can start with a discussion on dynamic information passing and if time permits, we can cover static information passing. The purpose of the call is to have an open discussion and continue the discussion from the trusted-substrate call[2] done earlier. We would like to understand the various requirements and possible ways to implement it in TF-A in a generalized way so that it can work with other Firmware projects.
>>
>>
>>
>> The two specific item which we would like to discuss are:
>>
>> 1. HOB format: TF-A/u-boot both has an existing bloblist implementation, which uses tag values. Question, can this be enhanced to use hybrid values(Tag and UUID) both?
>>
>> 2. Standardization on Physical register use to pass base of HoB data structure.
>>
>> References:
>>
>> [1] https://lists.trustedfirmware.org/pipermail/tf-a/2021-April/001069.html
>>
>> [2] https://linaro-org.zoom.us/rec/share/zjfHeMIumkJhirLCVQYTHR6ftaqyWvF_0klgQn… Passcode: IPn+5q%
>>
>>
>>
>> Thanks
>>
>>
>>
>> Joanna
>>
>>
>>
>> You have been invited to the following event.
>>
>> TF-A Tech Forum
>>
>> When
>>
>> Every 2 weeks from 16:00 to 17:00 on Thursday United Kingdom Time
>>
>> Calendar
>>
>> tf-a(a)lists.trustedfirmware.org
>>
>> Who
>>
>> •
>>
>> Bill Fletcher- creator
>>
>> •
>>
>> tf-a(a)lists.trustedfirmware.org
>>
>> more details »
>>
>>
>>
>> We run an open technical forum call for anyone to participate and it is not restricted to Trusted Firmware project members. It will operate under the guidance of the TF TSC.
>>
>>
>>
>> Feel free to forward this invite to colleagues. Invites are via the TF-A mailing list and also published on the Trusted Firmware website. Details are here: https://www.trustedfirmware.org/meetings/tf-a-technical-forum/
>>
>>
>>
>> Trusted Firmware is inviting you to a scheduled Zoom meeting.
>>
>>
>>
>> Join Zoom Meeting
>>
>> https://zoom.us/j/9159704974
>>
>>
>>
>> Meeting ID: 915 970 4974
>>
>>
>>
>> One tap mobile
>>
>> +16465588656,,9159704974# US (New York)
>>
>> +16699009128,,9159704974# US (San Jose)
>>
>>
>>
>> Dial by your location
>>
>> +1 646 558 8656 US (New York)
>>
>> +1 669 900 9128 US (San Jose)
>>
>> 877 853 5247 US Toll-free
>>
>> 888 788 0099 US Toll-free
>>
>> Meeting ID: 915 970 4974
>>
>> Find your local number: https://zoom.us/u/ad27hc6t7h
>>
>>
>>
>> ________________________________
>>
>> From: François Ozog <francois.ozog(a)linaro.org>
>> Sent: 08 April 2021 16:50
>> To: Manish Pandey2 <Manish.Pandey2(a)arm.com>
>> Cc: Simon Glass <sjg(a)chromium.org>; Julius Werner <jwerner(a)chromium.org>; Harb Abdulhamid OS <abdulhamid(a)os.amperecomputing.com>; Boot Architecture Mailman List <boot-architecture(a)lists.linaro.org>; tf-a(a)lists.trustedfirmware.org <tf-a(a)lists.trustedfirmware.org>; U-Boot Mailing List <u-boot(a)lists.denx.de>; Paul Isaac's <paul.isaacs(a)linaro.org>; Ron Minnich <rminnich(a)google.com>
>> Subject: Re: [TF-A] Proposal: TF-A to adopt hand-off blocks (HOBs) for information passing between boot stages
>>
>>
>>
>> Hi
>>
>>
>>
>> here is the meeting recording:
>>
>> https://linaro-org.zoom.us/rec/share/zjfHeMIumkJhirLCVQYTHR6ftaqyWvF_0klgQn… Passcode: IPn+5q%z
>>
>>
>>
>> I am really sorry about the confusion related to the meeting time. I have now understood: the Collaborate portal uses a specific calendar which is tied to US/Chicago timezone while the actual Google Calendar is tied to Central Europe timezone. I am going to drop the Collaborate portal and use a shared Google calendar (it should be visible on the trusted-substrate.org page).
>>
>>
>>
>> I'll try to summarize what I learnt and highlight my view on what can be next steps in a future mail.
>>
>>
>>
>> Cheers
>>
>>
>>
>> FF
>>
>>
>>
>> On Thu, 8 Apr 2021 at 13:56, Manish Pandey2 via TF-A <tf-a(a)lists.trustedfirmware.org> wrote:
>>
>> Hi,
>>
>>
>>
>> From TF-A project point of view, we prefer to use existing mechanism to pass parameters across boot stages using linked list of tagged elements (as suggested by Julius). It has support for both generic and SiP-specific tags. Having said that, it does not stop partners to introduce new mechanisms suitable for their usecase in platform port initially and later move to generic code if its suitable for other platforms.
>>
>>
>>
>> To start with, Ampere can introduce a platform specific implementation of memory tag(speed/NUMA topology etc) which can be evaluated and discussed for generalization in future. The tag will be populated in BL2 stage and can be forwarded to further stages(and to BL33) by passing the head of list pointer in one of the registers. Initially any register can be used but going forward a standardization will be needed.
>>
>>
>>
>> The U-boot bloblist mentioned by Simon is conceptually similar to what TF-A is using, if there is consensus of using bloblist/taglist then TF-A tag list may be enhanced to take best of both the implementations.
>>
>>
>>
>> One of the potential problems of having structure used in different projects is maintainability, this can be avoided by having a single copy of these structures in TF-A (kept inside "include/export" which intended to be used by other projects.)
>>
>>
>>
>> Regarding usage of either UUID or tag, I echo the sentiments of Simon and Julius to keep it simple and use tag values.
>>
>>
>>
>> Looking forward to having further discussions on zoom call today.
>>
>>
>>
>> Thanks
>>
>> Manish P
>>
>>
>>
>> ________________________________
>>
>> From: TF-A <tf-a-bounces(a)lists.trustedfirmware.org> on behalf of Julius Werner via TF-A <tf-a(a)lists.trustedfirmware.org>
>> Sent: 25 March 2021 02:43
>> To: Simon Glass <sjg(a)chromium.org>
>> Cc: Harb Abdulhamid OS <abdulhamid(a)os.amperecomputing.com>; Boot Architecture Mailman List <boot-architecture(a)lists.linaro.org>; tf-a(a)lists.trustedfirmware.org <tf-a(a)lists.trustedfirmware.org>; U-Boot Mailing List <u-boot(a)lists.denx.de>; Paul Isaac's <paul.isaacs(a)linaro.org>; Ron Minnich <rminnich(a)google.com>
>> Subject: Re: [TF-A] Proposal: TF-A to adopt hand-off blocks (HOBs) for information passing between boot stages
>>
>>
>>
>> Just want to point out that TF-A currently already supports a (very simple) mechanism like this:
>>
>>
>>
>> https://review.trustedfirmware.org/plugins/gitiles/TF-A/trusted-firmware-a/…
>>
>> https://review.trustedfirmware.org/plugins/gitiles/TF-A/trusted-firmware-a/…
>>
>> https://review.trustedfirmware.org/plugins/gitiles/TF-A/trusted-firmware-a/…
>>
>>
>>
>> It's just a linked list of tagged elements. The tag space is split into TF-A-wide generic tags and SiP-specific tags (with plenty of room to spare if more areas need to be defined -- a 64-bit tag can fit a lot). This is currently being used by some platforms that run coreboot in place of BL1/BL2, to pass information from coreboot (BL2) to BL31.
>>
>>
>>
>> I would echo Simon's sentiment of keeping this as simple as possible and avoiding complicated and bloated data structures with UUIDs. You usually want to parse something like this as early as possible in the passed-to firmware stage, particularly if the structure encodes information about the debug console (like it does for the platforms I mentioned above). For example, in BL31 this basically means doing it right after moving from assembly to C in bl31_early_platform_setup2() to get the console up before running anything else. At that point in the BL31 initialization, the MMU and caches are disabled, so data accesses are pretty expensive and you don't want to spend a lot of parsing effort or calculate complicated checksums or the like. You just want something extremely simple where you ideally have to touch every data word only once.
>>
>>
>>
>> On Wed, Mar 24, 2021 at 5:06 PM Simon Glass via TF-A <tf-a(a)lists.trustedfirmware.org> wrote:
>>
>> Hi Harb,
>>
>>
>>
>> On Wed, 24 Mar 2021 at 11:39, Harb Abdulhamid OS <abdulhamid(a)os.amperecomputing.com> wrote:
>>
>> Hello Folks,
>>
>> Appreciate the feedback and replies on this. Glad to see that there is interest in this topic.
>>
>>
>>
>> I try to address the comments/feedback from Francois and Simon below….
>>
>>
>>
>> @François Ozog – happy to discuss this on a zoom call. I will make that time slot work, and will be available to attend April 8, 4pm CT.
>>
>>
>>
>> Note that I’m using the term “HOB” here more generically, as there are typically vendor specific structures beyond the resource descriptor HOB, which provides only a small subset of the information that needs to be passed between the boot phases.
>>
>>
>>
>> The whole point here is to provide mechanism to develop firmware that we can build ARM Server SoC’s that support *any* BL33 payload (e.g. EDK2, AptioV, CoreBoot, and maybe even directly boot strapping LinuxBoot at some point). In other-words, we are trying to come up with a TF-A that would be completely agnostic to the implementation of BL33 (i.e. BL33 is built completely independently by a separate entity – e.g. an ODM/OEM).
>>
>>
>>
>> Keep in mind, in the server/datacenter market segment we are not building vertically integrated systems with a single entity compiling firmware/software stacks like most folks in TF-A have become use to. There are two categories of higher level firmware code blobs in the server/datacenter model:
>>
>> “SoC” or “silicon” firmware – in TF-A this may map to BL1, BL2, BL31, and *possibly* one or more BL32 instances
>> “Platform” or “board” firmware – in TF-A this may map to BL33 and *possibly* one or more BL32 instances.
>>
>>
>>
>> Even the platform firmware stack could be further fragmented by having multiple entities involved in delivering the entire firmware stack: IBVs, ODMs, OEMs, CSPs, and possibly even device vendor code.
>>
>>
>>
>> To support a broad range of platform designs with a broad range of memory devices, we need a crisp and clear contract between the SoC firmware that initializes memory (e.g. BL2) and how that platform boot firmware (e.g. BL33) gathers information about what memory that was initialized, at what speeds, NUMA topology, and many other relevant information that needs to be known and comprehended by the platform firmware and eventually by the platform software.
>>
>>
>>
>> I understand the versatility of DT, but I see two major problems with DT:
>>
>> DT requires more complicated parsing to get properties, and even more complex to dynamically set properties – this HOB structures may need to be generated in boot phases where DDR is not available, and therefore we will be extremely memory constrained.
>> DT is probably overkill for this purpose – We really just want a list of pointers to simple C structures that code cast (e.g. JEDEC SPD data blob)
>>
>>
>>
>> I think that we should not mix the efforts around DT/ACPI specs with what we are doing here, because those specs and concepts were developed for a completely different purpose (i.e. abstractions needed for OS / RTOS software, and not necessarily suitable for firmware-to-firmware hand-offs).
>>
>>
>>
>> Frankly, I would personally push back pretty hard on defining SMC’s for something that should be one way information passing. Every SMC we add is another attack vector to the secure world and an increased burden on the folks that have to do security auditing and threat analysis. I see no benefit in exposing these boot/HOB/BOB structures at run-time via SMC calls.
>>
>>
>>
>> Please do let me know if you disagree and why. Look forward to discussing on this thread or on the call.
>>
>>
>>
>> @Simon Glass - Thanks for the pointer to bloblist. I briefly reviewed and it seems like a good baseline for what we may be looking for.
>>
>>
>>
>> That being said, I would say that there is some benefit in having some kind of unique identifiers (e.g. UUID or some unique signature) so that we can tie standardized data structures (based on some future TBD specs) to a particular ID. For example, if the TPM driver in BL33 is looking for the TPM structure in the HOB/BOB list, and may not care about the other data blobs. The driver needs a way to identify and locate the blob it cares about.
>>
>>
>>
>> The tag is intended to serve that purpose, although perhaps it should switch from an auto-allocating enum to one with explicit values for each entry and a range for 'local' use.
>>
>>
>>
>> I guess we can achieve this with the tag, but the problem with tag when you have eco-system with a lot of parties doing parallel development, you can end up with tag collisions and folks fighting about who has rights to what tag values. We would need some official process for folks to register tags for whatever new structures we define, or maybe some tag range for vendor specific structures. This comes with a lot of pain and bureaucracy. On the other hand, UUID has been a proven way to make it easy to just define your own blobs with *either* standard or vendor specific structures without worry of ID collisions between vendors.
>>
>>
>>
>> True. I think the pain is overstated, though. In this case I think we actually want something that can be shared between projects and orgs, so some amount of coordination could be considered a benefit. It could just be a github pull request. I find the UUID unfriendly and not just to code size and eyesight! Trying to discover what GUIDs mean or are valid is quite tricky. E.g. see this code:
>>
>>
>>
>> #define FSP_HOB_RESOURCE_OWNER_TSEG_GUID \
>> EFI_GUID(0xd038747c, 0xd00c, 0x4980, \
>> 0xb3, 0x19, 0x49, 0x01, 0x99, 0xa4, 0x7d, 0x55)
>>
>> (etc.)
>>
>>
>>
>> static struct guid_name {
>> efi_guid_t guid;
>> const char *name;
>> } guid_name[] = {
>> { FSP_HOB_RESOURCE_OWNER_TSEG_GUID, "TSEG" },
>> { FSP_HOB_RESOURCE_OWNER_FSP_GUID, "FSP" },
>> { FSP_HOB_RESOURCE_OWNER_SMM_PEI_SMRAM_GUID, "SMM PEI SMRAM" },
>> { FSP_NON_VOLATILE_STORAGE_HOB_GUID, "NVS" },
>> { FSP_VARIABLE_NV_DATA_HOB_GUID, "Variable NVS" },
>> { FSP_GRAPHICS_INFO_HOB_GUID, "Graphics info" },
>> { FSP_HOB_RESOURCE_OWNER_PCD_DATABASE_GUID1, "PCD database ea" },
>> { FSP_HOB_RESOURCE_OWNER_PCD_DATABASE_GUID2, "PCD database 9b" },
>>
>> (never figured out what those two are)
>>
>>
>> { FSP_HOB_RESOURCE_OWNER_PEIM_DXE_GUID, "PEIM Init DXE" },
>> { FSP_HOB_RESOURCE_OWNER_ALLOC_STACK_GUID, "Alloc stack" },
>> { FSP_HOB_RESOURCE_OWNER_SMBIOS_MEMORY_GUID, "SMBIOS memory" },
>> { {}, "zero-guid" },
>> {}
>> };
>>
>> static const char *guid_to_name(const efi_guid_t *guid)
>> {
>> struct guid_name *entry;
>>
>> for (entry = guid_name; entry->name; entry++) {
>> if (!guidcmp(guid, &entry->guid))
>> return entry->name;
>> }
>>
>> return NULL;
>> }
>>
>>
>>
>> Believe it or not it took a fair bit of effort to find just that small list, with nearly every one in a separate doc, from memory.
>>
>>
>>
>>
>>
>> We can probably debate whether there is any value in GUID/UUID or not during the call… but again, boblist seems like a reasonable starting point as an alternative to HOB.
>>
>>
>>
>> Indeed. There is certainly value in both approaches.
>>
>>
>>
>> Regards,
>>
>> Simon
>>
>>
>>
>>
>>
>> Thanks,
>>
>> --Harb
>>
>>
>>
>> From: François Ozog <francois.ozog(a)linaro.org>
>> Sent: Tuesday, March 23, 2021 10:00 AM
>> To: François Ozog <francois.ozog(a)linaro.org>; Ron Minnich <rminnich(a)google.com>; Paul Isaac's <paul.isaacs(a)linaro.org>
>> Cc: Simon Glass <sjg(a)chromium.org>; Harb Abdulhamid OS <abdulhamid(a)os.amperecomputing.com>; Boot Architecture Mailman List <boot-architecture(a)lists.linaro.org>; tf-a(a)lists.trustedfirmware.org
>> Subject: Re: [TF-A] Proposal: TF-A to adopt hand-off blocks (HOBs) for information passing between boot stages
>>
>>
>>
>> +Ron Minnich +Paul Isaac's
>>
>>
>>
>> Adding Ron and Paul because I think this interface should be also benefiting LinuxBoot efforts.
>>
>>
>>
>> On Tue, 23 Mar 2021 at 11:17, François Ozog via TF-A <tf-a(a)lists.trustedfirmware.org> wrote:
>>
>> Hi,
>>
>>
>>
>> I propose we cover the topic at the next Trusted Substrate zoom call on April 8th 4pm CET.
>>
>>
>>
>> The agenda:
>>
>> ABI between non-secure firmware and the rest of firmware (EL3, S-EL1, S-EL2, SCP) to adapt hardware description to some runtime conditions.
>>
>> runtime conditions here relates to DRAM size and topology detection, secure DRAM memory carvings, PSCI and SCMI interface publishing.
>>
>>
>>
>> For additional background on existing metadata: UEFI Platform Initialization Specification Version 1.7, 5.5 Resource Descriptor HOB
>>
>> Out of the ResourceType we care about is EFI_RESOURCE_SYSTEM_MEMORY.
>>
>> This HOB lacks memory NUMA attachment or something that could be related to fill SRAT table for ACPI or relevant DT proximity domains.
>>
>> HOB is not consistent accros platforms: some platforms (Arm) lists memory from the booting NUMA node, other platforms (x86) lists all memory from all NUMA nodes. (At least this is the case on the two platforms I tested).
>>
>>
>>
>> There are two proposals to use memory structures from SPL/BLx up to the handover function (as defined in the Device Tree technical report) which can be U-boot (BL33 or just U-Boot in case of SPL/U-Boot scheme) or EDK2.
>>
>> I would propose we also discuss possibility of FF-A interface to actually query information or request actions to be done (this is a model actually used in some SoCs with proprietary SMC calls).
>>
>>
>>
>> Requirements (to be validated):
>>
>> - ACPI and DT hardware descriptions.
>>
>> - agnostic to boot framework (SPL/U-Boot, TF-A/U-Boot, TF-A/EDK2)
>>
>> - agnostic to boot framework (SPL/U-Boot, TF-A/U-Boot, TF-A/EDK2, TF-A/LinuxBoot)
>>
>> - at least allows complete DRAM description and "persistent" usage (reserved areas for secure world or other usages)
>>
>> - support secure world device assignment
>>
>>
>>
>> Cheers
>>
>>
>>
>> FF
>>
>>
>>
>>
>>
>> On Mon, 22 Mar 2021 at 19:56, Simon Glass <sjg(a)chromium.org> wrote:
>>
>> Hi,
>>
>> Can I suggest using bloblist for this instead? It is lightweight,
>> easier to parse, doesn't have GUIDs and is already used within U-Boot
>> for passing info between SPL/U-Boot, etc.
>>
>> Docs here: https://github.com/u-boot/u-boot/blob/master/doc/README.bloblist
>> Header file describes the format:
>> https://github.com/u-boot/u-boot/blob/master/include/bloblist.h
>>
>> Full set of unit tests:
>> https://github.com/u-boot/u-boot/blob/master/test/bloblist.c
>>
>> Regards,
>> Simon
>>
>> On Mon, 22 Mar 2021 at 23:58, François Ozog <francois.ozog(a)linaro.org> wrote:
>> >
>> > +Boot Architecture Mailman List <boot-architecture(a)lists.linaro.org>
>> >
>> > standardization is very much welcomed here and need to accommodate a very
>> > diverse set of situations.
>> > For example, TEE OS may need to pass memory reservations to BL33 or
>> > "capture" a device for the secure world.
>> >
>> > I have observed a number of architectures:
>> > 1) pass information from BLx to BLy in the form of a specific object
>> > 2) BLx called by BLy by a platform specific SMC to get information
>> > 3) BLx called by BLy by a platform specific SMC to perform Device Tree
>> > fixups
>> >
>> > I also imagined a standardized "broadcast" FF-A call so that any firmware
>> > element can either provide information or "do something".
>> >
>> > My understanding of your proposal is about standardizing on architecture 1)
>> > with the HOB format.
>> >
>> > The advantage of the HOB is simplicity but it may be difficult to implement
>> > schemes such as pruning a DT because device assignment in the secure world.
>> >
>> > In any case, it looks feasible to have TF-A and OP-TEE complement the list
>> > of HOBs to pass information downstream (the bootflow).
>> >
>> > It would be good to start with building the comprehensive list of
>> > information that need to be conveyed between firmware elements:
>> >
>> > information. | authoritative entity | reporting entity | information
>> > exchanged:
>> > dram | TFA | TFA |
>> > <format to be detailed, NUMA topology to build the SRAT table or DT
>> > equivalent?>
>> > PSCI | SCP | TFA? |
>> > SCMI | SCP or TEE-OS | TFA? TEE-OS?|
>> > secure SRAM | TFA. | TFA. |
>> > secure DRAM | TFA? TEE-OS? | TFA? TEE-OS? |
>> > other? | |
>> > |
>> >
>> > Cheers
>> >
>> > FF
>> >
>> >
>> > On Mon, 22 Mar 2021 at 09:34, Harb Abdulhamid OS via TF-A <
>> > tf-a(a)lists.trustedfirmware.org> wrote:
>> >
>> > > Hello Folks,
>> > >
>> > >
>> > >
>> > > I'm emailing to start an open discussion about the adoption of a concept
>> > > known as "hand-off blocks" or HOB to become a part of the TF-A Firmware
>> > > Framework Architecture (FFA). This is something that is a pretty major
>> > > pain point when it comes to the adoption of TF-A in ARM Server SoC’s
>> > > designed to enable a broad range of highly configurable datacenter
>> > > platforms.
>> > >
>> > >
>> > >
>> > >
>> > >
>> > > What is a HOB (Background)?
>> > >
>> > > ---------------------------
>> > >
>> > > UEFI PI spec describes a particular definition for how HOB may be used for
>> > > transitioning between the PEI and DXE boot phases, which is a good
>> > > reference point for this discussion, but not necessarily the exact solution
>> > > appropriate for TF-A.
>> > >
>> > >
>> > >
>> > > A HOB is simply a dynamically generated data structure passed in between
>> > > two boot phases. This is information that was obtained through discovery
>> > > and needs to be passed forward to the next boot phase *once*, with no API
>> > > needed to call back (e.g. no call back into previous firmware phase is
>> > > needed to fetch this information at run-time - it is simply passed one time
>> > > during boot).
>> > >
>> > >
>> > >
>> > > There may be one or more HOBs passed in between boot phases. If there are
>> > > more than one HOB that needs to be passed, this can be in a form of a "HOB
>> > > table", which (for example) could be a UUID indexed array of pointers to
>> > > HOB structures, used to locate a HOB of interest (based on UUID). In such
>> > > cases, instead of passing a single HOB, the boot phases may rely on passing
>> > > the pointer to the HOB table.
>> > >
>> > >
>> > >
>> > > This has been extremely useful concept to employ on highly configurable
>> > > systems that must rely on flexible discovery mechanisms to initialize and
>> > > boot the system. This is especially helpful when you have multiple
>> > >
>> > >
>> > >
>> > >
>> > >
>> > > Why do we need HOBs in TF-A?:
>> > >
>> > > -----------------------------
>> > >
>> > > It is desirable that EL3 firmware (e.g. TF-A) built for ARM Server SoC in
>> > > a way that is SoC specific *but* platform agnostic. This means that a
>> > > single ARM SoC that a SiP may deliver to customers may provide a single
>> > > TF-A binary (e.g. BL1, BL2, BL31) that could be used to support a broad
>> > > range of platform designs and configurations in order to boot a platform
>> > > specific firmware (e.g. BL33 and possibly even BL32 code). In order to
>> > > achieve this, the platform configuration must be *discovered* instead of
>> > > statically compiled as it is today in TF-A via device tree based
>> > > enumeration. The mechanisms of discovery may differ broadly depending on
>> > > the relevant industry standard, or in some cases may have rely on SiP
>> > > specific discovery flows.
>> > >
>> > >
>> > >
>> > > For example: On server systems that support a broad range DIMM memory
>> > > population/topologies, all the necessary information required to boot is
>> > > fully discovered via standard JEDEC Serial Presence Detect (SPD) over an
>> > > I2C bus. Leveraging the SPD bus, may platform variants could be supported
>> > > with a single TF-A binary. Not only is this information required to
>> > > initialize memory in early boot phases (e.g. BL2), the subsequent boot
>> > > phases will also need this SPD info to construct a system physical address
>> > > map and properly initialize the MMU based on the memory present, and where
>> > > the memory may be present. Subsequent boot phases (e.g. BL33 / UEFI) may
>> > > need to generate standard firmware tables to the operating systems, such as
>> > > SMBIOS tables describing DIMM topology and various ACPI tables (e.g. SLIT,
>> > > SRAT, even NFIT if NVDIMM's are present).
>> > >
>> > >
>> > >
>> > > In short, it all starts with a standardized or vendor specific discovery
>> > > flow in an early boot stage (e.g. BL1/BL2), followed by the passing of
>> > > information to the next boot stages (e.g. BL31/BL32/BL33).
>> > >
>> > >
>> > >
>> > > Today, every HOB may be a vendor specific structure, but in the future
>> > > there may be benefit of defining standard HOBs. This may be useful for
>> > > memory discovery, passing the system physical address map, enabling TPM
>> > > measured boot, and potentially many other common HOB use-cases.
>> > >
>> > >
>> > >
>> > > It would be extremely beneficial to the datacenter market segment if the
>> > > TF-A community would adopt this concept of information passing between all
>> > > boot phases as opposed to rely solely on device tree enumeration. This is
>> > > not intended to replace device tree, rather intended as an alternative way
>> > > to describe the info that must be discovered and dynamically generated.
>> > >
>> > >
>> > >
>> > >
>> > >
>> > > Conclusion:
>> > >
>> > > -----------
>> > >
>> > > We are proposing that the TF-A community begin pursuing the adoption of
>> > > HOBs as a mechanism used for information exchange between each boot stage
>> > > (e.g. BL1->BL2, BL2->BL31, BL31->BL32, and BL31->BL33)? Longer term we
>> > > want to explore standardizing some HOB structures for the BL33 phase (e.g.
>> > > UEFI HOB structures), but initially would like to agree on this being a
>> > > useful mechanism used to pass information between each boot stage.
>> > >
>> > >
>> > >
>> > > Thanks,
>> > >
>> > > --Harb
>> > >
>> > >
>> > >
>> > >
>> > >
>> > >
>> > > --
>> > > TF-A mailing list
>> > > TF-A(a)lists.trustedfirmware.org
>> > > https://lists.trustedfirmware.org/mailman/listinfo/tf-a
>> > >
>> >
>> >
>> > --
>> > François-Frédéric Ozog | *Director Linaro Edge & Fog Computing Group*
>> > T: +33.67221.6485
>> > francois.ozog(a)linaro.org | Skype: ffozog
>> > _______________________________________________
>> > boot-architecture mailing list
>> > boot-architecture(a)lists.linaro.org
>> > https://lists.linaro.org/mailman/listinfo/boot-architecture
>>
>>
>>
>>
>> --
>>
>> François-Frédéric Ozog | Director Linaro Edge & Fog Computing Group
>>
>> T: +33.67221.6485
>> francois.ozog(a)linaro.org | Skype: ffozog
>>
>>
>>
>> --
>> TF-A mailing list
>> TF-A(a)lists.trustedfirmware.org
>> https://lists.trustedfirmware.org/mailman/listinfo/tf-a
>>
>>
>>
>>
>> --
>>
>> François-Frédéric Ozog | Director Linaro Edge & Fog Computing Group
>>
>> T: +33.67221.6485
>> francois.ozog(a)linaro.org | Skype: ffozog
>>
>>
>>
>> --
>> TF-A mailing list
>> TF-A(a)lists.trustedfirmware.org
>> https://lists.trustedfirmware.org/mailman/listinfo/tf-a
>>
>> --
>> TF-A mailing list
>> TF-A(a)lists.trustedfirmware.org
>> https://lists.trustedfirmware.org/mailman/listinfo/tf-a
>>
>>
>>
>>
>> --
>>
>> François-Frédéric Ozog | Director Linaro Edge & Fog Computing Group
>>
>> T: +33.67221.6485
>> francois.ozog(a)linaro.org | Skype: ffozog
>>
>>
>
> --
> TF-A mailing list
> TF-A(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-a
--
TF-A mailing list
TF-A(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-a
--
TF-A mailing list
TF-A(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-a
--
TF-A mailing list
TF-A(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-a
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
5
10
From: Peng <peng.fan(a)nxp.com>
This patchset is to upstream NXP downstream caam, hab features
One more patch is to update maintainer for imx8mn_evk board.
Aymen Sghaier (6):
crypto: caam: Add CAAM support to i.MX8M platforms
crypto: caam: Fix build warnings pointer casting
crypto: Add blob command support for i.MX8M platforms
crypto: caam: Fix pointer size to 32bit for i.MX8M
crypto: caam: Add secure memory vid 3 support
crypto: caam: RNG4 TRNG errata
Breno Lima (13):
imx: imx7 Support for Manufacturing Protection
imx: Avoid hardcoded output ring size register offset (ORSR)
imx: Ensure CAAM clock is enabled prior getting out_jr_size
imx: Avoid hardcoded Job Ring Max size
imx: hab: Enable hab.c to authenticate additional images in open
configuration
imx: hab: Check if IVT header is HABv4
mx7ulp: hab: Add hab_status command for HABv4 M4 boot
imx: hab: Fix build warnings in 32-bit targets
crypto: fsl: blob: Flush dcache range for destination address
mx6dq: hab: Fix chip version in hab.h code
cmd: blob: Add IMX_HAB and CAAM supported SoCs as dependency
cmd: blob: Instantiate RNG before running CMD_BLOB
fsl_mfgprot: Fix typo in sign_mppubk()
Clement Faure (2):
imx8m: Add DEK blob encapsulation for imx8m
imx8: Add DEK blob encapsulation
Clement Le Marquis (1):
imx: caam: new u-boot command to set PRIBLOB bitfield from CAAM SCFGR
register to 0x3
Franck LENORMAND (3):
crypto: caam: change JR running loop
caam: enable support for iMX7ULP
imx7ulp: Enable support for cmd blob
Peng (1):
imx8mn: evk: update MAINTAINERS
Peng Fan (2):
imx8m: add regs used by CAAM
imx: HAB: Update hab codes to support ARM64 and i.MX8M
Utkarsh Gupta (2):
imx: HAB: Validate IVT before authenticating image
imx: hab: Display All HAB events via hab_status command
Ye Li (7):
imx: hab: Add function to authenticate kernel image
hab: Change calling to ROM API failsafe
imx: HAB: Add support for iMX8MM
iMX8M: Add support to enable CONFIG_IMX_HAB
imx: cmd_dek: Enable DEK only for chips supporting CAAM
crypto: caam: Add fsl caam driver
crypto: fsl: refactor for 32 bit version CAAM support on ARM64
arch/arm/Kconfig | 6 +
arch/arm/dts/imx8mm-evk-u-boot.dtsi | 7 +
arch/arm/dts/imx8mn-ddr4-evk-u-boot.dtsi | 6 +
arch/arm/dts/imx8mp-evk-u-boot.dtsi | 6 +
arch/arm/include/asm/arch-imx/cpu.h | 1 +
arch/arm/include/asm/arch-imx8/image.h | 11 +
arch/arm/include/asm/arch-imx8m/clock.h | 1 +
arch/arm/include/asm/arch-imx8m/imx-regs.h | 10 +
arch/arm/include/asm/arch-mx7/crm_regs.h | 8 +
arch/arm/include/asm/arch-mx7ulp/imx-regs.h | 12 +
arch/arm/include/asm/mach-imx/hab.h | 37 +-
arch/arm/mach-imx/Kconfig | 44 +-
arch/arm/mach-imx/Makefile | 3 +
arch/arm/mach-imx/cmd_dek.c | 262 ++++++-
arch/arm/mach-imx/cmd_mfgprot.c | 150 ++++
arch/arm/mach-imx/hab.c | 417 +++++++++--
arch/arm/mach-imx/imx8/Kconfig | 1 +
arch/arm/mach-imx/imx8m/Kconfig | 1 +
arch/arm/mach-imx/imx8m/clock_imx8mm.c | 8 +
arch/arm/mach-imx/imx8m/clock_imx8mq.c | 7 +
arch/arm/mach-imx/mx7ulp/Kconfig | 1 +
arch/arm/mach-imx/priblob.c | 33 +
board/freescale/imx8mn_evk/MAINTAINERS | 3 +-
cmd/Kconfig | 8 +
cmd/Makefile | 1 +
cmd/blob.c | 16 +
cmd/cmd_fsl_caam.c | 88 +++
doc/imx/habv4/guides/mx6_mx7_secure_boot.txt | 25 +
drivers/crypto/Makefile | 1 +
drivers/crypto/fsl/Kconfig | 6 +
drivers/crypto/fsl/Makefile | 4 +-
drivers/crypto/fsl/desc.h | 49 +-
drivers/crypto/fsl/desc_constr.h | 28 +-
drivers/crypto/fsl/fsl_blob.c | 6 +
drivers/crypto/fsl/fsl_hash.c | 6 +-
drivers/crypto/fsl/fsl_mfgprot.c | 160 +++++
drivers/crypto/fsl/jobdesc.c | 16 +-
drivers/crypto/fsl/jr.c | 53 +-
drivers/crypto/fsl/jr.h | 11 +-
drivers/crypto/fsl/type.h | 16 +
drivers/crypto/fsl_caam.c | 720 +++++++++++++++++++
drivers/crypto/fsl_caam_internal.h | 230 ++++++
include/fsl_caam.h | 24 +
include/fsl_sec.h | 54 +-
44 files changed, 2388 insertions(+), 169 deletions(-)
create mode 100644 arch/arm/mach-imx/cmd_mfgprot.c
create mode 100644 arch/arm/mach-imx/priblob.c
create mode 100644 cmd/cmd_fsl_caam.c
create mode 100644 drivers/crypto/fsl/fsl_mfgprot.c
create mode 100644 drivers/crypto/fsl/type.h
create mode 100644 drivers/crypto/fsl_caam.c
create mode 100644 drivers/crypto/fsl_caam_internal.h
create mode 100644 include/fsl_caam.h
--
2.25.1
3
41
As I have mentioned in various release emails, now that various
migration deadlines are reaching the 3+ year mark, I'm taking more
drastic measures and removing boards or removing functionality from
boards, in order to complete migrations. This series depends on the
DM_PCI migration series I had posted earlier and can be seen here:
https://patchwork.ozlabs.org/project/uboot/list/?series=243894&state=*
With this series, I'm doing the DM_USB + OF_CONTROL migration. A number
of kirkwood platforms already had OF_CONTROL support done, so a very
minimal DM enablement is done, but should be tested on real hardware. I
would guess that if they don't work, disabling CONFIG_SYS_MALLOC_F is
wrong and it needs to be enabled and a LEN of 0x2000 used as well if
the default is not large enough. In another set of cases, the boards
are removed as other bigger migrations are also missing.
This series, as well as the DM_PCI one and the DM_VIDEO and
CONFIG_DM_SPI_FLASH series that will follow are intended to be applied
after v2021.07 is released, and based on how the DM_MMC migration series
was done for this release, probably around the -rc2 or -rc3 time-frame.
So there is some time left yet to migrate boards, but the deadline is
fast approaching. Thanks all!
--
Tom
4
44

[PATCH v2 0/2] mmc: Add support for checking device number against alias index
by Aswath Govindraju 08 Jul '21
by Aswath Govindraju 08 Jul '21
08 Jul '21
The following series of patches,
- add support to check for a device with a sequence number equal to device
number before looking for matching index
- assign device number by reading aliases node's index by using dev_seq
Changes since v1:
- In patch 2 used dev_seq instead of using dev_read_alias_seq for reading
alias index.
Aswath Govindraju (2):
mmc: Check for device with a seq number equal to num before checking
against index
mmc: mmc-uclass: Use dev_seq() to read aliases node's index
drivers/mmc/mmc-uclass.c | 12 +++++-------
drivers/mmc/mmc.c | 8 +++++---
2 files changed, 10 insertions(+), 10 deletions(-)
--
2.17.1
5
10

07 Jul '21
Hello,
This series first adds fixes and enhancements to sunxi NAND drivers (SPL
and U-Boot). Once this is done, the SPL NAND driver is converted to use
PIO instead of DMA with the goal to support all SoCs with this IP
without the need for DMA-related code. Finally, NAND support is added to
Nintendo NES Classic through Kconfig and DT additions.
Thanks,
Miquèl
Changes since v2:
=================
- Added Boris and Maxime Acked-by tags.
- Removed extra space in nand_reset_column()
- Fixed the useless wait period on failure in nand_change_column().
- Changed the title "sunxi: allow NAND support to be compiled for..."
(removed the "in SPL" precision which is wrong).
- Enbraced the deassertion of the reset line by #if statements about
the SoCs in use. Wolfgang Denk made a comment on my proposal but I
could not find a better solution, so I kept it for now.
- s/alwinner,[pin,functions]/[pin,functions]/ in the DT.
- Change Alwinner-specific parts in the SPL to generic sentences.
Changes since v1:
=================
All:
----
- Enhance all commit messages.
- Rebased on top of master branch (I should have done that earlier but
I forgot I was on an old revision).
Fix binman_sym output check
---------------------------
- SPL seems to be broken for a few weeks when using raw NAND, fix it
by changing the error condition.
Fix strength
------------
- Add comment explaining the added line and moved the line for
clarification on why it is needed.
- Add forgotten Boris' Suggested-by tag.
Fix second case of modulo by zero error
----------------------------------------
- Added a reference to the first occurence of this issue.
Allow SPL to be compiled for sun8i platforms
--------------------------------------------
- This commit is not about compiling the SPL, but the NAND support in
the SPL, as corrected by Maxime.
Enhancements and cleaning
-------------------------
- Patch split into several logical chunks, as requested.
- Removed useless udelay(1), that was added for debugging purpose.
- Introduced the nand_exec_cmd() helper to mutualize code one step
further.
- Add an udelay(1) after changing the column to respect the minimum
tCCS delay (Change Column Setup time).
- Canceled moving to global scope the ecc_strength array.
Use PIO instead of DMA
----------------------
- Change commit message/title.
- Cancel removing NFC related definitions: they can be useful as the
this IP is quite under-documented.
- Merge nand_reset_column and nand_change_column (in another patch).
- Moved the copy of the data after the check of the ECC status.
- ECC chunks are read manually, return if the first chunk is empty
only (needed for configuration research), otherwise it should not be
treated as an error.
Add NAND node to sun8i
----------------------
- U-Boot master branch already has this node, remove the patch.
Enable NAND on NES classic
--------------------------
- Change the DT cells size from 2 to 1.
Add NAND support for NES classic
--------------------------------
- Split in several patches, moving SPL_NAND_SUPPORT and NAND_SUNXI out
of the defconfig files (NES and CHIP pro) to be automatically
selected depending on NAND_SUNXI and ARCH_SUNXI.
- Moved the NAND parameters to Kconfig (only for SUNXI because the
tool did not work as expected, maybe due to some definitions that
are not "numbers" but multiplications and sometimes use other
definitions (NAND page size, 2K_SZ, etc).
Miquel Raynal (20):
spl: fix binman_sym output check
mtd: nand: sunxi: fix ECC strength choice
spl: nand: sunxi: fix second case of modulo by zero error
spl: nand: sunxi: fix typo on register name
spl: nand: sunxi: introduce the nand_wait_int() helper
spl: nand: sunxi: introduce the nand_wait_cmd_fifo_empty() helper
spl: nand: sunxi: add missing status clear
spl: nand: sunxi: create an helper to handle command execution
spl: nand: sunxi: ensure enough time has passed after changing the
column
spl: nand: sunxi: make the reset column helper more generic
sunxi: spl: deassert the NAND controller reset line
spl: nand: sunxi: declare the ecc_bytes array globally
spl: nand: sunxi: use PIO instead of DMA
sunxi: spl: remove DMA related settings of the NAND controller
sunxi: allow NAND support to be compiled for sun8i platforms
sunxi: dts: enable NAND on NES classic
sunxi: automatically select SPL_NAND_SUPPORT in Kconfig
sunxi: make NAND_SUNXI use ARCH_SUNXI as default in Kconfig
sunxi: move the NAND parameters to Kconfig
configs: add NAND support for NES Classic
arch/arm/dts/sun8i-a23-a33.dtsi | 17 ++
.../dts/sun8i-r16-nintendo-nes-classic-edition.dts | 14 ++
arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 6 +
board/sunxi/board.c | 7 +-
common/spl/spl.c | 10 +-
configs/CHIP_pro_defconfig | 6 +-
configs/Nintendo_NES_Classic_Edition_defconfig | 4 +
drivers/mtd/nand/Kconfig | 26 ++-
drivers/mtd/nand/sunxi_nand.c | 8 +-
drivers/mtd/nand/sunxi_nand_spl.c | 242 ++++++++++-----------
10 files changed, 208 insertions(+), 132 deletions(-)
--
2.14.1
5
31
We didn't convert the Integrator to use DM for PCI in
time, and we don't use it either so let's just drop
PCI support from the Integrator.
Signed-off-by: Linus Walleij <linus.walleij(a)linaro.org>
---
board/armltd/integrator/Makefile | 1 -
board/armltd/integrator/integrator.c | 1 -
board/armltd/integrator/pci.c | 462 ------------------------
board/armltd/integrator/pci_v3.h | 187 ----------
configs/integratorap_cm720t_defconfig | 4 -
configs/integratorap_cm920t_defconfig | 4 -
configs/integratorap_cm926ejs_defconfig | 4 -
configs/integratorap_cm946es_defconfig | 4 -
8 files changed, 667 deletions(-)
delete mode 100644 board/armltd/integrator/pci.c
delete mode 100644 board/armltd/integrator/pci_v3.h
diff --git a/board/armltd/integrator/Makefile b/board/armltd/integrator/Makefile
index 8c906e3f072b..107e59bf0fa2 100644
--- a/board/armltd/integrator/Makefile
+++ b/board/armltd/integrator/Makefile
@@ -10,5 +10,4 @@
obj-y := lowlevel_init.o
obj-y += integrator.o
-obj-$(CONFIG_PCI) += pci.o
obj-y += timer.o
diff --git a/board/armltd/integrator/integrator.c b/board/armltd/integrator/integrator.c
index 3e864e8e7a5c..388795809dfd 100644
--- a/board/armltd/integrator/integrator.c
+++ b/board/armltd/integrator/integrator.c
@@ -181,7 +181,6 @@ int board_eth_init(struct bd_info *bis)
#ifdef CONFIG_SMC91111
rc = smc91111_initialize(0, CONFIG_SMC91111_BASE);
#endif
- rc += pci_eth_init(bis);
return rc;
}
#endif
diff --git a/board/armltd/integrator/pci.c b/board/armltd/integrator/pci.c
deleted file mode 100644
index 28efc33f1f42..000000000000
--- a/board/armltd/integrator/pci.c
+++ /dev/null
@@ -1,462 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Marius Groeger <mgroeger(a)sysgo.de>
- *
- * (C) Copyright 2002
- * David Mueller, ELSOFT AG, <d.mueller(a)elsoft.ch>
- *
- * (C) Copyright 2003
- * Texas Instruments, <www.ti.com>
- * Kshitij Gupta <Kshitij(a)ti.com>
- *
- * (C) Copyright 2004
- * ARM Ltd.
- * Philippe Robin, <philippe.robin(a)arm.com>
- *
- * (C) Copyright 2011
- * Linaro
- * Linus Walleij <linus.walleij(a)linaro.org>
- */
-#include <common.h>
-#include <init.h>
-#include <log.h>
-#include <pci.h>
-#include <asm/io.h>
-#include <linux/bug.h>
-#include <linux/delay.h>
-#include "integrator-sc.h"
-#include "pci_v3.h"
-
-#define INTEGRATOR_BOOT_ROM_BASE 0x20000000
-#define INTEGRATOR_HDR0_SDRAM_BASE 0x80000000
-
-/*
- * These are in the physical addresses on the CPU side, i.e.
- * where we read and write stuff - you don't want to try to
- * move these around
- */
-#define PHYS_PCI_MEM_BASE 0x40000000
-#define PHYS_PCI_IO_BASE 0x60000000 /* PCI I/O space base */
-#define PHYS_PCI_CONFIG_BASE 0x61000000
-#define PHYS_PCI_V3_BASE 0x62000000 /* V360EPC registers */
-#define SZ_256M 0x10000000
-
-/*
- * These are in the PCI BUS address space
- * Set to 0x00000000 in the Linux kernel, 0x40000000 in Boot monitor
- * we follow the example of the kernel, because that is the address
- * range that devices actually use - what would they be doing at
- * 0x40000000?
- */
-#define PCI_BUS_NONMEM_START 0x00000000
-#define PCI_BUS_NONMEM_SIZE SZ_256M
-
-#define PCI_BUS_PREMEM_START (PCI_BUS_NONMEM_START + PCI_BUS_NONMEM_SIZE)
-#define PCI_BUS_PREMEM_SIZE SZ_256M
-
-#if PCI_BUS_NONMEM_START & 0x000fffff
-#error PCI_BUS_NONMEM_START must be megabyte aligned
-#endif
-#if PCI_BUS_PREMEM_START & 0x000fffff
-#error PCI_BUS_PREMEM_START must be megabyte aligned
-#endif
-
-/*
- * Initialize PCI Devices, report devices found.
- */
-
-#ifndef CONFIG_PCI_PNP
-#define PCI_ENET0_IOADDR 0x60000000 /* First card in PCI I/O space */
-#define PCI_ENET0_MEMADDR 0x40000000 /* First card in PCI memory space */
-static struct pci_config_table pci_integrator_config_table[] = {
- { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x0f, PCI_ANY_ID,
- pci_cfgfunc_config_device, { PCI_ENET0_IOADDR,
- PCI_ENET0_MEMADDR,
- PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }},
- { }
-};
-#endif /* CONFIG_PCI_PNP */
-
-/* V3 access routines */
-#define v3_writeb(o, v) __raw_writeb(v, PHYS_PCI_V3_BASE + (unsigned int)(o))
-#define v3_readb(o) (__raw_readb(PHYS_PCI_V3_BASE + (unsigned int)(o)))
-
-#define v3_writew(o, v) __raw_writew(v, PHYS_PCI_V3_BASE + (unsigned int)(o))
-#define v3_readw(o) (__raw_readw(PHYS_PCI_V3_BASE + (unsigned int)(o)))
-
-#define v3_writel(o, v) __raw_writel(v, PHYS_PCI_V3_BASE + (unsigned int)(o))
-#define v3_readl(o) (__raw_readl(PHYS_PCI_V3_BASE + (unsigned int)(o)))
-
-static unsigned long v3_open_config_window(pci_dev_t bdf, int offset)
-{
- unsigned int address, mapaddress;
- unsigned int busnr = PCI_BUS(bdf);
- unsigned int devfn = PCI_FUNC(bdf);
-
- /*
- * Trap out illegal values
- */
- if (offset > 255)
- BUG();
- if (busnr > 255)
- BUG();
- if (devfn > 255)
- BUG();
-
- if (busnr == 0) {
- /*
- * Linux calls the thing U-Boot calls "DEV" "SLOT"
- * instead, but it's the same 5 bits
- */
- int slot = PCI_DEV(bdf);
-
- /*
- * local bus segment so need a type 0 config cycle
- *
- * build the PCI configuration "address" with one-hot in
- * A31-A11
- *
- * mapaddress:
- * 3:1 = config cycle (101)
- * 0 = PCI A1 & A0 are 0 (0)
- */
- address = PCI_FUNC(bdf) << 8;
- mapaddress = V3_LB_MAP_TYPE_CONFIG;
-
- if (slot > 12)
- /*
- * high order bits are handled by the MAP register
- */
- mapaddress |= 1 << (slot - 5);
- else
- /*
- * low order bits handled directly in the address
- */
- address |= 1 << (slot + 11);
- } else {
- /*
- * not the local bus segment so need a type 1 config cycle
- *
- * address:
- * 23:16 = bus number
- * 15:11 = slot number (7:3 of devfn)
- * 10:8 = func number (2:0 of devfn)
- *
- * mapaddress:
- * 3:1 = config cycle (101)
- * 0 = PCI A1 & A0 from host bus (1)
- */
- mapaddress = V3_LB_MAP_TYPE_CONFIG | V3_LB_MAP_AD_LOW_EN;
- address = (busnr << 16) | (devfn << 8);
- }
-
- /*
- * Set up base0 to see all 512Mbytes of memory space (not
- * prefetchable), this frees up base1 for re-use by
- * configuration memory
- */
- v3_writel(V3_LB_BASE0, v3_addr_to_lb_base(PHYS_PCI_MEM_BASE) |
- V3_LB_BASE_ADR_SIZE_512MB | V3_LB_BASE_ENABLE);
-
- /*
- * Set up base1/map1 to point into configuration space.
- */
- v3_writel(V3_LB_BASE1, v3_addr_to_lb_base(PHYS_PCI_CONFIG_BASE) |
- V3_LB_BASE_ADR_SIZE_16MB | V3_LB_BASE_ENABLE);
- v3_writew(V3_LB_MAP1, mapaddress);
-
- return PHYS_PCI_CONFIG_BASE + address + offset;
-}
-
-static void v3_close_config_window(void)
-{
- /*
- * Reassign base1 for use by prefetchable PCI memory
- */
- v3_writel(V3_LB_BASE1, v3_addr_to_lb_base(PHYS_PCI_MEM_BASE + SZ_256M) |
- V3_LB_BASE_ADR_SIZE_256MB | V3_LB_BASE_PREFETCH |
- V3_LB_BASE_ENABLE);
- v3_writew(V3_LB_MAP1, v3_addr_to_lb_map(PCI_BUS_PREMEM_START) |
- V3_LB_MAP_TYPE_MEM_MULTIPLE);
-
- /*
- * And shrink base0 back to a 256M window (NOTE: MAP0 already correct)
- */
- v3_writel(V3_LB_BASE0, v3_addr_to_lb_base(PHYS_PCI_MEM_BASE) |
- V3_LB_BASE_ADR_SIZE_256MB | V3_LB_BASE_ENABLE);
-}
-
-static int pci_integrator_read_byte(struct pci_controller *hose, pci_dev_t bdf,
- int offset, unsigned char *val)
-{
- unsigned long addr;
-
- addr = v3_open_config_window(bdf, offset);
- *val = __raw_readb(addr);
- v3_close_config_window();
- return 0;
-}
-
-static int pci_integrator_read__word(struct pci_controller *hose,
- pci_dev_t bdf, int offset,
- unsigned short *val)
-{
- unsigned long addr;
-
- addr = v3_open_config_window(bdf, offset);
- *val = __raw_readw(addr);
- v3_close_config_window();
- return 0;
-}
-
-static int pci_integrator_read_dword(struct pci_controller *hose,
- pci_dev_t bdf, int offset,
- unsigned int *val)
-{
- unsigned long addr;
-
- addr = v3_open_config_window(bdf, offset);
- *val = __raw_readl(addr);
- v3_close_config_window();
- return 0;
-}
-
-static int pci_integrator_write_byte(struct pci_controller *hose,
- pci_dev_t bdf, int offset,
- unsigned char val)
-{
- unsigned long addr;
-
- addr = v3_open_config_window(bdf, offset);
- __raw_writeb((u8)val, addr);
- __raw_readb(addr);
- v3_close_config_window();
- return 0;
-}
-
-static int pci_integrator_write_word(struct pci_controller *hose,
- pci_dev_t bdf, int offset,
- unsigned short val)
-{
- unsigned long addr;
-
- addr = v3_open_config_window(bdf, offset);
- __raw_writew((u8)val, addr);
- __raw_readw(addr);
- v3_close_config_window();
- return 0;
-}
-
-static int pci_integrator_write_dword(struct pci_controller *hose,
- pci_dev_t bdf, int offset,
- unsigned int val)
-{
- unsigned long addr;
-
- addr = v3_open_config_window(bdf, offset);
- __raw_writel((u8)val, addr);
- __raw_readl(addr);
- v3_close_config_window();
- return 0;
-}
-
-struct pci_controller integrator_hose = {
-#ifndef CONFIG_PCI_PNP
- config_table: pci_integrator_config_table,
-#endif
-};
-
-void pci_init_board(void)
-{
- struct pci_controller *hose = &integrator_hose;
- u16 val;
-
- /* setting this register will take the V3 out of reset */
- __raw_writel(SC_PCI_PCIEN, SC_PCI);
-
- /* Wait for 230 ms (from spec) before accessing any V3 registers */
- mdelay(230);
-
- /* Now write the Base I/O Address Word to PHYS_PCI_V3_BASE + 0x6E */
- v3_writew(V3_LB_IO_BASE, (PHYS_PCI_V3_BASE >> 16));
-
- /* Wait for the mailbox to settle */
- do {
- v3_writeb(V3_MAIL_DATA, 0xAA);
- v3_writeb(V3_MAIL_DATA + 4, 0x55);
- } while (v3_readb(V3_MAIL_DATA) != 0xAA ||
- v3_readb(V3_MAIL_DATA + 4) != 0x55);
-
- /* Make sure that V3 register access is not locked, if it is, unlock it */
- if (v3_readw(V3_SYSTEM) & V3_SYSTEM_M_LOCK)
- v3_writew(V3_SYSTEM, 0xA05F);
-
- /*
- * Ensure that the slave accesses from PCI are disabled while we
- * setup memory windows
- */
- val = v3_readw(V3_PCI_CMD);
- val &= ~(V3_COMMAND_M_MEM_EN | V3_COMMAND_M_IO_EN);
- v3_writew(V3_PCI_CMD, val);
-
- /* Clear RST_OUT to 0; keep the PCI bus in reset until we've finished */
- val = v3_readw(V3_SYSTEM);
- val &= ~V3_SYSTEM_M_RST_OUT;
- v3_writew(V3_SYSTEM, val);
-
- /* Make all accesses from PCI space retry until we're ready for them */
- val = v3_readw(V3_PCI_CFG);
- val |= V3_PCI_CFG_M_RETRY_EN;
- v3_writew(V3_PCI_CFG, val);
-
- /*
- * Set up any V3 PCI Configuration Registers that we absolutely have to.
- * LB_CFG controls Local Bus protocol.
- * Enable LocalBus byte strobes for READ accesses too.
- * set bit 7 BE_IMODE and bit 6 BE_OMODE
- */
- val = v3_readw(V3_LB_CFG);
- val |= 0x0C0;
- v3_writew(V3_LB_CFG, val);
-
- /* PCI_CMD controls overall PCI operation. Enable PCI bus master. */
- val = v3_readw(V3_PCI_CMD);
- val |= V3_COMMAND_M_MASTER_EN;
- v3_writew(V3_PCI_CMD, val);
-
- /*
- * PCI_MAP0 controls where the PCI to CPU memory window is on
- * Local Bus
- */
- v3_writel(V3_PCI_MAP0,
- (INTEGRATOR_BOOT_ROM_BASE) | (V3_PCI_MAP_M_ADR_SIZE_512MB |
- V3_PCI_MAP_M_REG_EN |
- V3_PCI_MAP_M_ENABLE));
-
- /* PCI_BASE0 is the PCI address of the start of the window */
- v3_writel(V3_PCI_BASE0, INTEGRATOR_BOOT_ROM_BASE);
-
- /* PCI_MAP1 is LOCAL address of the start of the window */
- v3_writel(V3_PCI_MAP1,
- (INTEGRATOR_HDR0_SDRAM_BASE) | (V3_PCI_MAP_M_ADR_SIZE_1GB |
- V3_PCI_MAP_M_REG_EN |
- V3_PCI_MAP_M_ENABLE));
-
- /* PCI_BASE1 is the PCI address of the start of the window */
- v3_writel(V3_PCI_BASE1, INTEGRATOR_HDR0_SDRAM_BASE);
-
- /*
- * Set up memory the windows from local bus memory into PCI
- * configuration, I/O and Memory regions.
- * PCI I/O, LB_BASE2 and LB_MAP2 are used exclusively for this.
- */
- v3_writew(V3_LB_BASE2,
- v3_addr_to_lb_map(PHYS_PCI_IO_BASE) | V3_LB_BASE_ENABLE);
- v3_writew(V3_LB_MAP2, 0);
-
- /* PCI Configuration, use LB_BASE1/LB_MAP1. */
-
- /*
- * PCI Memory use LB_BASE0/LB_MAP0 and LB_BASE1/LB_MAP1
- * Map first 256Mbytes as non-prefetchable via BASE0/MAP0
- */
- v3_writel(V3_LB_BASE0, v3_addr_to_lb_base(PHYS_PCI_MEM_BASE) |
- V3_LB_BASE_ADR_SIZE_256MB | V3_LB_BASE_ENABLE);
- v3_writew(V3_LB_MAP0,
- v3_addr_to_lb_map(PCI_BUS_NONMEM_START) | V3_LB_MAP_TYPE_MEM);
-
- /* Map second 256 Mbytes as prefetchable via BASE1/MAP1 */
- v3_writel(V3_LB_BASE1, v3_addr_to_lb_base(PHYS_PCI_MEM_BASE + SZ_256M) |
- V3_LB_BASE_ADR_SIZE_256MB | V3_LB_BASE_PREFETCH |
- V3_LB_BASE_ENABLE);
- v3_writew(V3_LB_MAP1, v3_addr_to_lb_map(PCI_BUS_PREMEM_START) |
- V3_LB_MAP_TYPE_MEM_MULTIPLE);
-
- /* Dump PCI to local address space mappings */
- debug("LB_BASE0 = %08x\n", v3_readl(V3_LB_BASE0));
- debug("LB_MAP0 = %04x\n", v3_readw(V3_LB_MAP0));
- debug("LB_BASE1 = %08x\n", v3_readl(V3_LB_BASE1));
- debug("LB_MAP1 = %04x\n", v3_readw(V3_LB_MAP1));
- debug("LB_BASE2 = %04x\n", v3_readw(V3_LB_BASE2));
- debug("LB_MAP2 = %04x\n", v3_readw(V3_LB_MAP2));
- debug("LB_IO_BASE = %04x\n", v3_readw(V3_LB_IO_BASE));
-
- /*
- * Allow accesses to PCI Configuration space and set up A1, A0 for
- * type 1 config cycles
- */
- val = v3_readw(V3_PCI_CFG);
- val &= ~(V3_PCI_CFG_M_RETRY_EN | V3_PCI_CFG_M_AD_LOW1);
- val |= V3_PCI_CFG_M_AD_LOW0;
- v3_writew(V3_PCI_CFG, val);
-
- /* now we can allow incoming PCI MEMORY accesses */
- val = v3_readw(V3_PCI_CMD);
- val |= V3_COMMAND_M_MEM_EN;
- v3_writew(V3_PCI_CMD, val);
-
- /*
- * Set RST_OUT to take the PCI bus is out of reset, PCI devices can
- * now initialise.
- */
- val = v3_readw(V3_SYSTEM);
- val |= V3_SYSTEM_M_RST_OUT;
- v3_writew(V3_SYSTEM, val);
-
- /* Lock the V3 system register so that no one else can play with it */
- val = v3_readw(V3_SYSTEM);
- val |= V3_SYSTEM_M_LOCK;
- v3_writew(V3_SYSTEM, val);
-
- /*
- * Configure and register the PCI hose
- */
- hose->first_busno = 0;
- hose->last_busno = 0xff;
-
- /* System memory space, window 0 256 MB non-prefetchable */
- pci_set_region(hose->regions + 0,
- PCI_BUS_NONMEM_START, PHYS_PCI_MEM_BASE,
- SZ_256M,
- PCI_REGION_MEM);
-
- /* System memory space, window 1 256 MB prefetchable */
- pci_set_region(hose->regions + 1,
- PCI_BUS_PREMEM_START, PHYS_PCI_MEM_BASE + SZ_256M,
- SZ_256M,
- PCI_REGION_MEM |
- PCI_REGION_PREFETCH);
-
- /* PCI I/O space */
- pci_set_region(hose->regions + 2,
- 0x00000000, PHYS_PCI_IO_BASE, 0x01000000,
- PCI_REGION_IO);
-
- /* PCI Memory - config space */
- pci_set_region(hose->regions + 3,
- 0x00000000, PHYS_PCI_CONFIG_BASE, 0x01000000,
- PCI_REGION_MEM);
- /* PCI V3 regs */
- pci_set_region(hose->regions + 4,
- 0x00000000, PHYS_PCI_V3_BASE, 0x01000000,
- PCI_REGION_MEM);
-
- hose->region_count = 5;
-
- pci_set_ops(hose,
- pci_integrator_read_byte,
- pci_integrator_read__word,
- pci_integrator_read_dword,
- pci_integrator_write_byte,
- pci_integrator_write_word,
- pci_integrator_write_dword);
-
- pci_register_hose(hose);
-
- pciauto_config_init(hose);
- pciauto_config_device(hose, 0);
-
- hose->last_busno = pci_hose_scan(hose);
-}
diff --git a/board/armltd/integrator/pci_v3.h b/board/armltd/integrator/pci_v3.h
deleted file mode 100644
index 8d09e6966db2..000000000000
--- a/board/armltd/integrator/pci_v3.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * arch/arm/include/asm/hardware/pci_v3.h
- *
- * Internal header file PCI V3 chip
- *
- * Copyright (C) ARM Limited
- * Copyright (C) 2000-2001 Deep Blue Solutions Ltd.
- */
-#ifndef ASM_ARM_HARDWARE_PCI_V3_H
-#define ASM_ARM_HARDWARE_PCI_V3_H
-
-/* -------------------------------------------------------------------------------
- * V3 Local Bus to PCI Bridge definitions
- * -------------------------------------------------------------------------------
- * Registers (these are taken from page 129 of the EPC User's Manual Rev 1.04
- * All V3 register names are prefaced by V3_ to avoid clashing with any other
- * PCI definitions. Their names match the user's manual.
- *
- * I'm assuming that I20 is disabled.
- *
- */
-#define V3_PCI_VENDOR 0x00000000
-#define V3_PCI_DEVICE 0x00000002
-#define V3_PCI_CMD 0x00000004
-#define V3_PCI_STAT 0x00000006
-#define V3_PCI_CC_REV 0x00000008
-#define V3_PCI_HDR_CFG 0x0000000C
-#define V3_PCI_IO_BASE 0x00000010
-#define V3_PCI_BASE0 0x00000014
-#define V3_PCI_BASE1 0x00000018
-#define V3_PCI_SUB_VENDOR 0x0000002C
-#define V3_PCI_SUB_ID 0x0000002E
-#define V3_PCI_ROM 0x00000030
-#define V3_PCI_BPARAM 0x0000003C
-#define V3_PCI_MAP0 0x00000040
-#define V3_PCI_MAP1 0x00000044
-#define V3_PCI_INT_STAT 0x00000048
-#define V3_PCI_INT_CFG 0x0000004C
-#define V3_LB_BASE0 0x00000054
-#define V3_LB_BASE1 0x00000058
-#define V3_LB_MAP0 0x0000005E
-#define V3_LB_MAP1 0x00000062
-#define V3_LB_BASE2 0x00000064
-#define V3_LB_MAP2 0x00000066
-#define V3_LB_SIZE 0x00000068
-#define V3_LB_IO_BASE 0x0000006E
-#define V3_FIFO_CFG 0x00000070
-#define V3_FIFO_PRIORITY 0x00000072
-#define V3_FIFO_STAT 0x00000074
-#define V3_LB_ISTAT 0x00000076
-#define V3_LB_IMASK 0x00000077
-#define V3_SYSTEM 0x00000078
-#define V3_LB_CFG 0x0000007A
-#define V3_PCI_CFG 0x0000007C
-#define V3_DMA_PCI_ADR0 0x00000080
-#define V3_DMA_PCI_ADR1 0x00000090
-#define V3_DMA_LOCAL_ADR0 0x00000084
-#define V3_DMA_LOCAL_ADR1 0x00000094
-#define V3_DMA_LENGTH0 0x00000088
-#define V3_DMA_LENGTH1 0x00000098
-#define V3_DMA_CSR0 0x0000008B
-#define V3_DMA_CSR1 0x0000009B
-#define V3_DMA_CTLB_ADR0 0x0000008C
-#define V3_DMA_CTLB_ADR1 0x0000009C
-#define V3_DMA_DELAY 0x000000E0
-#define V3_MAIL_DATA 0x000000C0
-#define V3_PCI_MAIL_IEWR 0x000000D0
-#define V3_PCI_MAIL_IERD 0x000000D2
-#define V3_LB_MAIL_IEWR 0x000000D4
-#define V3_LB_MAIL_IERD 0x000000D6
-#define V3_MAIL_WR_STAT 0x000000D8
-#define V3_MAIL_RD_STAT 0x000000DA
-#define V3_QBA_MAP 0x000000DC
-
-/* PCI COMMAND REGISTER bits
- */
-#define V3_COMMAND_M_FBB_EN (1 << 9)
-#define V3_COMMAND_M_SERR_EN (1 << 8)
-#define V3_COMMAND_M_PAR_EN (1 << 6)
-#define V3_COMMAND_M_MASTER_EN (1 << 2)
-#define V3_COMMAND_M_MEM_EN (1 << 1)
-#define V3_COMMAND_M_IO_EN (1 << 0)
-
-/* SYSTEM REGISTER bits
- */
-#define V3_SYSTEM_M_RST_OUT (1 << 15)
-#define V3_SYSTEM_M_LOCK (1 << 14)
-
-/* PCI_CFG bits
- */
-#define V3_PCI_CFG_M_I2O_EN (1 << 15)
-#define V3_PCI_CFG_M_IO_REG_DIS (1 << 14)
-#define V3_PCI_CFG_M_IO_DIS (1 << 13)
-#define V3_PCI_CFG_M_EN3V (1 << 12)
-#define V3_PCI_CFG_M_RETRY_EN (1 << 10)
-#define V3_PCI_CFG_M_AD_LOW1 (1 << 9)
-#define V3_PCI_CFG_M_AD_LOW0 (1 << 8)
-
-/* PCI_BASE register bits (PCI -> Local Bus)
- */
-#define V3_PCI_BASE_M_ADR_BASE 0xFFF00000
-#define V3_PCI_BASE_M_ADR_BASEL 0x000FFF00
-#define V3_PCI_BASE_M_PREFETCH (1 << 3)
-#define V3_PCI_BASE_M_TYPE (3 << 1)
-#define V3_PCI_BASE_M_IO (1 << 0)
-
-/* PCI MAP register bits (PCI -> Local bus)
- */
-#define V3_PCI_MAP_M_MAP_ADR 0xFFF00000
-#define V3_PCI_MAP_M_RD_POST_INH (1 << 15)
-#define V3_PCI_MAP_M_ROM_SIZE (3 << 10)
-#define V3_PCI_MAP_M_SWAP (3 << 8)
-#define V3_PCI_MAP_M_ADR_SIZE 0x000000F0
-#define V3_PCI_MAP_M_REG_EN (1 << 1)
-#define V3_PCI_MAP_M_ENABLE (1 << 0)
-
-#define V3_PCI_MAP_M_ADR_SIZE_1MB (0 << 4)
-#define V3_PCI_MAP_M_ADR_SIZE_2MB (1 << 4)
-#define V3_PCI_MAP_M_ADR_SIZE_4MB (2 << 4)
-#define V3_PCI_MAP_M_ADR_SIZE_8MB (3 << 4)
-#define V3_PCI_MAP_M_ADR_SIZE_16MB (4 << 4)
-#define V3_PCI_MAP_M_ADR_SIZE_32MB (5 << 4)
-#define V3_PCI_MAP_M_ADR_SIZE_64MB (6 << 4)
-#define V3_PCI_MAP_M_ADR_SIZE_128MB (7 << 4)
-#define V3_PCI_MAP_M_ADR_SIZE_256MB (8 << 4)
-#define V3_PCI_MAP_M_ADR_SIZE_512MB (9 << 4)
-#define V3_PCI_MAP_M_ADR_SIZE_1GB (10 << 4)
-#define V3_PCI_MAP_M_ADR_SIZE_2GB (11 << 4)
-
-/*
- * LB_BASE0,1 register bits (Local bus -> PCI)
- */
-#define V3_LB_BASE_ADR_BASE 0xfff00000
-#define V3_LB_BASE_SWAP (3 << 8)
-#define V3_LB_BASE_ADR_SIZE (15 << 4)
-#define V3_LB_BASE_PREFETCH (1 << 3)
-#define V3_LB_BASE_ENABLE (1 << 0)
-
-#define V3_LB_BASE_ADR_SIZE_1MB (0 << 4)
-#define V3_LB_BASE_ADR_SIZE_2MB (1 << 4)
-#define V3_LB_BASE_ADR_SIZE_4MB (2 << 4)
-#define V3_LB_BASE_ADR_SIZE_8MB (3 << 4)
-#define V3_LB_BASE_ADR_SIZE_16MB (4 << 4)
-#define V3_LB_BASE_ADR_SIZE_32MB (5 << 4)
-#define V3_LB_BASE_ADR_SIZE_64MB (6 << 4)
-#define V3_LB_BASE_ADR_SIZE_128MB (7 << 4)
-#define V3_LB_BASE_ADR_SIZE_256MB (8 << 4)
-#define V3_LB_BASE_ADR_SIZE_512MB (9 << 4)
-#define V3_LB_BASE_ADR_SIZE_1GB (10 << 4)
-#define V3_LB_BASE_ADR_SIZE_2GB (11 << 4)
-
-#define v3_addr_to_lb_base(a) ((a) & V3_LB_BASE_ADR_BASE)
-
-/*
- * LB_MAP0,1 register bits (Local bus -> PCI)
- */
-#define V3_LB_MAP_MAP_ADR 0xfff0
-#define V3_LB_MAP_TYPE (7 << 1)
-#define V3_LB_MAP_AD_LOW_EN (1 << 0)
-
-#define V3_LB_MAP_TYPE_IACK (0 << 1)
-#define V3_LB_MAP_TYPE_IO (1 << 1)
-#define V3_LB_MAP_TYPE_MEM (3 << 1)
-#define V3_LB_MAP_TYPE_CONFIG (5 << 1)
-#define V3_LB_MAP_TYPE_MEM_MULTIPLE (6 << 1)
-
-/* PCI MAP register bits (PCI -> Local bus) */
-#define v3_addr_to_lb_map(a) (((a) >> 16) & V3_LB_MAP_MAP_ADR)
-
-/*
- * LB_BASE2 register bits (Local bus -> PCI IO)
- */
-#define V3_LB_BASE2_ADR_BASE 0xff00
-#define V3_LB_BASE2_SWAP (3 << 6)
-#define V3_LB_BASE2_ENABLE (1 << 0)
-
-#define v3_addr_to_lb_base2(a) (((a) >> 16) & V3_LB_BASE2_ADR_BASE)
-
-/*
- * LB_MAP2 register bits (Local bus -> PCI IO)
- */
-#define V3_LB_MAP2_MAP_ADR 0xff00
-
-#define v3_addr_to_lb_map2(a) (((a) >> 16) & V3_LB_MAP2_MAP_ADR)
-
-#endif
diff --git a/configs/integratorap_cm720t_defconfig b/configs/integratorap_cm720t_defconfig
index 5d28135a8220..378bf936d737 100644
--- a/configs/integratorap_cm720t_defconfig
+++ b/configs/integratorap_cm720t_defconfig
@@ -16,7 +16,6 @@ CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="Integrator-AP # "
CONFIG_CMD_IMLS=y
CONFIG_CMD_ARMFLASH=y
-CONFIG_CMD_PCI=y
# CONFIG_CMD_SETEXPR is not set
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
# CONFIG_MMC is not set
@@ -24,8 +23,5 @@ CONFIG_MTD_NOR_FLASH=y
CONFIG_FLASH_CFI_DRIVER=y
CONFIG_SYS_FLASH_PROTECTION=y
CONFIG_SYS_FLASH_CFI=y
-CONFIG_EEPRO100=y
-CONFIG_TULIP=y
-CONFIG_PCI=y
CONFIG_BAUDRATE=38400
CONFIG_OF_LIBFDT=y
diff --git a/configs/integratorap_cm920t_defconfig b/configs/integratorap_cm920t_defconfig
index 0e914e91ebed..4ec2961a4ecb 100644
--- a/configs/integratorap_cm920t_defconfig
+++ b/configs/integratorap_cm920t_defconfig
@@ -16,7 +16,6 @@ CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="Integrator-AP # "
CONFIG_CMD_IMLS=y
CONFIG_CMD_ARMFLASH=y
-CONFIG_CMD_PCI=y
# CONFIG_CMD_SETEXPR is not set
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
# CONFIG_MMC is not set
@@ -24,8 +23,5 @@ CONFIG_MTD_NOR_FLASH=y
CONFIG_FLASH_CFI_DRIVER=y
CONFIG_SYS_FLASH_PROTECTION=y
CONFIG_SYS_FLASH_CFI=y
-CONFIG_EEPRO100=y
-CONFIG_TULIP=y
-CONFIG_PCI=y
CONFIG_BAUDRATE=38400
CONFIG_OF_LIBFDT=y
diff --git a/configs/integratorap_cm926ejs_defconfig b/configs/integratorap_cm926ejs_defconfig
index d28bc0f976cf..012d346500f5 100644
--- a/configs/integratorap_cm926ejs_defconfig
+++ b/configs/integratorap_cm926ejs_defconfig
@@ -16,7 +16,6 @@ CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="Integrator-AP # "
CONFIG_CMD_IMLS=y
CONFIG_CMD_ARMFLASH=y
-CONFIG_CMD_PCI=y
# CONFIG_CMD_SETEXPR is not set
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
# CONFIG_MMC is not set
@@ -24,8 +23,5 @@ CONFIG_MTD_NOR_FLASH=y
CONFIG_FLASH_CFI_DRIVER=y
CONFIG_SYS_FLASH_PROTECTION=y
CONFIG_SYS_FLASH_CFI=y
-CONFIG_EEPRO100=y
-CONFIG_TULIP=y
-CONFIG_PCI=y
CONFIG_BAUDRATE=38400
CONFIG_OF_LIBFDT=y
diff --git a/configs/integratorap_cm946es_defconfig b/configs/integratorap_cm946es_defconfig
index ae44f01ff50d..1868c7024f0f 100644
--- a/configs/integratorap_cm946es_defconfig
+++ b/configs/integratorap_cm946es_defconfig
@@ -16,7 +16,6 @@ CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="Integrator-AP # "
CONFIG_CMD_IMLS=y
CONFIG_CMD_ARMFLASH=y
-CONFIG_CMD_PCI=y
# CONFIG_CMD_SETEXPR is not set
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
# CONFIG_MMC is not set
@@ -24,8 +23,5 @@ CONFIG_MTD_NOR_FLASH=y
CONFIG_FLASH_CFI_DRIVER=y
CONFIG_SYS_FLASH_PROTECTION=y
CONFIG_SYS_FLASH_CFI=y
-CONFIG_EEPRO100=y
-CONFIG_TULIP=y
-CONFIG_PCI=y
CONFIG_BAUDRATE=38400
CONFIG_OF_LIBFDT=y
--
2.31.1
2
2
From: Sinan Akman <sinan(a)writeme.com>
Signed-off-by: Sinan Akman <sinan(a)writeme.com>
---
arch/powerpc/cpu/mpc83xx/pci.c | 2 ++
arch/powerpc/dts/mpc8379erdb.dts | 52 +++++++++++++++++++++++++++++++
board/freescale/mpc837xerdb/mpc837xerdb.c | 11 ++++++-
configs/MPC837XERDB_defconfig | 18 +++++------
4 files changed, 73 insertions(+), 10 deletions(-)
diff --git a/arch/powerpc/cpu/mpc83xx/pci.c b/arch/powerpc/cpu/mpc83xx/pci.c
index 5c289d0022..507ab3417b 100644
--- a/arch/powerpc/cpu/mpc83xx/pci.c
+++ b/arch/powerpc/cpu/mpc83xx/pci.c
@@ -27,6 +27,7 @@ DECLARE_GLOBAL_DATA_PTR;
static struct pci_controller pci_hose[MAX_BUSES];
static int pci_num_buses;
+#if !defined(CONFIG_DM_PCI)
static void pci_init_bus(int bus, struct pci_region *reg)
{
volatile immap_t *immr = (volatile immap_t *)CONFIG_SYS_IMMR;
@@ -184,6 +185,7 @@ void mpc83xx_pcislave_unlock(int bus)
hose->last_busno = pci_hose_scan(hose);
}
#endif
+#endif /* CONFIG_DM_PCI */
#if defined(CONFIG_OF_LIBFDT)
void ft_pci_setup(void *blob, struct bd_info *bd)
diff --git a/arch/powerpc/dts/mpc8379erdb.dts b/arch/powerpc/dts/mpc8379erdb.dts
index b1881b161c..2e7c8f103c 100644
--- a/arch/powerpc/dts/mpc8379erdb.dts
+++ b/arch/powerpc/dts/mpc8379erdb.dts
@@ -69,6 +69,58 @@
device_type = "ipic";
};
+ usb@23000 {
+ compatible = "fsl-usb2-dr";
+ reg = <0x23000 0x1000>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ interrupt-parent = <&ipic>;
+ interrupts = <38 0x8>;
+ phy_type = "ulpi";
+ };
+
+ enet0: ethernet@24000 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ cell-index = <0>;
+ device_type = "network";
+ model = "eTSEC";
+ compatible = "fsl,etsec2";
+ reg = <0x24000 0x1000>;
+ ranges = <0x0 0x24000 0x1000>;
+ local-mac-address = [ 00 00 00 00 00 00 ];
+ interrupts = <32 0x8 33 0x8 34 0x8>;
+ phy-connection-type = "mii";
+ interrupt-parent = <&ipic>;
+ fixed-link = <1 0 1000 0 0>;
+ phy-handle = <&phy>;
+ fsl,magic-packet;
+
+ mdio@520 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "fsl,etsec2-mdio";
+ reg = <0x520 0x20>;
+
+ phy: ethernet-phy@2 {
+ interrupt-parent = <&ipic>;
+ interrupts = <17 0x8>;
+ reg = <0x2>;
+ device_type = "ethernet-phy";
+ };
+ };
+ };
+
+ pci0: pci@e0008300 {
+ #address-cells = <3>;
+ #size-cells = <2>;
+ #interrupt-cells = <1>;
+ device_type = "pci";
+ reg = <0x0 0xe0008300 0x0 0x00000fff>;
+ compatible = "fsl,mpc837x-pci";
+ clock-frequency = <0>;
+ };
+
};
};
diff --git a/board/freescale/mpc837xerdb/mpc837xerdb.c b/board/freescale/mpc837xerdb/mpc837xerdb.c
index 624e92ef9c..66b3d9a465 100644
--- a/board/freescale/mpc837xerdb/mpc837xerdb.c
+++ b/board/freescale/mpc837xerdb/mpc837xerdb.c
@@ -176,7 +176,7 @@ int board_early_init_f(void)
}
#ifdef CONFIG_FSL_ESDHC
-#if !(CONFIG_IS_ENABLED(DM_MMC))
+#if !(CONFIG_IS_ENABLED(DM_MMC) || CONFIG_IS_ENABLED(DM_USB))
int board_mmc_init(struct bd_info *bd)
{
struct immap __iomem *im = (struct immap __iomem *)CONFIG_SYS_IMMR;
@@ -217,6 +217,15 @@ int misc_init_r(void)
return rc;
}
+int board_late_init(void)
+{
+ volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
+#ifdef CONFIG_USB
+ clrsetbits_be32(&immap->sysconf.sicrl, SICRL_USB_A, 0x40000000);
+#endif
+ return 0;
+}
+
#if defined(CONFIG_OF_BOARD_SETUP)
int ft_board_setup(void *blob, struct bd_info *bd)
diff --git a/configs/MPC837XERDB_defconfig b/configs/MPC837XERDB_defconfig
index 63ce36d533..b6161ca072 100644
--- a/configs/MPC837XERDB_defconfig
+++ b/configs/MPC837XERDB_defconfig
@@ -147,7 +147,9 @@ CONFIG_OF_BOARD_SETUP=y
CONFIG_OF_STDOUT_VIA_ALIAS=y
CONFIG_SYS_EXTRA_OPTIONS="PCIE"
CONFIG_BOOTDELAY=6
+CONFIG_BOARD_LATE_INIT=y
CONFIG_MISC_INIT_R=y
+CONFIG_PCI_INIT_R=y
CONFIG_HUSH_PARSER=y
CONFIG_CMD_IMLS=y
CONFIG_CMD_I2C=y
@@ -173,16 +175,14 @@ CONFIG_FLASH_CFI_DRIVER=y
CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
CONFIG_SYS_FLASH_PROTECTION=y
CONFIG_SYS_FLASH_CFI=y
-CONFIG_PHY_ATHEROS=y
-CONFIG_PHY_BROADCOM=y
-CONFIG_PHY_DAVICOM=y
-CONFIG_PHY_LXT=y
-CONFIG_PHY_MARVELL=y
-CONFIG_PHY_NATSEMI=y
-CONFIG_PHY_REALTEK=y
-CONFIG_PHY_SMSC=y
-CONFIG_PHY_VITESSE=y
+CONFIG_DM_ETH=y
+CONFIG_DM_MDIO=y
+CONFIG_DM_ETH_PHY=y
+CONFIG_RGMII=y
+CONFIG_MII=y
CONFIG_TSEC_ENET=y
+CONFIG_DM_PCI=y
CONFIG_SYS_NS16550=y
CONFIG_USB=y
+CONFIG_DM_USB=y
CONFIG_USB_EHCI_HCD=y
--
2.14.5
2
1
This is a stripped down version of the vendor U-Boot patch by Aditya
Prayoga found in the armbian repository. This patch is enough to have
the 1G ethernet port, the micro SD card, eMMC and UART operational and
let it boot a Debian netboot installer.
The device tree is contained in Linux v5.11-rc1. During my work on
U-Boot I noticed a wrong pull setting, the corresponding patch is still
in linux-next and already applied in the copy that is added by this
patch.
Signed-off-by: Uwe Kleine-König <uwe(a)kleine-koenig.org>
---
Hello,
@Aditya: I kept you as maintainer in MAINTAINERS, is this ok for you?
I doubt that I'm qualified enough for that.
So please wait for this question to be resolved before you apply this
patch.
Best regards
Uwe
arch/arm/dts/Makefile | 1 +
.../arm/dts/rk3399-kobol-helios64-u-boot.dtsi | 266 +++++++++++++
arch/arm/dts/rk3399-kobol-helios64.dts | 372 ++++++++++++++++++
arch/arm/mach-rockchip/rk3399/Kconfig | 17 +
board/kobol/helios64/Kconfig | 24 ++
board/kobol/helios64/MAINTAINERS | 6 +
board/kobol/helios64/Makefile | 5 +
board/kobol/helios64/helios64.c | 262 ++++++++++++
board/kobol/helios64/sys_otp.c | 248 ++++++++++++
board/kobol/helios64/sys_otp.h | 10 +
configs/helios64-rk3399_defconfig | 142 +++++++
include/configs/helios64.h | 47 +++
12 files changed, 1400 insertions(+)
create mode 100644 arch/arm/dts/rk3399-kobol-helios64-u-boot.dtsi
create mode 100644 arch/arm/dts/rk3399-kobol-helios64.dts
create mode 100644 board/kobol/helios64/Kconfig
create mode 100644 board/kobol/helios64/MAINTAINERS
create mode 100644 board/kobol/helios64/Makefile
create mode 100644 board/kobol/helios64/helios64.c
create mode 100644 board/kobol/helios64/sys_otp.c
create mode 100644 board/kobol/helios64/sys_otp.h
create mode 100644 configs/helios64-rk3399_defconfig
create mode 100644 include/configs/helios64.h
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index fd47e408f826..752ba4fd8b35 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -125,6 +125,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3399) += \
rk3399-ficus.dtb \
rk3399-firefly.dtb \
rk3399-gru-bob.dtb \
+ rk3399-kobol-helios64.dtb \
rk3399-khadas-edge.dtb \
rk3399-khadas-edge-captain.dtb \
rk3399-khadas-edge-v.dtb \
diff --git a/arch/arm/dts/rk3399-kobol-helios64-u-boot.dtsi b/arch/arm/dts/rk3399-kobol-helios64-u-boot.dtsi
new file mode 100644
index 000000000000..84a27548a08d
--- /dev/null
+++ b/arch/arm/dts/rk3399-kobol-helios64-u-boot.dtsi
@@ -0,0 +1,266 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2020 Aditya Prayoga (aditya(a)kobol.io)
+ */
+
+#include "rk3399-u-boot.dtsi"
+#include "rk3399-sdram-lpddr4-100.dtsi"
+
+/ {
+ aliases {
+ spi0 = &spi1;
+ ethernet0 = &gmac;
+ };
+
+ chosen {
+ bootargs = "earlycon=uart8250,mmio32,0xff1a0000 earlyprintk";
+ stdout-path = "serial2:1500000n8";
+ u-boot,spl-boot-order = "same-as-spl", &spiflash, &sdmmc, &sdhci;
+ };
+
+ config {
+ u-boot,spl-payload-offset = <0x80000>; /* @ 512KB */
+ };
+
+ leds {
+ led-1 {
+ linux,default-trigger = "panic";
+ };
+ };
+
+ vcc3v0_sd: vcc3v0-sd {
+ startup-delay-us = <20000>;
+ };
+};
+
+&cpu_alert0 {
+ temperature = <80000>;
+};
+
+&cpu_alert1 {
+ temperature = <95000>;
+};
+
+&cpu_crit {
+ temperature = <100000>;
+};
+
+&i2c0 {
+ rk808: pmic@1b {
+ rockchip,system-power-controller;
+
+ regulators {
+ vdd_center: DCDC_REG1 {
+ regulator-name = "vdd_center";
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-min-microvolt = <950000>;
+ regulator-max-microvolt = <950000>;
+ regulator-init-microvolt = <950000>;
+ regulator-ramp-delay = <6001>;
+ regulator-state-mem {
+ regulator-on-in-suspend;
+ regulator-suspend-microvolt = <950000>;
+ };
+ };
+
+ vcc_ddr_s3: DCDC_REG3 {
+ regulator-name = "vcc_ddr_s3";
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-state-mem {
+ regulator-on-in-suspend;
+ };
+ };
+
+ /* not used */
+ vcc1v8_dvp: LDO_REG1 {
+ regulator-name = "vcc1v8_dvp";
+ };
+
+ /* not used */
+ vcc3v0_touch: LDO_REG2 {
+ regulator-name = "vcc3v0_touch";
+ };
+
+ vcc1v8_s3: LDO_REG3 {
+ regulator-name = "vcc1v8_s3";
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ regulator-state-mem {
+ regulator-on-in-suspend;
+ regulator-suspend-microvolt = <1800000>;
+ };
+ };
+
+ /* not used */
+ vcca3v0_codec: LDO_REG5 {
+ regulator-name = "vcca3v0_codec";
+ };
+
+ vcc1v5_s3: LDO_REG6 {
+ regulator-name = "vcc1v5_s3";
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-min-microvolt = <1500000>;
+ regulator-max-microvolt = <1500000>;
+ regulator-state-mem {
+ regulator-on-in-suspend;
+ regulator-suspend-microvolt = <1500000>;
+ };
+ };
+
+ /* not used */
+ vcca1v8_codec: LDO_REG7 {
+ regulator-name = "vcca1v8_codec";
+ };
+
+ vcc3v3_sys_s0: SWITCH_REG1 {
+ regulator-name = "vcc3v3_sys_s0";
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
+ };
+
+ vcc3v3_s0: SWITCH_REG2 {
+ regulator-name = "vcc3v3_s0";
+ };
+ };
+ };
+
+ vdd_cpu_b: regulator@40 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&vsel1_gpio>;
+ vsel-gpios = <&gpio1 RK_PC1 GPIO_ACTIVE_HIGH>;
+ regulator-compatible = "fan53555-reg";
+ };
+
+ vdd_gpu: regulator@41 {
+ compatible = "silergy,syr828";
+ reg = <0x41>;
+ fcs,suspend-voltage-selector = <1>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&vsel2_gpio>;
+ vsel-gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_HIGH>;
+ regulator-compatible = "fan53555-reg";
+ regulator-name = "vdd_gpu";
+ regulator-min-microvolt = <712500>;
+ regulator-max-microvolt = <1500000>;
+ regulator-ramp-delay = <1000>;
+ regulator-always-on;
+ regulator-boot-on;
+ vin-supply = <&vcc5v0_sys>;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
+ };
+};
+
+&pinctrl {
+ pmic {
+ vsel1_gpio: vsel1-gpio {
+ rockchip,pins =
+ <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>;
+ };
+
+ vsel2_gpio: vsel2-gpio {
+ rockchip,pins =
+ <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>;
+ };
+ };
+};
+
+&pmu_io_domains {
+ pmu1830-supply = <&vcc3v0_s3>;
+ status = "okay";
+};
+
+&sdmmc {
+ sd-uhs-sdr104;
+};
+
+&tsadc {
+ /* tshut mode 0:CRU 1:GPIO */
+ rockchip,hw-tshut-mode = <1>;
+ /* tshut polarity 0:LOW 1:HIGH */
+ rockchip,hw-tshut-polarity = <1>;
+ status = "okay";
+};
+
+&gpio1 {
+ usb-mux-hs {
+ gpio-hog;
+ gpios = <RK_PA4 GPIO_ACTIVE_HIGH>;
+ output-low;
+ line-name = "USB_MUX_HS";
+ };
+
+ usb-mux-oe {
+ gpio-hog;
+ gpios = <RK_PB5 GPIO_ACTIVE_LOW>;
+ output-high;
+ line-name = "USB_MUX_OE#";
+ };
+
+ soc-flash-wp {
+ gpio-hog;
+ gpios = <RK_PC2 GPIO_ACTIVE_LOW>;
+ output-low;
+ line-name = "SOC_WP#";
+ };
+};
+
+&gpio2 {
+ sata-flash-wp {
+ gpio-hog;
+ gpios = <RK_PD0 GPIO_ACTIVE_LOW>;
+ output-high;
+ line-name = "SATA_WP#_LV";
+ };
+};
+
+&gpio4 {
+ auto-on-en-d {
+ gpio-hog;
+ gpios = <RK_PD1 GPIO_ACTIVE_HIGH>;
+ output-low;
+ line-name = "AUTO_ON_EN_D";
+ };
+
+ auto-on-en-clk {
+ gpio-hog;
+ gpios = <RK_PD2 GPIO_ACTIVE_HIGH>;
+ output-low;
+ line-name = "AUTO_ON_EN_CLK";
+ };
+
+ board-rev-id-0 {
+ gpio-hog;
+ gpios = <RK_PD5 GPIO_ACTIVE_HIGH>;
+ input;
+ };
+
+ board-rev-id-1 {
+ gpio-hog;
+ gpios = <RK_PD6 GPIO_ACTIVE_HIGH>;
+ input;
+ };
+};
+
+&spi1 {
+ status = "okay";
+
+ spiflash: flash@0 {
+ compatible = "jedec,spi-nor";
+ reg = <0x0>;
+ spi-max-frequency = <25000000>;
+ status = "okay";
+ m25p,fast-read;
+ u-boot,dm-pre-reloc;
+ };
+};
diff --git a/arch/arm/dts/rk3399-kobol-helios64.dts b/arch/arm/dts/rk3399-kobol-helios64.dts
new file mode 100644
index 000000000000..66c725a34220
--- /dev/null
+++ b/arch/arm/dts/rk3399-kobol-helios64.dts
@@ -0,0 +1,372 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2020 Aditya Prayoga <aditya(a)kobol.io>
+ */
+
+/*
+ * The Kobol Helios64 is a board designed to operate as a NAS and optionally
+ * ships with an enclosing that can host five 2.5" hard disks.
+ *
+ * See https://wiki.kobol.io/helios64/intro/ for further details.
+ */
+
+/dts-v1/;
+#include "rk3399.dtsi"
+#include "rk3399-opp.dtsi"
+
+/ {
+ model = "Kobol Helios64";
+ compatible = "kobol,helios64", "rockchip,rk3399";
+
+ avdd_1v8_s0: avdd-1v8-s0 {
+ compatible = "regulator-fixed";
+ regulator-name = "avdd_1v8_s0";
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ vin-supply = <&vcc3v3_sys_s3>;
+ };
+
+ clkin_gmac: external-gmac-clock {
+ compatible = "fixed-clock";
+ clock-frequency = <125000000>;
+ clock-output-names = "clkin_gmac";
+ #clock-cells = <0>;
+ };
+
+ leds {
+ compatible = "gpio-leds";
+ pinctrl-names = "default";
+ pinctrl-0 = <&sys_grn_led_on &sys_red_led_on>;
+
+ led-0 {
+ label = "helios64:green:status";
+ gpios = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>;
+ default-state = "on";
+ };
+
+ led-1 {
+ label = "helios64:red:fault";
+ gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>;
+ default-state = "keep";
+ };
+ };
+
+ vcc1v8_sys_s0: vcc1v8-sys-s0 {
+ compatible = "regulator-fixed";
+ regulator-name = "vcc1v8_sys_s0";
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ vin-supply = <&vcc1v8_sys_s3>;
+ };
+
+ vcc3v0_sd: vcc3v0-sd {
+ compatible = "regulator-fixed";
+ enable-active-high;
+ gpio = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>;
+ regulator-name = "vcc3v0_sd";
+ regulator-boot-on;
+ regulator-min-microvolt = <3000000>;
+ regulator-max-microvolt = <3000000>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&sdmmc0_pwr_h>;
+ vin-supply = <&vcc3v3_sys_s3>;
+ };
+
+ vcc3v3_sys_s3: vcc_lan: vcc3v3-sys-s3 {
+ compatible = "regulator-fixed";
+ regulator-name = "vcc3v3_sys_s3";
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ vin-supply = <&vcc5v0_sys>;
+
+ regulator-state-mem {
+ regulator-on-in-suspend;
+ };
+ };
+
+ vcc5v0_sys: vcc5v0-sys {
+ compatible = "regulator-fixed";
+ regulator-name = "vcc5v0_sys";
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-min-microvolt = <5000000>;
+ regulator-max-microvolt = <5000000>;
+ vin-supply = <&vcc12v_dcin_bkup>;
+
+ regulator-state-mem {
+ regulator-on-in-suspend;
+ };
+ };
+
+ vcc12v_dcin: vcc12v-dcin {
+ compatible = "regulator-fixed";
+ regulator-name = "vcc12v_dcin";
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-min-microvolt = <12000000>;
+ regulator-max-microvolt = <12000000>;
+ };
+
+ vcc12v_dcin_bkup: vcc12v-dcin-bkup {
+ compatible = "regulator-fixed";
+ regulator-name = "vcc12v_dcin_bkup";
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-min-microvolt = <12000000>;
+ regulator-max-microvolt = <12000000>;
+ vin-supply = <&vcc12v_dcin>;
+ };
+};
+
+/*
+ * The system doesn't run stable with cpu freq enabled, so disallow the lower
+ * frequencies until this problem is properly understood and resolved.
+ */
+&cluster0_opp {
+ /delete-node/ opp00;
+ /delete-node/ opp01;
+ /delete-node/ opp02;
+ /delete-node/ opp03;
+ /delete-node/ opp04;
+};
+
+&cluster1_opp {
+ /delete-node/ opp00;
+ /delete-node/ opp01;
+ /delete-node/ opp02;
+ /delete-node/ opp03;
+ /delete-node/ opp04;
+ /delete-node/ opp05;
+ /delete-node/ opp06;
+};
+
+&cpu_b0 {
+ cpu-supply = <&vdd_cpu_b>;
+};
+
+&cpu_b1 {
+ cpu-supply = <&vdd_cpu_b>;
+};
+
+&cpu_l0 {
+ cpu-supply = <&vdd_cpu_l>;
+};
+
+&cpu_l1 {
+ cpu-supply = <&vdd_cpu_l>;
+};
+
+&cpu_l2 {
+ cpu-supply = <&vdd_cpu_l>;
+};
+
+&cpu_l3 {
+ cpu-supply = <&vdd_cpu_l>;
+};
+
+&emmc_phy {
+ status = "okay";
+};
+
+&gmac {
+ assigned-clock-parents = <&clkin_gmac>;
+ assigned-clocks = <&cru SCLK_RMII_SRC>;
+ clock_in_out = "input";
+ phy-mode = "rgmii";
+ phy-supply = <&vcc_lan>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&rgmii_pins &gphy_reset>;
+ rx_delay = <0x20>;
+ tx_delay = <0x28>;
+ snps,reset-active-low;
+ snps,reset-delays-us = <0 10000 50000>;
+ snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
+ status = "okay";
+};
+
+&i2c0 {
+ clock-frequency = <400000>;
+ i2c-scl-rising-time-ns = <168>;
+ i2c-scl-falling-time-ns = <4>;
+ status = "okay";
+
+ rk808: pmic@1b {
+ compatible = "rockchip,rk808";
+ reg = <0x1b>;
+ interrupt-parent = <&gpio0>;
+ interrupts = <10 IRQ_TYPE_LEVEL_LOW>;
+ clock-output-names = "xin32k", "rk808-clkout2";
+ pinctrl-names = "default";
+ pinctrl-0 = <&pmic_int_l>;
+ vcc1-supply = <&vcc5v0_sys>;
+ vcc2-supply = <&vcc5v0_sys>;
+ vcc3-supply = <&vcc5v0_sys>;
+ vcc4-supply = <&vcc5v0_sys>;
+ vcc6-supply = <&vcc5v0_sys>;
+ vcc7-supply = <&vcc5v0_sys>;
+ vcc8-supply = <&vcc3v3_sys_s3>;
+ vcc9-supply = <&vcc5v0_sys>;
+ vcc10-supply = <&vcc5v0_sys>;
+ vcc11-supply = <&vcc5v0_sys>;
+ vcc12-supply = <&vcc3v3_sys_s3>;
+ vddio-supply = <&vcc3v0_s3>;
+ wakeup-source;
+ #clock-cells = <1>;
+
+ regulators {
+ vdd_cpu_l: DCDC_REG2 {
+ regulator-name = "vdd_cpu_l";
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-min-microvolt = <750000>;
+ regulator-max-microvolt = <1350000>;
+ regulator-ramp-delay = <6001>;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
+ };
+
+ vcc1v8_sys_s3: DCDC_REG4 {
+ regulator-name = "vcc1v8_sys_s3";
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+
+ regulator-state-mem {
+ regulator-on-in-suspend;
+ regulator-suspend-microvolt = <1800000>;
+ };
+ };
+
+ vcc_sdio_s0: LDO_REG4 {
+ regulator-name = "vcc_sdio_s0";
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <3000000>;
+
+ regulator-state-mem {
+ regulator-on-in-suspend;
+ regulator-suspend-microvolt = <3000000>;
+ };
+ };
+
+ vcc3v0_s3: LDO_REG8 {
+ regulator-name = "vcc3v0_s3";
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-min-microvolt = <3000000>;
+ regulator-max-microvolt = <3000000>;
+
+ regulator-state-mem {
+ regulator-on-in-suspend;
+ regulator-suspend-microvolt = <3000000>;
+ };
+ };
+ };
+ };
+
+ vdd_cpu_b: regulator@40 {
+ compatible = "silergy,syr827";
+ reg = <0x40>;
+ fcs,suspend-voltage-selector = <1>;
+ regulator-name = "vdd_cpu_b";
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-min-microvolt = <712500>;
+ regulator-max-microvolt = <1500000>;
+ regulator-ramp-delay = <1000>;
+ vin-supply = <&vcc5v0_sys>;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
+ };
+};
+
+&i2c2 {
+ clock-frequency = <400000>;
+ i2c-scl-rising-time-ns = <160>;
+ i2c-scl-falling-time-ns = <30>;
+ status = "okay";
+
+ temp@4c {
+ compatible = "national,lm75";
+ reg = <0x4c>;
+ };
+};
+
+&io_domains {
+ audio-supply = <&vcc1v8_sys_s0>;
+ bt656-supply = <&vcc1v8_sys_s0>;
+ gpio1830-supply = <&vcc3v0_s3>;
+ sdmmc-supply = <&vcc_sdio_s0>;
+ status = "okay";
+};
+
+&pinctrl {
+ gmac {
+ gphy_reset: gphy-reset {
+ rockchip,pins = <3 RK_PB7 RK_FUNC_GPIO &pcfg_output_low>;
+ };
+ };
+
+ leds {
+ sys_grn_led_on: sys-grn-led-on {
+ rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_down>;
+ };
+
+ sys_red_led_on: sys-red-led-on {
+ rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_down>;
+ };
+ };
+
+ pmic {
+ pmic_int_l: pmic-int-l {
+ rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
+ };
+ };
+
+ vcc3v0-sd {
+ sdmmc0_pwr_h: sdmmc0-pwr-h {
+ rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>;
+ };
+ };
+};
+
+&pmu_io_domains {
+ pmu1830-supply = <&vcc3v0_s3>;
+ status = "okay";
+};
+
+&sdhci {
+ bus-width = <8>;
+ mmc-hs200-1_8v;
+ non-removable;
+ vqmmc-supply = <&vcc1v8_sys_s0>;
+ status = "okay";
+};
+
+&sdmmc {
+ bus-width = <4>;
+ cap-sd-highspeed;
+ cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>;
+ disable-wp;
+ pinctrl-names = "default";
+ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
+ vmmc-supply = <&vcc3v0_sd>;
+ vqmmc-supply = <&vcc_sdio_s0>;
+ status = "okay";
+};
+
+&uart2 {
+ status = "okay";
+};
diff --git a/arch/arm/mach-rockchip/rk3399/Kconfig b/arch/arm/mach-rockchip/rk3399/Kconfig
index 17628f917127..7890bafe5618 100644
--- a/arch/arm/mach-rockchip/rk3399/Kconfig
+++ b/arch/arm/mach-rockchip/rk3399/Kconfig
@@ -28,6 +28,22 @@ config TARGET_PINEBOOK_PRO_RK3399
with 4Gb RAM, onboard eMMC, USB-C, a USB3 and USB2 port,
1920*1080 screen and all the usual laptop features.
+config TARGET_HELIOS64
+ bool "Kobol Innovations Helios64"
+ select BOARD_LATE_INIT
+ help
+ Helios64 is a Network Attached Storage board based on Rockchip RK3399.
+
+ Key features of the Helios64 include:
+ * on-board PCIe to 5 Ports SATA Controller JMB585
+ * on-board USB 3.0 hub (3x USB 3.0 host)
+ * USB Type-C (Support DisplayPort Alt Mode)
+ * on-board 1 Gigabit Ethernet
+ * on-board 2.5 Gigabit Ethernet (Realtek RTL8156)
+ * on-board eMMC
+ * on-board LPDDR4
+ * SPI, I2C, UART, GPIO
+
config TARGET_PUMA_RK3399
bool "Theobroma Systems RK3399-Q7 (Puma)"
help
@@ -153,6 +169,7 @@ endif # BOOTCOUNT_LIMIT
source "board/firefly/roc-pc-rk3399/Kconfig"
source "board/google/gru/Kconfig"
+source "board/kobol/helios64/Kconfig"
source "board/pine64/pinebook-pro-rk3399/Kconfig"
source "board/pine64/rockpro64_rk3399/Kconfig"
source "board/rockchip/evb_rk3399/Kconfig"
diff --git a/board/kobol/helios64/Kconfig b/board/kobol/helios64/Kconfig
new file mode 100644
index 000000000000..644cdbd8f314
--- /dev/null
+++ b/board/kobol/helios64/Kconfig
@@ -0,0 +1,24 @@
+if TARGET_HELIOS64
+
+config SYS_BOARD
+ default "helios64"
+
+config SYS_VENDOR
+ default "kobol"
+
+config SYS_CONFIG_NAME
+ default "helios64"
+
+config BOARD_SPECIFIC_OPTIONS # dummy
+ def_bool y
+
+config ENV_SECT_SIZE
+ default 0x1000 if ENV_IS_IN_SPI_FLASH
+
+config ENV_SIZE
+ default 0x8000
+
+config ENV_OFFSET
+ default 0x460000 if ENV_IS_IN_SPI_FLASH
+
+endif
diff --git a/board/kobol/helios64/MAINTAINERS b/board/kobol/helios64/MAINTAINERS
new file mode 100644
index 000000000000..a9c88c79e331
--- /dev/null
+++ b/board/kobol/helios64/MAINTAINERS
@@ -0,0 +1,6 @@
+HELIOS64 BOARD
+M: Aditya Prayoga <aditya(a)kobol.io>
+S: Maintained
+F: board/kobol/helios64/
+F: include/configs/helios64.h
+F: configs/helios64_defconfig
diff --git a/board/kobol/helios64/Makefile b/board/kobol/helios64/Makefile
new file mode 100644
index 000000000000..ab34245a6d6a
--- /dev/null
+++ b/board/kobol/helios64/Makefile
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2020 Aditya Prayoga <aditya(a)kobol.io>
+
+obj-y := helios64.o sys_otp.o
diff --git a/board/kobol/helios64/helios64.c b/board/kobol/helios64/helios64.c
new file mode 100644
index 000000000000..1fe948eec4ee
--- /dev/null
+++ b/board/kobol/helios64/helios64.c
@@ -0,0 +1,262 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2020 Aditya Prayoga (aditya(a)kobol.io)
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <env.h>
+#include <log.h>
+#include <led.h>
+#include <pci.h>
+#include <power/regulator.h>
+#include <scsi.h>
+#include <spl_gpio.h>
+#include <syscon.h>
+#include <usb.h>
+#include <linux/delay.h>
+#include <asm/io.h>
+#include <asm/gpio.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/gpio.h>
+#include <asm/arch-rockchip/grf_rk3399.h>
+#include <asm/arch-rockchip/hardware.h>
+#include <asm/arch-rockchip/misc.h>
+#include <asm/arch-rockchip/periph.h>
+
+#include "sys_otp.h"
+
+#ifndef CONFIG_TPL_BUILD
+int board_early_init_f(void)
+{
+#ifdef CONFIG_SPL_BUILD
+#define GPIO0_BASE 0xff720000
+#define GRF_BASE 0xff770000
+ struct rk3399_grf_regs * const grf = (void *)GRF_BASE;
+ struct rockchip_gpio_regs * const gpio = (void *)GPIO0_BASE;
+
+ /* Turn ON status LED. At this stage, FDT & DM is not initialized yet */
+ spl_gpio_output(gpio, GPIO(BANK_B, 4), 1);
+#endif
+ return 0;
+}
+#endif
+
+#ifndef CONFIG_SPL_BUILD
+int board_early_init_r(void)
+{
+ read_otp_data();
+ return 0;
+}
+#endif
+
+#ifdef CONFIG_MISC_INIT_R
+#define GRF_IO_VSEL_BT565_SHIFT 0
+#define GRF_IO_VSEL_AUDIO_SHIFT 1
+#define GRF_IO_VSEL_SDMMC_SHIFT 2
+#define GRF_IO_VSEL_GPIO1830_SHIFT 3
+
+#define PMUGRF_CON0_VSEL_SHIFT 8
+#define PMUGRF_CON0_PMU1830_VOL_SHIFT 9
+static void setup_iodomain(void)
+{
+ struct rk3399_grf_regs *grf =
+ syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
+ struct rk3399_pmugrf_regs *pmugrf =
+ syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF);
+
+ /* BT565 is in 1.8v domain */
+ rk_setreg(&grf->io_vsel, 1 << GRF_IO_VSEL_BT565_SHIFT);
+
+ /* AUDIO is in 1.8v domain */
+ rk_setreg(&grf->io_vsel, 1 << GRF_IO_VSEL_AUDIO_SHIFT);
+
+ /* SDMMC is in 3.0v domain */
+ rk_setreg(&grf->io_vsel, 0 << GRF_IO_VSEL_SDMMC_SHIFT);
+
+ /* GPIO1830 is in 3.0v domain */
+ rk_setreg(&grf->io_vsel, 0 << GRF_IO_VSEL_GPIO1830_SHIFT);
+
+ /* Set GPIO1 1.8v/3.0v source select to PMU1830_VOL */
+ rk_setreg(&pmugrf->soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT);
+ rk_setreg(&pmugrf->soc_con0, 0 << PMUGRF_CON0_PMU1830_VOL_SHIFT);
+}
+
+/*
+ * Swap mmc0 and mmc1 in boot_targets if booted from SD-Card.
+ *
+ * If bootsource is uSD-card we can assume that we want to use the
+ * SD-Card instead of the eMMC as first boot_target for distroboot.
+ * We only want to swap the defaults and not any custom environment a
+ * user has set. We exit early if a changed boot_targets environment
+ * is detected.
+ */
+static int setup_boottargets(void)
+{
+ const char *boot_device =
+ ofnode_read_chosen_string("u-boot,spl-boot-device");
+ char *env_default, *env;
+
+ if (!boot_device) {
+ debug("%s: /chosen/u-boot,spl-boot-device not set\n",
+ __func__);
+ return -1;
+ }
+ debug("%s: booted from %s\n", __func__, boot_device);
+
+ env_default = env_get_default("boot_targets");
+ env = env_get("boot_targets");
+ if (!env) {
+ debug("%s: boot_targets does not exist\n", __func__);
+ return -1;
+ }
+ debug("%s: boot_targets current: %s - default: %s\n",
+ __func__, env, env_default);
+
+ if (strcmp(env_default, env) != 0) {
+ debug("%s: boot_targets not default, don't change it\n",
+ __func__);
+ return 0;
+ }
+
+ /*
+ * Only run, if booting from mmc1 (i.e. /mmc@fe320000) and
+ * only consider cases where the default boot-order first
+ * tries to boot from mmc0 (eMMC) and then from mmc1
+ * (i.e. external SD).
+ *
+ * In other words: the SD card will be moved to earlier in the
+ * order, if U-Boot was also loaded from the SD-card.
+ */
+ if (!strcmp(boot_device, "/mmc@fe320000")) {
+ char *mmc0, *mmc1;
+
+ debug("%s: booted from SD-Card\n", __func__);
+ mmc0 = strstr(env, "mmc0");
+ mmc1 = strstr(env, "mmc1");
+
+ if (!mmc0 || !mmc1) {
+ debug("%s: only one mmc boot_target found\n", __func__);
+ return -1;
+ }
+
+ /*
+ * If mmc0 comes first in the boot order, we need to change
+ * the strings to make mmc1 first.
+ */
+ if (mmc0 < mmc1) {
+ mmc0[3] = '1';
+ mmc1[3] = '0';
+ debug("%s: set boot_targets to: %s\n", __func__, env);
+ env_set("boot_targets", env);
+ }
+ }
+
+ return 0;
+}
+
+static void setup_leds(void)
+{
+ struct udevice *dev;
+
+ led_get_by_label("helios64:green:status", &dev);
+ led_set_state(dev, LEDST_OFF);
+ mdelay(250);
+ led_set_state(dev, LEDST_ON);
+}
+
+int misc_init_r(void)
+{
+ const u32 cpuid_offset = 0x7;
+ const u32 cpuid_length = 0x10;
+ u8 cpuid[cpuid_length];
+ int ret;
+
+ setup_iodomain();
+ set_board_info();
+
+ ret = rockchip_cpuid_from_efuse(cpuid_offset, cpuid_length, cpuid);
+ if (ret)
+ return ret;
+
+ ret = rockchip_cpuid_set(cpuid, cpuid_length);
+ if (ret)
+ return ret;
+
+ if (mac_read_from_otp())
+ ret = rockchip_setup_macaddr();
+
+ setup_boottargets();
+ setup_leds();
+
+ return ret;
+}
+#endif
+
+#ifdef CONFIG_LAST_STAGE_INIT
+static void auto_power_enable(void)
+{
+ struct gpio_desc *enable, *clock;
+
+ if (gpio_hog_lookup_name("AUTO_ON_EN_D", &enable)) {
+ debug("Fail to get AUTO_ON_EN_D\n");
+ return;
+ }
+
+ if (gpio_hog_lookup_name("AUTO_ON_EN_CLK", &clock)) {
+ debug("Fail to get AUTO_ON_EN_CLK\n");
+ return;
+ }
+
+ dm_gpio_set_value(enable, 1);
+ dm_gpio_set_value(clock, 1);
+ mdelay(10);
+ dm_gpio_set_value(clock, 0);
+}
+
+int last_stage_init(void)
+{
+ auto_power_enable();
+
+#ifdef CONFIG_PCI
+ scsi_scan(true);
+#endif
+
+ return 0;
+}
+#endif
+
+#if defined(CONFIG_DISPLAY_BOARDINFO_LATE)
+int checkboard(void)
+{
+ int major, minor;
+
+ printf("Revision: ");
+
+ if (!get_revision(&major, &minor))
+ printf("%i.%i - %s\n", major, minor, get_variant());
+ else
+ printf("UNKNOWN\n");
+
+ return 0;
+}
+#endif
+
+#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
+int ft_board_setup(void *blob, struct bd_info *bd)
+{
+ char *env;
+
+ env = env_get("board_rev");
+ if (env)
+ fdt_setprop_string(blob, fdt_path_offset(blob, "/"),
+ "kobol,board-rev", env);
+
+ env = env_get("cpuid#");
+ if (env)
+ fdt_setprop_string(blob, fdt_path_offset(blob, "/"),
+ "kobol,cpu-id", env);
+
+ return 0;
+}
+#endif
diff --git a/board/kobol/helios64/sys_otp.c b/board/kobol/helios64/sys_otp.c
new file mode 100644
index 000000000000..3a27834641bd
--- /dev/null
+++ b/board/kobol/helios64/sys_otp.c
@@ -0,0 +1,248 @@
+#include <linux/types.h>
+#include <dm.h>
+#include <spi.h>
+#include <log.h>
+#include <net.h>
+#include <u-boot/crc.h>
+
+#include "sys_otp.h"
+
+#define OTP_DEVICE_BUS 0
+#define OTP_DEVICE_CS 0
+#define MAX_NUM_PORTS 2
+
+enum board_variant {
+ BOARD_VARIANT_INVALID = 0,
+ BOARD_VARIANT_ENG_SAMPLE,
+ BOARD_VARIANT_4G_PROD_NO_ECC,
+ BOARD_VARIANT_MAX
+};
+
+struct __attribute__ ((__packed__)) otp_data_t {
+ u8 magic[8];
+ u8 part_num[16];
+ u8 variant;
+ u8 revision;
+ u8 serial_num[6];
+ u8 mfg_year[2];
+ u8 mfg_month;
+ u8 mfg_day;
+ u8 mac_addr[MAX_NUM_PORTS][6];
+ u8 reserved[204];
+ u32 checksum;
+} otp;
+
+static struct spi_slave *slave;
+static int has_been_read = 0;
+static int data_valid = 0;
+
+static inline int is_data_valid(void)
+{
+ return data_valid;
+}
+
+static inline int is_valid_header(void)
+{
+ if ((otp.magic[0] == 'H') || (otp.magic[1] == '6') ||
+ (otp.magic[2] == '4') || (otp.magic[3] == 'N') ||
+ (otp.magic[4] == 'P') || (otp.magic[5] == 'V') ||
+ (otp.magic[6] == '1') || (otp.magic[7] == 0))
+
+ return 1;
+
+ return 0;
+}
+
+static int init_system_otp(int bus, int cs)
+{
+ int ret;
+ char name[30], *str;
+ struct udevice *dev;
+
+ snprintf(name, sizeof(name), "generic_%d:%d", bus, cs);
+ str = strdup(name);
+ if (!str)
+ return -ENOMEM;
+ ret = spi_get_bus_and_cs(bus, cs, 25000000, CONFIG_DEFAULT_SPI_MODE, "spi_generic_drv",
+ str, &dev, &slave);
+ return ret;
+}
+
+#ifdef DEBUG
+/**
+ * show_otp_data - display the contents of the OTP register
+ */
+static void show_otp_data(void)
+{
+ u32 i;
+ u32 crc;
+
+ const char* var_str[BOARD_VARIANT_MAX] = {
+ "Invalid variant",
+ "Engineering Sample",
+ "Production - 4GB non ECC"
+ };
+
+ printf("\n");
+ printf("Register dump: (%lu bytes)\n", sizeof(otp));
+ for (i = 0; i < sizeof(otp); i++) {
+ if ((i % 16) == 0)
+ printf("%02X: ", i);
+ printf("%02X ", ((u8 *)&otp)[i]);
+ if (((i % 16) == 15) || (i == sizeof(otp) - 1))
+ printf("\n");
+ }
+
+ if (!is_valid_header())
+ return;
+
+ printf("Part Number: %s\n", otp.part_num);
+ printf("Variant: %s\n", var_str[otp.variant]);
+ printf("Revision: %x.%x\n", (otp.revision & 0xf0) >> 4, otp.revision & 0x0f);
+ printf("Serial Number: %012llx\n", *((uint64_t*) otp.serial_num) &
+ 0xFFFFFFFFFFFF);
+ printf("Manufacturing Date: %02X-%02X-%04X (DD-MM-YYYY)\n", otp.mfg_day,
+ otp.mfg_month, *(u16*) otp.mfg_year);
+
+ printf("1GbE MAC Address: %02X:%02X:%02X:%02X:%02X:%02X\n",
+ otp.mac_addr[0][0], otp.mac_addr[0][1], otp.mac_addr[0][2],
+ otp.mac_addr[0][3], otp.mac_addr[0][4], otp.mac_addr[0][5]);
+
+ printf("2.5GbE MAC Address: %02X:%02X:%02X:%02X:%02X:%02X\n",
+ otp.mac_addr[1][0], otp.mac_addr[1][1], otp.mac_addr[1][2],
+ otp.mac_addr[1][3], otp.mac_addr[1][4], otp.mac_addr[1][5]);
+
+ crc = crc32(0, (void *)&otp, sizeof(otp) - 4);
+
+ if (crc == le32_to_cpu(otp.checksum))
+ printf("CRC: %08x\n\n", le32_to_cpu(otp.checksum));
+ else
+ printf("CRC: %08x (should be %08x)\n\n",
+ le32_to_cpu(otp.checksum), crc);
+
+}
+#endif
+
+int read_otp_data(void)
+{
+ int ret;
+ u8 dout[5];
+
+ if (has_been_read) {
+ if (is_data_valid())
+ return 0;
+ else
+ goto data_invalid;
+ }
+
+ ret = init_system_otp(OTP_DEVICE_BUS, OTP_DEVICE_CS);
+ if (ret)
+ return ret;
+
+ ret = spi_claim_bus(slave);
+ if (ret) {
+ debug("SPI: Failed to claim SPI bus: %d\n", ret);
+ return ret;
+ }
+
+ dout[0] = 0x48;
+ dout[1] = 0x00;
+ dout[2] = 0x10; /* Security Register #1 */
+ dout[3] = 0x00;
+ dout[4] = 0x00; /* Dummy Byte */
+
+ ret = spi_write_then_read(slave, dout, sizeof(dout), NULL, (u8 *)&otp,
+ sizeof(otp));
+
+ spi_release_bus(slave);
+#ifdef DEBUG
+ show_otp_data();
+#endif
+
+ has_been_read = (ret == 0) ? 1 : 0;
+ if (!is_valid_header())
+ goto data_invalid;
+
+ if (crc32(0, (void *)&otp, sizeof(otp) - 4) ==
+ le32_to_cpu(otp.checksum))
+ data_valid = 1;
+
+ if (!is_data_valid())
+ goto data_invalid;
+
+ return 0;
+
+data_invalid:
+ printf("Invalid board ID data!\n");
+ return -1;
+}
+
+int get_revision(int *major, int *minor)
+{
+ if (!is_data_valid())
+ return -1;
+
+ *major = (otp.revision & 0xf0) >> 4;
+ *minor = otp.revision & 0x0f;
+
+ return 0;
+}
+
+const char *get_variant(void)
+{
+ const char* var_str[BOARD_VARIANT_MAX] = {
+ "Unknown",
+ "Engineering Sample",
+ "4GB non ECC"
+ };
+
+ if ((otp.variant < BOARD_VARIANT_ENG_SAMPLE) ||
+ (otp.variant >= BOARD_VARIANT_MAX))
+ return var_str[0];
+
+ return var_str[otp.variant];
+}
+
+void set_board_info(void)
+{
+ char env_str[13];
+
+ if (!is_data_valid())
+ return;
+
+ snprintf(env_str, sizeof(env_str), "%i.%i", (otp.revision & 0xf0) >> 4, otp.revision & 0x0f);
+ env_set("board_rev", env_str);
+
+ sprintf(env_str, "%012llx", *((uint64_t*) otp.serial_num) &
+ 0xFFFFFFFFFFFF);
+
+ env_set("serial#", env_str);
+}
+
+int mac_read_from_otp(void)
+{
+ unsigned int i;
+ int ret;
+
+ if (!is_data_valid())
+ return -1;
+
+ for (i = 0; i < MAX_NUM_PORTS; i++) {
+ char enetvar[9];
+
+ sprintf(enetvar, i ? "eth%daddr" : "ethaddr", i);
+
+ if (!is_valid_ethaddr(otp.mac_addr[i])) {
+ debug("Not valid %s!\n", enetvar);
+ continue;
+ }
+
+ /* Only initialize environment variables that are blank
+ * (i.e. have not yet been set)
+ */
+ if (!env_get(enetvar))
+ eth_env_set_enetaddr(enetvar, otp.mac_addr[i]);
+ }
+
+ return ret;
+}
diff --git a/board/kobol/helios64/sys_otp.h b/board/kobol/helios64/sys_otp.h
new file mode 100644
index 000000000000..61f6f3b3809a
--- /dev/null
+++ b/board/kobol/helios64/sys_otp.h
@@ -0,0 +1,10 @@
+#ifndef __HELIOS64_SYS_OTP_H
+#define __HELIOS64_SYS_OTP_H
+
+int read_otp_data(void);
+void set_board_info(void);
+int get_revision(int *major, int *minor);
+const char *get_variant(void);
+int mac_read_from_otp(void);
+
+#endif
diff --git a/configs/helios64-rk3399_defconfig b/configs/helios64-rk3399_defconfig
new file mode 100644
index 000000000000..6aee24011e45
--- /dev/null
+++ b/configs/helios64-rk3399_defconfig
@@ -0,0 +1,142 @@
+CONFIG_ARM=y
+CONFIG_ARCH_ROCKCHIP=y
+CONFIG_SYS_TEXT_BASE=0x00200000
+CONFIG_SPL_GPIO_SUPPORT=y
+CONFIG_ENV_OFFSET=0x3F8000
+CONFIG_ROCKCHIP_RK3399=y
+CONFIG_TARGET_HELIOS64=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_DEBUG_UART_BASE=0xFF1A0000
+CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_SPL_SPI_FLASH_SUPPORT=y
+CONFIG_SPL_SPI_SUPPORT=y
+CONFIG_DEBUG_UART=y
+CONFIG_AHCI=y
+# CONFIG_ANDROID_BOOT_IMAGE is not set
+CONFIG_OF_BOARD_SETUP=y
+CONFIG_USE_PREBOOT=y
+CONFIG_CONSOLE_MUX=y
+CONFIG_SYS_CONSOLE_ENV_OVERWRITE=y
+CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-kobol-helios64.dtb"
+CONFIG_MISC_INIT_R=y
+CONFIG_VERSION_VARIABLE=y
+# CONFIG_DISPLAY_BOARDINFO is not set
+CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_BOARD_TYPES=y
+CONFIG_BOARD_EARLY_INIT_F=y
+CONFIG_BOARD_EARLY_INIT_R=y
+CONFIG_LAST_STAGE_INIT=y
+# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
+CONFIG_SPL_STACK_R=y
+CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000
+CONFIG_SPL_I2C_SUPPORT=y
+CONFIG_SPL_POWER_SUPPORT=y
+CONFIG_SPL_SPI_LOAD=y
+CONFIG_TPL=y
+CONFIG_CMD_CONFIG=y
+CONFIG_CMD_BOOTZ=y
+# CONFIG_BOOTM_PLAN9 is not set
+# CONFIG_BOOTM_RTEMS is not set
+# CONFIG_BOOTM_VXWORKS is not set
+CONFIG_CMD_BOOTEFI_HELLO=y
+CONFIG_CMD_BOOTMENU=y
+CONFIG_CRC32_VERIFY=y
+CONFIG_CMD_MD5SUM=y
+CONFIG_MD5SUM_VERIFY=y
+CONFIG_CMD_MEMINFO=y
+CONFIG_CMD_MX_CYCLIC=y
+CONFIG_CMD_SHA1SUM=y
+CONFIG_SHA1SUM_VERIFY=y
+CONFIG_CMD_STRINGS=y
+CONFIG_CMD_ADC=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_PCI=y
+CONFIG_CMD_POWEROFF=y
+CONFIG_CMD_READ=y
+CONFIG_CMD_SPI=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_ROCKUSB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+CONFIG_CMD_EFIDEBUG=y
+CONFIG_CMD_EXCEPTION=y
+CONFIG_CMD_TIME=y
+CONFIG_CMD_PMIC=y
+CONFIG_CMD_REGULATOR=y
+CONFIG_CMD_FS_UUID=y
+CONFIG_PARTITION_TYPE_GUID=y
+CONFIG_SPL_OF_CONTROL=y
+CONFIG_OF_LIVE=y
+CONFIG_DEFAULT_DEVICE_TREE="rk3399-kobol-helios64"
+CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
+CONFIG_ENV_IS_IN_MMC=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
+CONFIG_IP_DEFRAG=y
+# CONFIG_DM_DEVICE_REMOVE is not set
+CONFIG_SCSI_AHCI=y
+CONFIG_AHCI_PCI=y
+CONFIG_SPL_FIRMWARE=y
+CONFIG_GPIO_HOG=y
+CONFIG_ROCKCHIP_GPIO=y
+CONFIG_DM_PCA953X=y
+CONFIG_I2C_SET_DEFAULT_BUS_NUM=y
+CONFIG_I2C_DEFAULT_BUS_NUMBER=0x8
+CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_LED=y
+CONFIG_LED_GPIO=y
+CONFIG_MISC=y
+CONFIG_ROCKCHIP_EFUSE=y
+CONFIG_ROCKCHIP_OTP=y
+CONFIG_MMC_DW=y
+CONFIG_MMC_DW_ROCKCHIP=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_ROCKCHIP=y
+CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_PHY_REALTEK=y
+CONFIG_DM_ETH=y
+CONFIG_DM_MDIO=y
+CONFIG_PHY_GIGE=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_RGMII=y
+CONFIG_MII=y
+CONFIG_GMAC_ROCKCHIP=y
+CONFIG_PCI=y
+CONFIG_PHY_ROCKCHIP_INNO_USB2=y
+CONFIG_PHY_ROCKCHIP_TYPEC=y
+CONFIG_DM_PMIC_FAN53555=y
+CONFIG_PMIC_RK8XX=y
+CONFIG_SPL_DM_REGULATOR=y
+CONFIG_REGULATOR_PWM=y
+CONFIG_SPL_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_SPL_DM_REGULATOR_GPIO=y
+CONFIG_REGULATOR_RK8XX=y
+CONFIG_PWM_ROCKCHIP=y
+CONFIG_RAM_RK3399_LPDDR4=y
+CONFIG_DM_RESET=y
+CONFIG_SCSI=y
+CONFIG_DM_SCSI=y
+CONFIG_BAUDRATE=1500000
+CONFIG_DEBUG_UART_SHIFT=2
+CONFIG_ROCKCHIP_SPI=y
+CONFIG_SYSRESET=y
+CONFIG_SYSRESET_SYSCON=y
+CONFIG_DM_THERMAL=y
+CONFIG_USB=y
+# CONFIG_SPL_DM_USB is not set
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_GENERIC=y
+CONFIG_USB_DWC3=y
+CONFIG_USB_DWC3_GENERIC=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_FUNCTION_ROCKUSB=y
+CONFIG_USB_HOST_ETHER=y
+CONFIG_USB_ETHER_RTL8152=y
+CONFIG_SPL_TINY_MEMSET=y
+CONFIG_ERRNO_STR=y
+CONFIG_HEXDUMP=y
diff --git a/include/configs/helios64.h b/include/configs/helios64.h
new file mode 100644
index 000000000000..6fca9a6be0ab
--- /dev/null
+++ b/include/configs/helios64.h
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2020 Aditya Prayoga <aditya(a)kobol.io>
+ */
+
+#ifndef __HELIOS64_H
+#define __HELIOS64_H
+
+#include <configs/rk3399_common.h>
+
+#define SDRAM_BANK_SIZE (2UL << 30)
+
+#if defined(CONFIG_ENV_IS_IN_MMC)
+ #define CONFIG_SYS_MMC_ENV_DEV 0
+#elif defined(CONFIG_ENV_IS_IN_SPI_FLASH)
+ #define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS
+ #define CONFIG_ENV_SPI_CS CONFIG_SF_DEFAULT_CS
+ #define CONFIG_ENV_SPI_MODE CONFIG_SF_DEFAULT_MODE
+ #define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED
+#endif
+
+
+#ifndef CONFIG_SPL_BUILD
+#if CONFIG_IS_ENABLED(SCSI)
+
+ #define CONFIG_SYS_SCSI_MAX_SCSI_ID 5
+ #define CONFIG_SYS_SCSI_MAX_LUN 1
+ #define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \
+ CONFIG_SYS_SCSI_MAX_LUN)
+
+ #define BOOT_TARGET_SCSI(func) \
+ func(SCSI, scsi, 0)
+#else
+ #define BOOT_TARGET_SCSI(func)
+#endif
+
+#undef BOOT_TARGET_DEVICES
+#define BOOT_TARGET_DEVICES(func) \
+ BOOT_TARGET_MMC(func) \
+ BOOT_TARGET_USB(func) \
+ BOOT_TARGET_SCSI(func) \
+ BOOT_TARGET_PXE(func) \
+ BOOT_TARGET_DHCP(func)
+
+#endif
+
+#endif
--
2.30.0
8
11
At present if sandbox crashes it prints a message and tries to exit. But
with the recently introduced signal handler, it often seems to get stuck
in a loop until the stack overflows:
Segmentation violation
Segmentation violation
Segmentation violation
Segmentation violation
Segmentation violation
Segmentation violation
Segmentation violation
...
The signal handler is only useful for a few tests, as I understand it.
Make it optional.
Signed-off-by: Simon Glass <sjg(a)chromium.org>
---
arch/sandbox/cpu/start.c | 18 +++++++++++++++---
arch/sandbox/include/asm/state.h | 1 +
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index e87365e800d..72fe293e8bc 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -389,6 +389,16 @@ static int sandbox_cmdline_cb_select_unittests(struct sandbox_state *state,
}
SANDBOX_CMDLINE_OPT_SHORT(select_unittests, 'k', 1, "Select unit tests to run");
+static int sandbox_cmdline_cb_signals(struct sandbox_state *state,
+ const char *arg)
+{
+ state->handle_signals = true;
+
+ return 0;
+}
+SANDBOX_CMDLINE_OPT_SHORT(signals, 'S', 0,
+ "Handle signals (such as SIGSEGV) in sandbox");
+
static void setup_ram_buf(struct sandbox_state *state)
{
/* Zero the RAM buffer if we didn't read it, to keep valgrind happy */
@@ -472,9 +482,11 @@ int main(int argc, char *argv[])
if (ret)
goto err;
- ret = os_setup_signal_handlers();
- if (ret)
- goto err;
+ if (state->handle_signals) {
+ ret = os_setup_signal_handlers();
+ if (ret)
+ goto err;
+ }
#if CONFIG_VAL(SYS_MALLOC_F_LEN)
gd->malloc_base = CONFIG_MALLOC_F_ADDR;
diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h
index bca13069824..1c4c571e28d 100644
--- a/arch/sandbox/include/asm/state.h
+++ b/arch/sandbox/include/asm/state.h
@@ -93,6 +93,7 @@ struct sandbox_state {
bool ram_buf_read; /* true if we read the RAM buffer */
bool run_unittests; /* Run unit tests */
const char *select_unittests; /* Unit test to run */
+ bool handle_signals; /* Handle signals within sandbox */
/* Pointer to information for each SPI bus/cs */
struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS]
--
2.31.0.rc2.261.g7f71774620-goog
3
14