# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#  http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#

syscfg.defs:
    SPIFLASH:
        description: "SpiFlash enable"
        value:  0
    SPIFLASH_SPI_NUM:
        description: 'SPI interface to use'
        value:  0

    SPIFLASH_SPI_CS_PIN:
        description: 'SPI interface CS pin'
        value:  -1

    SPIFLASH_SPI_MODE:
        description: >
            SPI clock mode. Most devices support HAL_SPI_MODE0 (clock low when idle,
            first edge latches data) and HAL_SPI_MODE3 (clock high when idle,
            second clock edge latches data).
        value: HAL_SPI_MODE3

    SPIFLASH_SECTOR_COUNT:
        description: 'Number of sectors'
        value:  0

    SPIFLASH_SECTOR_SIZE:
        description: 'Number of bytes that can be erased at a time'
        value:  0

    SPIFLASH_PAGE_SIZE:
        description: 'Number of bytes that can be written at a time'
        value:  0

    SPIFLASH_BAUDRATE:
        description: 'Requested baudrate, value must be supported by SPI driver'
        value: 0

    SPIFLASH_CACHE_SIZE:
        description:
            When this value is set to value other then 0, all reads that are
            smaller then this size are rounded up to this value.
            Subsequent reads from cached adress range is much faster.
        value: 0
    SPIFLASH_AUTO_POWER_DOWN:
        description: >
            Enables auto power down feature which allows to power down flash
            automatically when not used. It will be also automatically released
            from power down on any access. The power down timeout is configurable
            in runtime to allow for adjusting behavior of this feature depending
            on power state.
            Note: if enabled without OS_SCHEDULING, only automatic release from
                  power down will be supported (i.e. no automatic power down).
        value: 0

    SPIFLASH_MANUFACTURER:
        description: >
            Expected SpiFlash manufacturer as read by Read JEDEC ID command 9FH.
            In case of multiple chip support this can be left as zero and
            values found in hw/drivers/flash/spiflash/chips/syscfg.yml should be
            set to 1 for desired chips.
        value: 0
    SPIFLASH_IGNORE_MANUFACTURER:
        description: >
            Ignore the SpiFlash manufacturer as read by Read JEDEC ID command 9FH
        value: 0
    SPIFLASH_MEMORY_TYPE:
        description: >
            Expected SpiFlash memory type as read by Read JEDEC ID command 9FH
        value: 0
    SPIFLASH_IGNORE_MEMORY_TYPE:
        description: >
            Ignore SpiFlash memory type as read by Read JEDEC ID command 9FH
        value: 0
    SPIFLASH_MEMORY_CAPACITY:
        description: >
            Expected SpiFlash memory capactity as read by Read JEDEC ID command 9FH
        value: 0
    SPIFLASH_IGNORE_MEMORY_CAPACITY:
        description: >
            Ignore SpiFlash memory capactity as read by Read JEDEC ID command 9FH
        value: 0

    SPIFLASH_READ_STATUS_INTERVAL:
        description: >
            Time between Read Status Register commands when waiting for flash
            to be ready (us)
        value: 10
    SPIFLASH_BLOCK_ERASE_32BK:
        description: Block erase 32KB command, set to 0 if flash does not support this command.
        value: 0x52
    SPIFLASH_BLOCK_ERASE_64BK:
        description: Block erase 64KB command, set to 0 if flash does not support this command.
        value: 0xD8
    SPIFLASH_TBP1_TYPICAL:
        description: 'Byte program time (first byte) (us)'
        value: 15
    SPIFLASH_TBP1_MAXIMUM:
        description: 'Maximum byte program time (first byte)  (us)'
        value: 30
    SPIFLASH_TPP_TYPICAL:
        description: 'Page program time (us)'
        value: 800
    SPIFLASH_TPP_MAXIMUM:
        description: 'Maximum page program time (us)'
        value: 3000
    SPIFLASH_TSE_TYPICAL:
        description: 'Sector erase time (4KB) (us)'
        value: 45000
    SPIFLASH_TSE_MAXIMUM:
        description: 'Maximum sector erase time (us)'
        value: 300000
    SPIFLASH_TBE1_TYPICAL:
        description: 'Block erase time (32KB) (us)'
        value: 120000
    SPIFLASH_TBE1_MAXIMUM:
        description: 'Maximum block erase time (32KB) (us)'
        value:  800000
    SPIFLASH_TBE2_TYPICAL:
        description: 'Block erase time (64KB) (us)'
        value: 150000
    SPIFLASH_TBE2_MAXIMUM:
        description: 'Maximum block erase time (64KB) (us)'
        value: 1000000
    SPIFLASH_TCE_TYPICAL:
        description: 'Chip erase time (us)'
        value: 2000000
    SPIFLASH_TCE_MAXIMUM:
        description: 'Maximum chip erase time (us)'
        value: 6000000
