summaryrefslogtreecommitdiff
path: root/board/hatch_fp/flash_fp_mcu
blob: 7b014961bf80747a1a0856169b030512c77c46f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
# Copyright 2019 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

. "$(dirname "$(readlink -f "$0")")"/../share/flash_fp_mcu/flash_fp_mcu_common.sh

# Kabylake PCH GPIOs
readonly KBL_GPIOCHIP="gpiochip200"

if [[ -e "/sys/class/gpio/${KBL_GPIOCHIP}" ]]; then
  # Hatch configuration
  echo "NOTE: For use with updating FP MCU on HATCH boards only"
  readonly SPIDEV="/dev/spidev1.1"
  # GSPI1 ACPI device for FP MCU
  readonly SPIID="spi-PRP0001:01"
  # FPMCU RST_ODL is on GPP_A12 = 200 + 12 = 212
  readonly GPIO_NRST=212
  # FPMCU BOOT0 is on GPP_A22 = 200 + 22 = 222
  readonly GPIO_BOOT0=222
  # No PWREN GPIO on Hatch, FPMCU is always on
  readonly GPIO_PWREN=""
else
  echo "Cannot find a known GPIO chip."
  exit 1
fi

flash_fp_mcu_stm32 \
  "${SPIDEV}"      \
  "${SPIID}"       \
  "${GPIO_NRST}"   \
  "${GPIO_BOOT0}"  \
  "${GPIO_PWREN}"  \
  "${1}"