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