# Copyright (c) 2012 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.

# SanDisk U100 drives do not work well at SATA3 speeds. Downgrade them to
# SATA2 to fix sporadic suspend / resume problems. These commands fail and do
# nothing for other types of storage devices. The phy speed change is
# persistent and latches on first power cycle.
GET_SSD_PHY_SPEED="mosys storage print phy_speed"
UPDATE_SSD_PHY_SPEED="mosys storage set phy_speed SATA2 -vvv"

updater_custom_main() {
  debug_msg "Customization for ${TARGET_PLATFORM} loaded."
  if [ "$(${GET_SSD_PHY_SPEED})" = "SATA3" ]; then
    ${UPDATE_SSD_PHY_SPEED} || true
  fi
}
