isp1760-core.h 1.9 KB

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