~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/mtd/hyperbus.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0
  2  *
  3  * Copyright (C) 2019 Texas Instruments Incorporated - https://www.ti.com/
  4  */
  5 
  6 #ifndef __LINUX_MTD_HYPERBUS_H__
  7 #define __LINUX_MTD_HYPERBUS_H__
  8 
  9 #include <linux/mtd/map.h>
 10 
 11 /* HyperBus command bits */
 12 #define HYPERBUS_RW     0x80    /* R/W# */
 13 #define HYPERBUS_RW_WRITE 0
 14 #define HYPERBUS_RW_READ 0x80
 15 #define HYPERBUS_AS     0x40    /* Address Space */
 16 #define HYPERBUS_AS_MEM 0
 17 #define HYPERBUS_AS_REG 0x40
 18 #define HYPERBUS_BT     0x20    /* Burst Type */
 19 #define HYPERBUS_BT_WRAPPED 0
 20 #define HYPERBUS_BT_LINEAR 0x20
 21 
 22 enum hyperbus_memtype {
 23         HYPERFLASH,
 24         HYPERRAM,
 25 };
 26 
 27 /**
 28  * struct hyperbus_device - struct representing HyperBus slave device
 29  * @map: map_info struct for accessing MMIO HyperBus flash memory
 30  * @np: pointer to HyperBus slave device node
 31  * @mtd: pointer to MTD struct
 32  * @ctlr: pointer to HyperBus controller struct
 33  * @memtype: type of memory device: HyperFlash or HyperRAM
 34  * @priv: pointer to controller specific per device private data
 35  */
 36 
 37 struct hyperbus_device {
 38         struct map_info map;
 39         struct device_node *np;
 40         struct mtd_info *mtd;
 41         struct hyperbus_ctlr *ctlr;
 42         enum hyperbus_memtype memtype;
 43         void *priv;
 44 };
 45 
 46 /**
 47  * struct hyperbus_ops - struct representing custom HyperBus operations
 48  * @read16: read 16 bit of data from flash in a single burst. Used to read
 49  *          from non default address space, such as ID/CFI space
 50  * @write16: write 16 bit of data to flash in a single burst. Used to
 51  *           send cmd to flash or write single 16 bit word at a time.
 52  * @copy_from: copy data from flash memory
 53  * @copy_to: copy data to flash memory
 54  * @calibrate: calibrate HyperBus controller
 55  */
 56 
 57 struct hyperbus_ops {
 58         u16 (*read16)(struct hyperbus_device *hbdev, unsigned long addr);
 59         void (*write16)(struct hyperbus_device *hbdev,
 60                         unsigned long addr, u16 val);
 61         void (*copy_from)(struct hyperbus_device *hbdev, void *to,
 62                           unsigned long from, ssize_t len);
 63         void (*copy_to)(struct hyperbus_device *dev, unsigned long to,
 64                         const void *from, ssize_t len);
 65         int (*calibrate)(struct hyperbus_device *dev);
 66 };
 67 
 68 /**
 69  * struct hyperbus_ctlr - struct representing HyperBus controller
 70  * @dev: pointer to HyperBus controller device
 71  * @calibrated: flag to indicate ctlr calibration sequence is complete
 72  * @ops: HyperBus controller ops
 73  */
 74 struct hyperbus_ctlr {
 75         struct device *dev;
 76         bool calibrated;
 77 
 78         const struct hyperbus_ops *ops;
 79 };
 80 
 81 /**
 82  * hyperbus_register_device - probe and register a HyperBus slave memory device
 83  * @hbdev: hyperbus_device struct with dev, np and ctlr field populated
 84  *
 85  * Return: 0 for success, others for failure.
 86  */
 87 int hyperbus_register_device(struct hyperbus_device *hbdev);
 88 
 89 /**
 90  * hyperbus_unregister_device - deregister HyperBus slave memory device
 91  * @hbdev: hyperbus_device to be unregistered
 92  */
 93 void hyperbus_unregister_device(struct hyperbus_device *hbdev);
 94 
 95 #endif /* __LINUX_MTD_HYPERBUS_H__ */
 96 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php