Skip to contentSkip to conversation

at91: Add support for Snapper 9260/9G20 modules

PATCH New Ryan Mallon 1 participant 5 messages Jun 16, 2010 – Jun 17, 2010

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover at91: Add support for Snapper 9260/9G20 modules

Add support for Bluewater Systems Snapper 9260/9G20 modules.

In order to fully support the modules, NR_BUILTIN_GPIO must be defined for at91 and vbus polarity and polling have been added to the at91 udc driver.

Ryan Mallon (3):
AT91: Define NR_BUILTIN_GPIO
at91_udc: Add vbus polarity and polling mode
at91: Add support for Bluewater Systems Snapper 9260/9G20 modules

 arch/arm/mach-at91/Kconfig              |   11 ++
 arch/arm/mach-at91/Makefile             |    3 +
 arch/arm/mach-at91/board-snapper9260.c  |  189 +++++++++++++++++++++++++++++++
 arch/arm/mach-at91/include/mach/board.h |    2 +
 arch/arm/mach-at91/include/mach/gpio.h  |    1 +
 drivers/usb/gadget/at91_udc.c           |   45 ++++++--
 drivers/usb/gadget/at91_udc.h           |    1 +
 7 files changed, 242 insertions(+), 10 deletions(-)
 create mode 100644 arch/arm/mach-at91/board-snapper9260.c
#1 lore raw

PATCH 1/3 AT91: Define NR_BUILTIN_GPIO

Add definition for NR_BUILTIN_GPIO for AT91 family

---
 arch/arm/mach-at91/include/mach/gpio.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/mach-at91/include/mach/gpio.h +1 -0
index 04c91e3..bfdd8ab 100644
@@ -19,6 +19,7 @@
 #define PIN_BASE		NR_AIC_IRQS
 
 #define MAX_GPIO_BANKS		5
+#define NR_BUILTIN_GPIO		(PIN_BASE + (MAX_GPIO_BANKS * 32))
 
 /* these pin numbers double as IRQ numbers, like AT91xxx_ID_* values */
 
Signature · 1 line
1.5.5.1
#2 lore raw

PATCH 2/3 at91_udc: Add vbus polarity and polling mode

In reply to Ryan Mallon

Allow the vbus signal to optionally use polling. This is required if the vbus signal is connected to an non-interrupting io expander for example. Also add an option to have vbus be an active low signal. Both options are set in the platform data for the device.

---
 arch/arm/mach-at91/include/mach/board.h |    2 +
 drivers/usb/gadget/at91_udc.c           |   45 ++++++++++++++++++++++++-------
 drivers/usb/gadget/at91_udc.h           |    1 +
 3 files changed, 38 insertions(+), 10 deletions(-)
arch/arm/mach-at91/include/mach/board.h +2 -0
index df2ed84..58528aa 100644
@@ -44,6 +44,8 @@
  /* USB Device */
 struct at91_udc_data {
 	u8	vbus_pin;		/* high == host powering us */
+	u8	vbus_active_low;	/* vbus polarity */
+	u8	vbus_polled;		/* Use polling, not interrupt */
 	u8	pullup_pin;		/* active == D+ pulled up */
 	u8	pullup_active_low;	/* true == pullup_pin is active low */
 };
drivers/usb/gadget/at91_udc.c +35 -10

73 lines not on this page · raw message

drivers/usb/gadget/at91_udc.h +1 -0
index c65d622..2ebd665 100644
@@ -144,6 +144,7 @@ struct at91_udc {
 	struct proc_dir_entry		*pde;
 	void __iomem			*udp_baseaddr;
 	int				udp_irq;
+	struct timer_list		vbus_timer;
 };
 
 static inline struct at91_udc *to_udc(struct usb_gadget *g)
Signature · 1 line
1.5.5.1
#4 lore raw

PATCH 3/3 at91: Add support for Bluewater Systems Snapper 9260/9G20 modules

In reply to Ryan Mallon

Add support for Bluewater Systems Snapper 9260/9G20 modules

---
 arch/arm/mach-at91/Kconfig             |   11 ++
 arch/arm/mach-at91/Makefile            |    3 +
 arch/arm/mach-at91/board-snapper9260.c |  189 ++++++++++++++++++++++++++++++++
 3 files changed, 203 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-at91/board-snapper9260.c
arch/arm/mach-at91/Kconfig +11 -0
index 841eaf8..939bccd 100644
@@ -366,6 +366,17 @@ config MACH_STAMP9G20
 
 endif
 
+if (ARCH_AT91SAM9260 || ARCH_AT91SAM9G20)
+comment "AT91SAM9260/AT91SAM9G20 boards"
+
+config MACH_SNAPPER_9260
+        bool "Bluewater Systems Snapper 9260/9G20 module"
+        help
+          Select this if you are using the Bluewater Systems Snapper 9260 or
+          Snapper 9G20 modules.
+          <http://www.bluewatersys.com/>
+endif
+
 # ----------------------------------------------------------
 
 if ARCH_AT91SAM9G45
arch/arm/mach-at91/Makefile +3 -0
index c1f821e..ca2ac00 100644
@@ -66,6 +66,9 @@ obj-$(CONFIG_MACH_CPU9G20)	+= board-cpu9krea.o
 obj-$(CONFIG_MACH_STAMP9G20)	+= board-stamp9g20.o
 obj-$(CONFIG_MACH_PORTUXG20)	+= board-stamp9g20.o
 
+# AT91SAM9260/AT91SAM9G20 board-specific support
+obj-$(CONFIG_MACH_SNAPPER_9260)	+= board-snapper9260.o
+
 # AT91SAM9G45 board-specific support
 obj-$(CONFIG_MACH_AT91SAM9G45EKES) += board-sam9m10g45ek.o
 
arch/arm/mach-at91/board-snapper9260.c new file +189 -0

189 lines not on this page · raw message

Signature · 1 line
1.5.5.1
#3 lore raw

PATCH 2/3 at91_udc: Add vbus polarity and polling mode

In reply to Ryan Mallon

I realised this patch was not quite correct. If vbus is on an io expander then the gpio can potentially sleep, so use the gpiolib cansleep variants when in polling mode. Also, do not try and enable/disable wakeups on vbus if it is polled.

---
at91_udc: Add vbus polarity and polling mode

Allow the vbus signal to optionally use polling. This is required if the vbus signal is connected to an non-interrupting io expander for example. If vbus is in polling mode, then it is assumed that the vbus gpio may sleep. Also add an option to have vbus be an active low signal. Both options are set in the platform data for the device.

---

arch/arm/mach-at91/include/mach/board.h +2 -0
index df2ed84..58528aa 100644
@@ -44,6 +44,8 @@
  /* USB Device */
 struct at91_udc_data {
 	u8	vbus_pin;		/* high == host powering us */
+	u8	vbus_active_low;	/* vbus polarity */
+	u8	vbus_polled;		/* Use polling, not interrupt */
 	u8	pullup_pin;		/* active == D+ pulled up */
 	u8	pullup_active_low;	/* true == pullup_pin is active low */
 };
drivers/usb/gadget/at91_udc.c +53 -13

106 lines not on this page · raw message

drivers/usb/gadget/at91_udc.h +2 -0
index c65d622..a1f4f54 100644
@@ -144,6 +144,8 @@ struct at91_udc {
 	struct proc_dir_entry		*pde;
 	void __iomem			*udp_baseaddr;
 	int				udp_irq;
+	struct timer_list		vbus_timer;
+	struct work_struct		vbus_timer_work;
 };
 
 static inline struct at91_udc *to_udc(struct usb_gadget *g)