![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 0002 * 0003 * Copyright (C) 2019 Texas Instruments Incorporated - https://www.ti.com/ 0004 */ 0005 0006 #ifndef __LINUX_MTD_HYPERBUS_H__ 0007 #define __LINUX_MTD_HYPERBUS_H__ 0008 0009 #include <linux/mtd/map.h> 0010 0011 /* HyperBus command bits */ 0012 #define HYPERBUS_RW 0x80 /* R/W# */ 0013 #define HYPERBUS_RW_WRITE 0 0014 #define HYPERBUS_RW_READ 0x80 0015 #define HYPERBUS_AS 0x40 /* Address Space */ 0016 #define HYPERBUS_AS_MEM 0 0017 #define HYPERBUS_AS_REG 0x40 0018 #define HYPERBUS_BT 0x20 /* Burst Type */ 0019 #define HYPERBUS_BT_WRAPPED 0 0020 #define HYPERBUS_BT_LINEAR 0x20 0021 0022 enum hyperbus_memtype { 0023 HYPERFLASH, 0024 HYPERRAM, 0025 }; 0026 0027 /** 0028 * struct hyperbus_device - struct representing HyperBus slave device 0029 * @map: map_info struct for accessing MMIO HyperBus flash memory 0030 * @np: pointer to HyperBus slave device node 0031 * @mtd: pointer to MTD struct 0032 * @ctlr: pointer to HyperBus controller struct 0033 * @memtype: type of memory device: HyperFlash or HyperRAM 0034 * @priv: pointer to controller specific per device private data 0035 */ 0036 0037 struct hyperbus_device { 0038 struct map_info map; 0039 struct device_node *np; 0040 struct mtd_info *mtd; 0041 struct hyperbus_ctlr *ctlr; 0042 enum hyperbus_memtype memtype; 0043 void *priv; 0044 }; 0045 0046 /** 0047 * struct hyperbus_ops - struct representing custom HyperBus operations 0048 * @read16: read 16 bit of data from flash in a single burst. Used to read 0049 * from non default address space, such as ID/CFI space 0050 * @write16: write 16 bit of data to flash in a single burst. Used to 0051 * send cmd to flash or write single 16 bit word at a time. 0052 * @copy_from: copy data from flash memory 0053 * @copy_to: copy data to flash memory 0054 * @calibrate: calibrate HyperBus controller 0055 */ 0056 0057 struct hyperbus_ops { 0058 u16 (*read16)(struct hyperbus_device *hbdev, unsigned long addr); 0059 void (*write16)(struct hyperbus_device *hbdev, 0060 unsigned long addr, u16 val); 0061 void (*copy_from)(struct hyperbus_device *hbdev, void *to, 0062 unsigned long from, ssize_t len); 0063 void (*copy_to)(struct hyperbus_device *dev, unsigned long to, 0064 const void *from, ssize_t len); 0065 int (*calibrate)(struct hyperbus_device *dev); 0066 }; 0067 0068 /** 0069 * struct hyperbus_ctlr - struct representing HyperBus controller 0070 * @dev: pointer to HyperBus controller device 0071 * @calibrated: flag to indicate ctlr calibration sequence is complete 0072 * @ops: HyperBus controller ops 0073 */ 0074 struct hyperbus_ctlr { 0075 struct device *dev; 0076 bool calibrated; 0077 0078 const struct hyperbus_ops *ops; 0079 }; 0080 0081 /** 0082 * hyperbus_register_device - probe and register a HyperBus slave memory device 0083 * @hbdev: hyperbus_device struct with dev, np and ctlr field populated 0084 * 0085 * Return: 0 for success, others for failure. 0086 */ 0087 int hyperbus_register_device(struct hyperbus_device *hbdev); 0088 0089 /** 0090 * hyperbus_unregister_device - deregister HyperBus slave memory device 0091 * @hbdev: hyperbus_device to be unregistered 0092 */ 0093 void hyperbus_unregister_device(struct hyperbus_device *hbdev); 0094 0095 #endif /* __LINUX_MTD_HYPERBUS_H__ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |