0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef _ISP1760_CORE_H_
0016 #define _ISP1760_CORE_H_
0017
0018 #include <linux/ioport.h>
0019 #include <linux/regmap.h>
0020
0021 #include "isp1760-hcd.h"
0022 #include "isp1760-udc.h"
0023
0024 struct device;
0025 struct gpio_desc;
0026
0027
0028
0029
0030
0031
0032 #define ISP1760_FLAG_BUS_WIDTH_16 0x00000002
0033 #define ISP1760_FLAG_PERIPHERAL_EN 0x00000004
0034 #define ISP1760_FLAG_ANALOG_OC 0x00000008
0035 #define ISP1760_FLAG_DACK_POL_HIGH 0x00000010
0036 #define ISP1760_FLAG_DREQ_POL_HIGH 0x00000020
0037 #define ISP1760_FLAG_ISP1761 0x00000040
0038 #define ISP1760_FLAG_INTR_POL_HIGH 0x00000080
0039 #define ISP1760_FLAG_INTR_EDGE_TRIG 0x00000100
0040 #define ISP1760_FLAG_ISP1763 0x00000200
0041 #define ISP1760_FLAG_BUS_WIDTH_8 0x00000400
0042
0043 struct isp1760_device {
0044 struct device *dev;
0045
0046 unsigned int devflags;
0047 struct gpio_desc *rst_gpio;
0048
0049 struct isp1760_hcd hcd;
0050 struct isp1760_udc udc;
0051 };
0052
0053 int isp1760_register(struct resource *mem, int irq, unsigned long irqflags,
0054 struct device *dev, unsigned int devflags);
0055 void isp1760_unregister(struct device *dev);
0056
0057 void isp1760_set_pullup(struct isp1760_device *isp, bool enable);
0058
0059 static inline u32 isp1760_field_read(struct regmap_field **fields, u32 field)
0060 {
0061 unsigned int val;
0062
0063 regmap_field_read(fields[field], &val);
0064
0065 return val;
0066 }
0067
0068 static inline void isp1760_field_write(struct regmap_field **fields, u32 field,
0069 u32 val)
0070 {
0071 regmap_field_write(fields[field], val);
0072 }
0073
0074 static inline void isp1760_field_set(struct regmap_field **fields, u32 field)
0075 {
0076 isp1760_field_write(fields, field, 0xFFFFFFFF);
0077 }
0078
0079 static inline void isp1760_field_clear(struct regmap_field **fields, u32 field)
0080 {
0081 isp1760_field_write(fields, field, 0);
0082 }
0083
0084 static inline u32 isp1760_reg_read(struct regmap *regs, u32 reg)
0085 {
0086 unsigned int val;
0087
0088 regmap_read(regs, reg, &val);
0089
0090 return val;
0091 }
0092
0093 static inline void isp1760_reg_write(struct regmap *regs, u32 reg, u32 val)
0094 {
0095 regmap_write(regs, reg, val);
0096 }
0097 #endif