Commit | Line | Data |
---|---|---|
5fd54ace | 1 | // SPDX-License-Identifier: GPL-2.0 |
4b1a577d LP |
2 | /* |
3 | * Driver for the NXP ISP1760 chip | |
4 | * | |
5 | * Copyright 2014 Laurent Pinchart | |
6 | * Copyright 2007 Sebastian Siewior | |
7 | * | |
8 | * Contacts: | |
9 | * Sebastian Siewior <bigeasy@linutronix.de> | |
10 | * Laurent Pinchart <laurent.pinchart@ideasonboard.com> | |
11 | * | |
12 | * This program is free software; you can redistribute it and/or | |
13 | * modify it under the terms of the GNU General Public License | |
14 | * version 2 as published by the Free Software Foundation. | |
15 | */ | |
16 | ||
17 | #ifndef _ISP1760_CORE_H_ | |
18 | #define _ISP1760_CORE_H_ | |
19 | ||
20 | #include <linux/ioport.h> | |
21 | ||
22 | #include "isp1760-hcd.h" | |
0316ca63 | 23 | #include "isp1760-udc.h" |
4b1a577d | 24 | |
5171446a LP |
25 | struct device; |
26 | struct gpio_desc; | |
27 | ||
28 | /* | |
29 | * Device flags that can vary from board to board. All of these | |
30 | * indicate the most "atypical" case, so that a devflags of 0 is | |
31 | * a sane default configuration. | |
32 | */ | |
33 | #define ISP1760_FLAG_BUS_WIDTH_16 0x00000002 /* 16-bit data bus width */ | |
34 | #define ISP1760_FLAG_OTG_EN 0x00000004 /* Port 1 supports OTG */ | |
35 | #define ISP1760_FLAG_ANALOG_OC 0x00000008 /* Analog overcurrent */ | |
36 | #define ISP1760_FLAG_DACK_POL_HIGH 0x00000010 /* DACK active high */ | |
37 | #define ISP1760_FLAG_DREQ_POL_HIGH 0x00000020 /* DREQ active high */ | |
38 | #define ISP1760_FLAG_ISP1761 0x00000040 /* Chip is ISP1761 */ | |
39 | #define ISP1760_FLAG_INTR_POL_HIGH 0x00000080 /* Interrupt polarity active high */ | |
40 | #define ISP1760_FLAG_INTR_EDGE_TRIG 0x00000100 /* Interrupt edge triggered */ | |
41 | ||
4b1a577d | 42 | struct isp1760_device { |
5171446a LP |
43 | struct device *dev; |
44 | ||
4b1a577d | 45 | void __iomem *regs; |
5171446a LP |
46 | unsigned int devflags; |
47 | struct gpio_desc *rst_gpio; | |
4b1a577d LP |
48 | |
49 | struct isp1760_hcd hcd; | |
0316ca63 | 50 | struct isp1760_udc udc; |
4b1a577d LP |
51 | }; |
52 | ||
53 | int isp1760_register(struct resource *mem, int irq, unsigned long irqflags, | |
54 | struct device *dev, unsigned int devflags); | |
55 | void isp1760_unregister(struct device *dev); | |
56 | ||
0316ca63 LP |
57 | void isp1760_set_pullup(struct isp1760_device *isp, bool enable); |
58 | ||
5171446a LP |
59 | static inline u32 isp1760_read32(void __iomem *base, u32 reg) |
60 | { | |
61 | return readl(base + reg); | |
62 | } | |
63 | ||
64 | static inline void isp1760_write32(void __iomem *base, u32 reg, u32 val) | |
65 | { | |
66 | writel(val, base + reg); | |
67 | } | |
68 | ||
4b1a577d | 69 | #endif |