Files
OpenCellular/chip/mchp/spi_chip.h
Scott Worley 0a6a7be572 ec_chip_mchp: Add SPI files
Add Microchip MEC17xx family SPI master
controllers and flash files. SPI implements
public interface wrapper for QMSPI and GPSPI.
MEC17xx family uses QMSPI for loading
EC firmware. GPSPI is for general use (sensor).

BRANCH=none
BUG=
TEST=Review only.

Change-Id: I23001e254dd437caa0917949f4dd2eb903f1adb1
Signed-off-by: Scott Worley <scott.worley@microchip.corp-partner.google.com>
2017-12-28 14:50:30 -08:00

61 lines
1.2 KiB
C

/* Copyright 2017 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.
*
* Register map for MCHP MEC processor
*/
/** @file qmpis_chip.h
*MCHP MEC Quad SPI Master
*/
/** @defgroup MCHP MEC qmspi
*/
#ifndef _SPI_CHIP_H
#define _SPI_CHIP_H
#include <stdint.h>
#include <stddef.h>
/* struct spi_device_t */
#include "spi.h"
#define SPI_DMA_OPTION_RD 0
#define SPI_DMA_OPTION_WR 1
/*
* bits[3:0] = controller instance
* bits[7:4] = controller family
* 0 = QMSPI, 1 = GPSPI
*/
#define QMSPI0_PORT 0x00
#define GPSPI0_PORT 0x10
#define GPSPI1_PORT 0x11
#define QMSPI_CLASS0 0
#define GPSPI_CLASS0 1
#define QMSPI_CLASS (0 << 4)
#define GPSPI_CLASS (1 << 4)
#define QMSPI_CTRL0 0
#define GPSPI_CTRL0 0
#define GPSPI_CTRL1 1
/*
* Encode zero based controller class and instance values
* in port value of spi_device_t.
*/
#define SPI_CTRL_ID(c, i) (((c & 0xf) << 4) + (i & 0xf))
/*
* helper to return pointer to QMSPI or GPSPI struct dma_option
*/
const void *spi_dma_option(const struct spi_device_t *spi_device,
int is_tx);
#endif /* #ifndef _QMSPI_CHIP_H */
/** @}
*/