isp1760-core.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // SPDX-License-Identifier: GPL-2.0
  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. #ifndef _ISP1760_CORE_H_
  13. #define _ISP1760_CORE_H_
  14. #include <linux/ioport.h>
  15. #include "isp1760-hcd.h"
  16. #include "isp1760-udc.h"
  17. struct device;
  18. struct gpio_desc;
  19. /*
  20. * Device flags that can vary from board to board. All of these
  21. * indicate the most "atypical" case, so that a devflags of 0 is
  22. * a sane default configuration.
  23. */
  24. #define ISP1760_FLAG_BUS_WIDTH_16 0x00000002 /* 16-bit data bus width */
  25. #define ISP1760_FLAG_OTG_EN 0x00000004 /* Port 1 supports OTG */
  26. #define ISP1760_FLAG_ANALOG_OC 0x00000008 /* Analog overcurrent */
  27. #define ISP1760_FLAG_DACK_POL_HIGH 0x00000010 /* DACK active high */
  28. #define ISP1760_FLAG_DREQ_POL_HIGH 0x00000020 /* DREQ active high */
  29. #define ISP1760_FLAG_ISP1761 0x00000040 /* Chip is ISP1761 */
  30. #define ISP1760_FLAG_INTR_POL_HIGH 0x00000080 /* Interrupt polarity active high */
  31. #define ISP1760_FLAG_INTR_EDGE_TRIG 0x00000100 /* Interrupt edge triggered */
  32. struct isp1760_device {
  33. struct device *dev;
  34. void __iomem *regs;
  35. unsigned int devflags;
  36. struct gpio_desc *rst_gpio;
  37. struct isp1760_hcd hcd;
  38. struct isp1760_udc udc;
  39. };
  40. int isp1760_register(struct resource *mem, int irq, unsigned long irqflags,
  41. struct device *dev, unsigned int devflags);
  42. void isp1760_unregister(struct device *dev);
  43. void isp1760_set_pullup(struct isp1760_device *isp, bool enable);
  44. static inline u32 isp1760_read32(void __iomem *base, u32 reg)
  45. {
  46. return readl(base + reg);
  47. }
  48. static inline void isp1760_write32(void __iomem *base, u32 reg, u32 val)
  49. {
  50. writel(val, base + reg);
  51. }
  52. #endif