# Copyright (c) 2020 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

description: Atmel AT45 (or compatible) SPI flash

compatible: "atmel,at45"

include: [spi-device.yaml]

properties:
  jedec-id:
    type: uint8-array
    required: true
    description: JEDEC ID as manufacturer ID (1 byte) and device ID (2 bytes).

  size:
    type: int
    required: true
    description: Flash capacity in bits.

  sector-size:
    type: int
    required: true
    description: Flash sector size in bytes.

  sector-0a-pages:
    type: int
    default: 8
    description: |
      Most available AT45 flash chips have their first two sectors shorter
      than the consecutive ones. Usually, the first sector is marked as 0a
      and has its size equal to eight pages (one block) and the second one
      (usually 0b) is the complement to the size of a regular sector.
      This property allows specifying the size (in pages) of that first sector
      and defaults to the commonly used value of eight pages.
      Value of zero means that the flash chip has all sectors of equal size.

  block-size:
    type: int
    required: true
    description: Flash block size in bytes.

  page-size:
    type: int
    required: true
    description: Flash page size in bytes.

  no-chip-erase:
    type: boolean
    description: |
      If set, indicates that the chip does not support the chip erase command.

  no-sector-erase:
    type: boolean
    description: |
      If set, indicates that the chip does not support the sector erase command.

  use-udpd:
    type: boolean
    description: |
      When set, the driver will use the Ultra-Deep Power-Down command instead
      of the default Deep Power-Down one to put the chip into low power mode.

      From the driver perspective, as it does not rely on the contents of the
      SRAM buffers in the chip, the difference between the Deep and Ultra-Deep
      Power-Down modes is that the chip consumes far less power in the latter
      but needs some more time to enter this mode and to exit from it.

  enter-dpd-delay:
    type: int
    default: 0
    description: |
      Time, in nanoseconds, needed by the chip to enter the Deep Power-Down
      mode (or Ultra-Deep Power-Down mode when the "use-udpd" property is set)
      after the corresponding command is issued.

  exit-dpd-delay:
    type: int
    default: 0
    description: |
      Time, in nanoseconds, needed by the chip to exit from the Deep Power-Down
      mode (or Ultra-Deep Power-Down mode when the "use-udpd" property is set)
      after the corresponding command is issued.

  reset-gpios:
    type: phandle-array
    description: |
      The RESET pin of AT45 is active low.
      If connected directly the MCU pin should be configured
      as active low.

  wp-gpios:
    type: phandle-array
    description: |
      The WP pin of AT45 is active low.
      If connected directly the MCU pin should be configured
      as active low.
