Skip to contentSkip to conversation

MIPS: initial support for the Atheros AR71XX/AR724X/AR913X SoCs

PATCH Applied Gabor Juhos 2 participants 30 messages Jan 4, 2011 – Jan 17, 2011

Subsystems (6)
USB MIPS SPI Watchdog device drivers +2 more subsystems
lore
Share & tools
lore
#0 lore raw

v5 cover MIPS: initial support for the Atheros AR71XX/AR724X/AR913X SoCs

This patch set contains initial support for the
Atheros AR71XX/AR724X/AR913X SoCs.

Generic changes since v1:
- rebased against 2.6.37-rc7
- the 'MIPS: Add generic support for multiple machines within a single kernel' patch has been removed, because that is in the mips-queue tree already
- the 'input: add input driver for polled GPIO buttons' patch has been removed, because a slightly different version of that driver is present in 2.6.37-rc7 already as 'gpio_keys_polled'

Generic changes since v2:
- don't use __init for function declarations

Generic changes since v3:
- rebased against 2.6.37-rc8

Generic changes since v4:
- implement clock API

Gabor Juhos (16):
MIPS: add initial support for the Atheros AR71XX/AR724X/AR931X SoCs
MIPS: ath79: add GPIOLIB support
MIPS: ath79: utilize the MIPS multi-machine support
MIPS: ath79: add initial support for the Atheros PB44 reference board
MIPS: ath79: add common GPIO LEDs device
watchdog: add driver for the Atheros AR71XX/AR724X/AR913X SoCs
MIPS: ath79: add common watchdog device
MIPS: ath79: add common GPIO buttons device
spi: add SPI controller driver for the Atheros AR71XX/AR724X/AR913X
SoCs
MIPS: ath79: add common SPI controller device
USB: ehci: add workaround for Synopsys HC bug
USB: ehci: add bus glue for the Atheros AR71XX/AR724X/AR913X SoCs
USB: ohci: add bus glue for the Atheros AR71XX/AR7240 SoCs
MIPS: ath79: add common USB Host Controller device
MIPS: ath79: add initial support for the Atheros AP81 reference board
MIPS: ath79: add common WMAC device for AR913X based boards

 arch/mips/Kbuild.platforms                         |    1 +
 arch/mips/Kconfig                                  |   17 ++
 arch/mips/ath79/Kconfig                            |   60 ++++
 arch/mips/ath79/Makefile                           |   29 ++
 arch/mips/ath79/Platform                           |    7 +
 arch/mips/ath79/clock.c                            |  183 ++++++++++++
 arch/mips/ath79/common.c                           |   97 +++++++
 arch/mips/ath79/common.h                           |   31 ++
 arch/mips/ath79/dev-ar913x-wmac.c                  |   60 ++++
 arch/mips/ath79/dev-ar913x-wmac.h                  |   17 ++
 arch/mips/ath79/dev-common.c                       |   77 +++++
 arch/mips/ath79/dev-common.h                       |   18 ++
 arch/mips/ath79/dev-gpio-buttons.c                 |   58 ++++
 arch/mips/ath79/dev-gpio-buttons.h                 |   23 ++
 arch/mips/ath79/dev-leds-gpio.c                    |   56 ++++
 arch/mips/ath79/dev-leds-gpio.h                    |   21 ++
 arch/mips/ath79/dev-spi.c                          |   38 +++
 arch/mips/ath79/dev-spi.h                          |   22 ++
 arch/mips/ath79/dev-usb.c                          |  194 +++++++++++++
 arch/mips/ath79/dev-usb.h                          |   17 ++
 arch/mips/ath79/early_printk.c                     |   36 +++
 arch/mips/ath79/gpio.c                             |  197 +++++++++++++
 arch/mips/ath79/irq.c                              |  187 ++++++++++++
 arch/mips/ath79/mach-ap81.c                        |  100 +++++++
 arch/mips/ath79/mach-pb44.c                        |  120 ++++++++
 arch/mips/ath79/machtypes.h                        |   23 ++
 arch/mips/ath79/prom.c                             |   57 ++++
 arch/mips/ath79/setup.c                            |  206 +++++++++++++
 arch/mips/include/asm/mach-ath79/ar71xx_regs.h     |  253 ++++++++++++++++
 arch/mips/include/asm/mach-ath79/ath79.h           |   96 ++++++
 .../include/asm/mach-ath79/ath79_ehci_platform.h   |   18 ++
 .../include/asm/mach-ath79/ath79_spi_platform.h    |   23 ++
 .../include/asm/mach-ath79/cpu-feature-overrides.h |   56 ++++
 arch/mips/include/asm/mach-ath79/gpio.h            |   26 ++
 arch/mips/include/asm/mach-ath79/irq.h             |   36 +++
 .../include/asm/mach-ath79/kernel-entry-init.h     |   32 ++
 arch/mips/include/asm/mach-ath79/war.h             |   25 ++
 drivers/spi/Kconfig                                |    8 +
 drivers/spi/Makefile                               |    1 +
 drivers/spi/ath79_spi.c                            |  292 +++++++++++++++++++
 drivers/usb/host/Kconfig                           |   16 +
 drivers/usb/host/ehci-ath79.c                      |  176 +++++++++++
 drivers/usb/host/ehci-hcd.c                        |    5 +
 drivers/usb/host/ehci-q.c                          |    3 +
 drivers/usb/host/ehci.h                            |    1 +
 drivers/usb/host/ohci-ath79.c                      |  162 +++++++++++
 drivers/usb/host/ohci-hcd.c                        |    5 +
 drivers/watchdog/Kconfig                           |    7 +
 drivers/watchdog/Makefile                          |    1 +
 drivers/watchdog/ath79_wdt.c                       |  305 ++++++++++++++++++++
 50 files changed, 3499 insertions(+), 0 deletions(-)
 create mode 100644 arch/mips/ath79/Kconfig
 create mode 100644 arch/mips/ath79/Makefile
 create mode 100644 arch/mips/ath79/Platform
 create mode 100644 arch/mips/ath79/clock.c
 create mode 100644 arch/mips/ath79/common.c
 create mode 100644 arch/mips/ath79/common.h
 create mode 100644 arch/mips/ath79/dev-ar913x-wmac.c
 create mode 100644 arch/mips/ath79/dev-ar913x-wmac.h
 create mode 100644 arch/mips/ath79/dev-common.c
 create mode 100644 arch/mips/ath79/dev-common.h
 create mode 100644 arch/mips/ath79/dev-gpio-buttons.c
 create mode 100644 arch/mips/ath79/dev-gpio-buttons.h
 create mode 100644 arch/mips/ath79/dev-leds-gpio.c
 create mode 100644 arch/mips/ath79/dev-leds-gpio.h
 create mode 100644 arch/mips/ath79/dev-spi.c
 create mode 100644 arch/mips/ath79/dev-spi.h
 create mode 100644 arch/mips/ath79/dev-usb.c
 create mode 100644 arch/mips/ath79/dev-usb.h
 create mode 100644 arch/mips/ath79/early_printk.c
 create mode 100644 arch/mips/ath79/gpio.c
 create mode 100644 arch/mips/ath79/irq.c
 create mode 100644 arch/mips/ath79/mach-ap81.c
 create mode 100644 arch/mips/ath79/mach-pb44.c
 create mode 100644 arch/mips/ath79/machtypes.h
 create mode 100644 arch/mips/ath79/prom.c
 create mode 100644 arch/mips/ath79/setup.c
 create mode 100644 arch/mips/include/asm/mach-ath79/ar71xx_regs.h
 create mode 100644 arch/mips/include/asm/mach-ath79/ath79.h
 create mode 100644 arch/mips/include/asm/mach-ath79/ath79_ehci_platform.h
 create mode 100644 arch/mips/include/asm/mach-ath79/ath79_spi_platform.h
 create mode 100644 arch/mips/include/asm/mach-ath79/cpu-feature-overrides.h
 create mode 100644 arch/mips/include/asm/mach-ath79/gpio.h
 create mode 100644 arch/mips/include/asm/mach-ath79/irq.h
 create mode 100644 arch/mips/include/asm/mach-ath79/kernel-entry-init.h
 create mode 100644 arch/mips/include/asm/mach-ath79/war.h
 create mode 100644 drivers/spi/ath79_spi.c
 create mode 100644 drivers/usb/host/ehci-ath79.c
 create mode 100644 drivers/usb/host/ohci-ath79.c
 create mode 100644 drivers/watchdog/ath79_wdt.c
Signature · 1 line
1.7.2.1
#1 lore raw

PATCH v5 1/16 MIPS: add initial support for the Atheros AR71XX/AR724X/AR931X SoCs

This patch adds initial support for various Atheros SoCs based on the MIPS 24Kc core. The following models are supported at the moment:

- AR7130
- AR7141
- AR7161
- AR9130
- AR9132
- AR7240
- AR7241
- AR7242

The current patch contains minimal support only, but the resulting kernel can boot into user-space with using of an initramfs image on various boards which are using these SoCs. Support for more built-in devices and individual boards will be implemented in further patches.

---
Changes since RFC:
- the ATH79_DEV_UART Kconfig option is removed, and the URT platform code has been moved into dev-common[ch]

Changes since v1:
- ath79_device_{start,stop} has been renamed to ath79_device_reset_{set,clear} to to reflect the purpose of these functions better
- some definitions has been moved from 'arch/mips/ath79/common.h' to 'arch/mips/include/asm/mach-ath79/ath79.h' to make them available for future drivers
- rebased against 2.6.37-rc7

Changes since v2:
- don't use __init for function declarations

Changes since v3:
- rebase against 2.6.37-rc8

Changes since v4:
- implement clock API

 arch/mips/Kbuild.platforms                         |    1 +
 arch/mips/Kconfig                                  |   15 ++
 arch/mips/ath79/Kconfig                            |   12 ++
 arch/mips/ath79/Makefile                           |   18 ++
 arch/mips/ath79/Platform                           |    7 +
 arch/mips/ath79/clock.c                            |  183 +++++++++++++++++
 arch/mips/ath79/common.c                           |   97 +++++++++
 arch/mips/ath79/common.h                           |   26 +++
 arch/mips/ath79/dev-common.c                       |   67 +++++++
 arch/mips/ath79/dev-common.h                       |   17 ++
 arch/mips/ath79/early_printk.c                     |   36 ++++
 arch/mips/ath79/irq.c                              |  187 ++++++++++++++++++
 arch/mips/ath79/prom.c                             |   57 ++++++
 arch/mips/ath79/setup.c                            |  190 ++++++++++++++++++
 arch/mips/include/asm/mach-ath79/ar71xx_regs.h     |  207 ++++++++++++++++++++
 arch/mips/include/asm/mach-ath79/ath79.h           |   96 +++++++++
 .../include/asm/mach-ath79/cpu-feature-overrides.h |   56 ++++++
 arch/mips/include/asm/mach-ath79/irq.h             |   36 ++++
 .../include/asm/mach-ath79/kernel-entry-init.h     |   32 +++
 arch/mips/include/asm/mach-ath79/war.h             |   25 +++
 20 files changed, 1365 insertions(+), 0 deletions(-)
 create mode 100644 arch/mips/ath79/Kconfig
 create mode 100644 arch/mips/ath79/Makefile
 create mode 100644 arch/mips/ath79/Platform
 create mode 100644 arch/mips/ath79/clock.c
 create mode 100644 arch/mips/ath79/common.c
 create mode 100644 arch/mips/ath79/common.h
 create mode 100644 arch/mips/ath79/dev-common.c
 create mode 100644 arch/mips/ath79/dev-common.h
 create mode 100644 arch/mips/ath79/early_printk.c
 create mode 100644 arch/mips/ath79/irq.c
 create mode 100644 arch/mips/ath79/prom.c
 create mode 100644 arch/mips/ath79/setup.c
 create mode 100644 arch/mips/include/asm/mach-ath79/ar71xx_regs.h
 create mode 100644 arch/mips/include/asm/mach-ath79/ath79.h
 create mode 100644 arch/mips/include/asm/mach-ath79/cpu-feature-overrides.h
 create mode 100644 arch/mips/include/asm/mach-ath79/irq.h
 create mode 100644 arch/mips/include/asm/mach-ath79/kernel-entry-init.h
 create mode 100644 arch/mips/include/asm/mach-ath79/war.h
arch/mips/Kbuild.platforms +1 -0
index 78439b8..7ff9b54 100644
@@ -2,6 +2,7 @@
 
 platforms += alchemy
 platforms += ar7
+platforms += ath79
 platforms += bcm47xx
 platforms += bcm63xx
 platforms += cavium-octeon
arch/mips/Kconfig +15 -0
index 12d0d0f..2e32137 100644
@@ -66,6 +66,20 @@ config AR7
 	  Support for the Texas Instruments AR7 System-on-a-Chip
 	  family: TNETD7100, 7200 and 7300.
 
+config ATH79
+	bool "Atheros AR71XX/AR724X/AR913X based boards"
+	select BOOT_RAW
+	select CEVT_R4K
+	select CSRC_R4K
+	select DMA_NONCOHERENT
+	select IRQ_CPU
+	select SYS_HAS_CPU_MIPS32_R2
+	select SYS_HAS_EARLY_PRINTK
+	select SYS_SUPPORTS_32BIT_KERNEL
+	select SYS_SUPPORTS_BIG_ENDIAN
+	help
+	  Support for the Atheros AR71XX/AR724X/AR913X SoCs.
+
 config BCM47XX
 	bool "Broadcom BCM47XX based boards"
 	select CEVT_R4K
@@ -718,6 +732,7 @@ config CAVIUM_OCTEON_REFERENCE_BOARD
 endchoice
 
 source "arch/mips/alchemy/Kconfig"
+source "arch/mips/ath79/Kconfig"
 source "arch/mips/bcm63xx/Kconfig"
 source "arch/mips/jazz/Kconfig"
 source "arch/mips/jz4740/Kconfig"
arch/mips/ath79/Kconfig new file +12 -0
new file mode 100644
index 0000000..50b9334
@@ -0,0 +1,12 @@
+if ATH79
+
+config SOC_AR71XX
+	def_bool n
+
+config SOC_AR724X
+	def_bool n
+
+config SOC_AR913X
+	def_bool n
+
+endif
arch/mips/ath79/Makefile new file +18 -0
new file mode 100644
index 0000000..31e0f83
@@ -0,0 +1,18 @@
+#
+# Makefile for the Atheros AR71XX/AR724X/AR913X specific parts of the kernel
+#
+# Copyright (C) 2008-2011 Gabor Juhos <[email protected]>
+# Copyright (C) 2008 Imre Kaloz <[email protected]>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+
+obj-y	:= prom.o setup.o irq.o common.o clock.o
+
+obj-$(CONFIG_EARLY_PRINTK)		+= early_printk.o
+
+#
+# Devices
+#
+obj-y					+= dev-common.o
arch/mips/ath79/Platform new file +7 -0
new file mode 100644
index 0000000..2bd6636
@@ -0,0 +1,7 @@
+#
+# Atheros AR71xx/AR724x/AR913x
+#
+
+platform-$(CONFIG_ATH79)	+= ath79/
+cflags-$(CONFIG_ATH79)		+= -I$(srctree)/arch/mips/include/asm/mach-ath79
+load-$(CONFIG_ATH79)		= 0xffffffff80060000
arch/mips/ath79/clock.c new file +183 -0

183 lines not on this page · raw message

arch/mips/ath79/common.c new file +97 -0

97 lines not on this page · raw message

arch/mips/ath79/common.h new file +26 -0
new file mode 100644
index 0000000..612a6b5
@@ -0,0 +1,26 @@
+/*
+ *  Atheros AR71XX/AR724X/AR913X common definitions
+ *
+ *  Copyright (C) 2008-2011 Gabor Juhos <[email protected]>
+ *  Copyright (C) 2008 Imre Kaloz <[email protected]>
+ *
+ *  Parts of this file are based on Atheros' 2.6.15 BSP
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+ */
+
+#ifndef __ATH79_COMMON_H
+#define __ATH79_COMMON_H
+
+#include <linux/types.h>
+#include <linux/init.h>
+
+#define ATH79_MEM_SIZE_MIN	(2 * 1024 * 1024)
+#define ATH79_MEM_SIZE_MAX	(128 * 1024 * 1024)
+
+void ath79_clocks_init(void);
+void ath79_ddr_wb_flush(unsigned int reg);
+
+#endif /* __ATH79_COMMON_H */
arch/mips/ath79/dev-common.c new file +67 -0

67 lines not on this page · raw message

arch/mips/ath79/dev-common.h new file +17 -0
new file mode 100644
index 0000000..248622c
@@ -0,0 +1,17 @@
+/*
+ *  Atheros AR71XX/AR724X/AR913X common devices
+ *
+ *  Copyright (C) 2008-2010 Gabor Juhos <[email protected]>
+ *  Copyright (C) 2008 Imre Kaloz <[email protected]>
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+ */
+
+#ifndef _ATH79_DEV_COMMON_H
+#define _ATH79_DEV_COMMON_H
+
+void ath79_register_uart(void);
+
+#endif /* _ATH79_DEV_COMMON_H */
arch/mips/ath79/early_printk.c new file +36 -0
new file mode 100644
index 0000000..7499b0e
@@ -0,0 +1,36 @@
+/*
+ *  Atheros AR71XX/AR724X/AR913X SoC early printk support
+ *
+ *  Copyright (C) 2008-2010 Gabor Juhos <[email protected]>
+ *  Copyright (C) 2008 Imre Kaloz <[email protected]>
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+ */
+
+#include <linux/io.h>
+#include <linux/serial_reg.h>
+#include <asm/addrspace.h>
+
+#include <asm/mach-ath79/ar71xx_regs.h>
+
+static inline void prom_wait_thre(void __iomem *base)
+{
+	u32 lsr;
+
+	do {
+		lsr = __raw_readl(base + UART_LSR * 4);
+		if (lsr & UART_LSR_THRE)
+			break;
+	} while (1);
+}
+
+void prom_putchar(unsigned char ch)
+{
+	void __iomem *base = (void __iomem *)(KSEG1ADDR(AR71XX_UART_BASE));
+
+	prom_wait_thre(base);
+	__raw_writel(ch, base + UART_TX * 4);
+	prom_wait_thre(base);
+}
arch/mips/ath79/irq.c new file +187 -0

187 lines not on this page · raw message

arch/mips/ath79/prom.c new file +57 -0

57 lines not on this page · raw message

arch/mips/ath79/setup.c new file +190 -0

190 lines not on this page · raw message

arch/mips/include/asm/mach-ath79/ar71xx_regs.h new file +207 -0

207 lines not on this page · raw message

arch/mips/include/asm/mach-ath79/ath79.h new file +96 -0

96 lines not on this page · raw message

arch/mips/include/asm/mach-ath79/cpu-feature-overrides.h new file +56 -0

56 lines not on this page · raw message

arch/mips/include/asm/mach-ath79/irq.h new file +36 -0
new file mode 100644
index 0000000..189bc6e
@@ -0,0 +1,36 @@
+/*
+ *  Copyright (C) 2008-2010 Gabor Juhos <[email protected]>
+ *  Copyright (C) 2008 Imre Kaloz <[email protected]>
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+ */
+#ifndef __ASM_MACH_ATH79_IRQ_H
+#define __ASM_MACH_ATH79_IRQ_H
+
+#define MIPS_CPU_IRQ_BASE	0
+#define NR_IRQS			16
+
+#define ATH79_MISC_IRQ_BASE	8
+#define ATH79_MISC_IRQ_COUNT	8
+
+#define ATH79_CPU_IRQ_IP2	(MIPS_CPU_IRQ_BASE + 2)
+#define ATH79_CPU_IRQ_USB	(MIPS_CPU_IRQ_BASE + 3)
+#define ATH79_CPU_IRQ_GE0	(MIPS_CPU_IRQ_BASE + 4)
+#define ATH79_CPU_IRQ_GE1	(MIPS_CPU_IRQ_BASE + 5)
+#define ATH79_CPU_IRQ_MISC	(MIPS_CPU_IRQ_BASE + 6)
+#define ATH79_CPU_IRQ_TIMER	(MIPS_CPU_IRQ_BASE + 7)
+
+#define ATH79_MISC_IRQ_TIMER	(ATH79_MISC_IRQ_BASE + 0)
+#define ATH79_MISC_IRQ_ERROR	(ATH79_MISC_IRQ_BASE + 1)
+#define ATH79_MISC_IRQ_GPIO	(ATH79_MISC_IRQ_BASE + 2)
+#define ATH79_MISC_IRQ_UART	(ATH79_MISC_IRQ_BASE + 3)
+#define ATH79_MISC_IRQ_WDOG	(ATH79_MISC_IRQ_BASE + 4)
+#define ATH79_MISC_IRQ_PERFC	(ATH79_MISC_IRQ_BASE + 5)
+#define ATH79_MISC_IRQ_OHCI	(ATH79_MISC_IRQ_BASE + 6)
+#define ATH79_MISC_IRQ_DMA	(ATH79_MISC_IRQ_BASE + 7)
+
+#include_next <irq.h>
+
+#endif /* __ASM_MACH_ATH79_IRQ_H */
arch/mips/include/asm/mach-ath79/kernel-entry-init.h new file +32 -0
new file mode 100644
index 0000000..d8d046b
@@ -0,0 +1,32 @@
+/*
+ *  Atheros AR71XX/AR724X/AR913X specific kernel entry setup
+ *
+ *  Copyright (C) 2009 Gabor Juhos <[email protected]>
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+ *
+ */
+#ifndef __ASM_MACH_ATH79_KERNEL_ENTRY_H
+#define __ASM_MACH_ATH79_KERNEL_ENTRY_H
+
+	/*
+	 * Some bootloaders set the 'Kseg0 coherency algorithm' to
+	 * 'Cacheable, noncoherent, write-through, no write allocate'
+	 * and this cause performance issues. Let's go and change it to
+	 * 'Cacheable, noncoherent, write-back, write allocate'
+	 */
+	.macro	kernel_entry_setup
+	mfc0	t0, CP0_CONFIG
+	li	t1, ~CONF_CM_CMASK
+	and	t0, t1
+	ori	t0, CONF_CM_CACHABLE_NONCOHERENT
+	mtc0	t0, CP0_CONFIG
+	nop
+	.endm
+
+	.macro	smp_slave_setup
+	.endm
+
+#endif /* __ASM_MACH_ATH79_KERNEL_ENTRY_H */
arch/mips/include/asm/mach-ath79/war.h new file +25 -0
new file mode 100644
index 0000000..323d9f1
@@ -0,0 +1,25 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2002, 2004, 2007 by Ralf Baechle <[email protected]>
+ */
+#ifndef __ASM_MACH_ATH79_WAR_H
+#define __ASM_MACH_ATH79_WAR_H
+
+#define R4600_V1_INDEX_ICACHEOP_WAR	0
+#define R4600_V1_HIT_CACHEOP_WAR	0
+#define R4600_V2_HIT_CACHEOP_WAR	0
+#define R5432_CP0_INTERRUPT_WAR		0
+#define BCM1250_M3_WAR			0
+#define SIBYTE_1956_WAR			0
+#define MIPS4K_ICACHE_REFILL_WAR	0
+#define MIPS_CACHE_SYNC_WAR		0
+#define TX49XX_ICACHE_INDEX_INV_WAR	0
+#define RM9000_CDEX_SMP_WAR		0
+#define ICACHE_REFILLS_WORKAROUND_WAR	0
+#define R10000_LLSC_WAR			0
+#define MIPS34K_MISSED_ITLB_WAR		0
+
+#endif /* __ASM_MACH_ATH79_WAR_H */
Signature · 1 line
1.7.2.1
Applied
#2 lore raw

Re: [PATCH v5 01/16] MIPS: add initial support for the Atheros AR71XX/AR724X/AR931X SoCs

Thanks, applied.

Ralf

#3 lore raw

PATCH v5 2/16 MIPS: ath79: add GPIOLIB support

In reply to Gabor Juhos

This patch implements generic GPIO routines for the built-in GPIO controllers of the Atheros AR71XX/AR724X/AR913X SoCs.

---
Changes since RFC: ---

Changes since v1:
- rebased against 2.6.37-rc7

Changes since v2: ---

Changes since v3:
- rebased against 2.6.37-rc8

Changes since v4:
- remove __init from the declaration of ath79_gpio_init

 arch/mips/Kconfig                              |    1 +
 arch/mips/ath79/Makefile                       |    2 +-
 arch/mips/ath79/common.h                       |    5 +
 arch/mips/ath79/gpio.c                         |  197 ++++++++++++++++++++++++
 arch/mips/ath79/setup.c                        |    2 +-
 arch/mips/include/asm/mach-ath79/ar71xx_regs.h |   21 +++
 arch/mips/include/asm/mach-ath79/gpio.h        |   26 +++
 7 files changed, 252 insertions(+), 2 deletions(-)
 create mode 100644 arch/mips/ath79/gpio.c
 create mode 100644 arch/mips/include/asm/mach-ath79/gpio.h
arch/mips/Kconfig +1 -0
index 2e32137..944845a 100644
@@ -68,6 +68,7 @@ config AR7
 
 config ATH79
 	bool "Atheros AR71XX/AR724X/AR913X based boards"
+	select ARCH_REQUIRE_GPIOLIB
 	select BOOT_RAW
 	select CEVT_R4K
 	select CSRC_R4K
arch/mips/ath79/Makefile +1 -1
index 31e0f83..e621d6c 100644
@@ -8,7 +8,7 @@
 # under the terms of the GNU General Public License version 2 as published
 # by the Free Software Foundation.
 
-obj-y	:= prom.o setup.o irq.o common.o clock.o
+obj-y	:= prom.o setup.o irq.o common.o clock.o gpio.o
 
 obj-$(CONFIG_EARLY_PRINTK)		+= early_printk.o
 
arch/mips/ath79/common.h +5 -0
index 612a6b5..561906c 100644
@@ -23,4 +23,9 @@
 void ath79_clocks_init(void);
 void ath79_ddr_wb_flush(unsigned int reg);
 
+void ath79_gpio_function_enable(u32 mask);
+void ath79_gpio_function_disable(u32 mask);
+void ath79_gpio_function_setup(u32 set, u32 clear);
+void ath79_gpio_init(void);
+
 #endif /* __ATH79_COMMON_H */
arch/mips/ath79/gpio.c new file +197 -0

197 lines not on this page · raw message

arch/mips/ath79/setup.c +1 -1
index 175def8..29dde98 100644
@@ -157,7 +157,6 @@ void __init plat_mem_setup(void)
 					   AR71XX_RESET_SIZE);
 	ath79_pll_base = ioremap_nocache(AR71XX_PLL_BASE,
 					 AR71XX_PLL_SIZE);
-
 	ath79_ddr_base = ioremap_nocache(AR71XX_DDR_CTRL_BASE,
 					 AR71XX_DDR_CTRL_SIZE);
 
@@ -183,6 +182,7 @@ void __init plat_time_init(void)
 
 static int __init ath79_setup(void)
 {
+	ath79_gpio_init();
 	ath79_register_uart();
 	return 0;
 }
arch/mips/include/asm/mach-ath79/ar71xx_regs.h +21 -0
index 5a9e5e1..7f2933d 100644
@@ -25,6 +25,8 @@
 #define AR71XX_DDR_CTRL_SIZE	0x100
 #define AR71XX_UART_BASE	(AR71XX_APB_BASE + 0x00020000)
 #define AR71XX_UART_SIZE	0x100
+#define AR71XX_GPIO_BASE        (AR71XX_APB_BASE + 0x00040000)
+#define AR71XX_GPIO_SIZE        0x100
 #define AR71XX_PLL_BASE		(AR71XX_APB_BASE + 0x00050000)
 #define AR71XX_PLL_SIZE		0x100
 #define AR71XX_RESET_BASE	(AR71XX_APB_BASE + 0x00060000)
@@ -204,4 +206,23 @@
 #define AR71XX_SPI_IOC_CS_ALL	(AR71XX_SPI_IOC_CS0 | AR71XX_SPI_IOC_CS1 | \
 				 AR71XX_SPI_IOC_CS2)
 
+/*
+ * GPIO block
+ */
+#define AR71XX_GPIO_REG_OE		0x00
+#define AR71XX_GPIO_REG_IN		0x04
+#define AR71XX_GPIO_REG_OUT		0x08
+#define AR71XX_GPIO_REG_SET		0x0c
+#define AR71XX_GPIO_REG_CLEAR		0x10
+#define AR71XX_GPIO_REG_INT_MODE	0x14
+#define AR71XX_GPIO_REG_INT_TYPE	0x18
+#define AR71XX_GPIO_REG_INT_POLARITY	0x1c
+#define AR71XX_GPIO_REG_INT_PENDING	0x20
+#define AR71XX_GPIO_REG_INT_ENABLE	0x24
+#define AR71XX_GPIO_REG_FUNC		0x28
+
+#define AR71XX_GPIO_COUNT		16
+#define AR724X_GPIO_COUNT		18
+#define AR913X_GPIO_COUNT		22
+
 #endif /* __ASM_MACH_AR71XX_REGS_H */
arch/mips/include/asm/mach-ath79/gpio.h new file +26 -0
new file mode 100644
index 0000000..60dcb62
@@ -0,0 +1,26 @@
+/*
+ *  Atheros AR71XX/AR724X/AR913X GPIO API definitions
+ *
+ *  Copyright (C) 2008-2010 Gabor Juhos <[email protected]>
+ *  Copyright (C) 2008 Imre Kaloz <[email protected]>
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+ *
+ */
+
+#ifndef __ASM_MACH_ATH79_GPIO_H
+#define __ASM_MACH_ATH79_GPIO_H
+
+#define ARCH_NR_GPIOS	64
+#include <asm-generic/gpio.h>
+
+int gpio_to_irq(unsigned gpio);
+int irq_to_gpio(unsigned irq);
+int gpio_get_value(unsigned gpio);
+void gpio_set_value(unsigned gpio, int value);
+
+#define gpio_cansleep	__gpio_cansleep
+
+#endif /* __ASM_MACH_ATH79_GPIO_H */
Signature · 1 line
1.7.2.1
Applied
#4 lore raw

Re: [PATCH v5 02/16] MIPS: ath79: add GPIOLIB support

Thanks, applied.

Ralf

#5 lore raw

PATCH v5 3/16 MIPS: ath79: utilize the MIPS multi-machine support

In reply to Gabor Juhos

---
Changes since RFC: ---

Changes since v1:
- rebased against 2.6.37-rc7

Changes since v2: ---

Changes since v3:
- rebased against 2.6.37-rc8

Changes since v4: ---

 arch/mips/Kconfig           |    1 +
 arch/mips/ath79/machtypes.h |   21 +++++++++++++++++++++
 arch/mips/ath79/setup.c     |   15 +++++++++++++++
 3 files changed, 37 insertions(+), 0 deletions(-)
 create mode 100644 arch/mips/ath79/machtypes.h
arch/mips/Kconfig +1 -0
index 944845a..12dd976 100644
@@ -74,6 +74,7 @@ config ATH79
 	select CSRC_R4K
 	select DMA_NONCOHERENT
 	select IRQ_CPU
+	select MIPS_MACHINE
 	select SYS_HAS_CPU_MIPS32_R2
 	select SYS_HAS_EARLY_PRINTK
 	select SYS_SUPPORTS_32BIT_KERNEL
arch/mips/ath79/machtypes.h new file +21 -0
new file mode 100644
index 0000000..fac0e26
@@ -0,0 +1,21 @@
+/*
+ *  Atheros AR71XX/AR724X/AR913X machine type definitions
+ *
+ *  Copyright (C) 2008-2010 Gabor Juhos <[email protected]>
+ *  Copyright (C) 2008 Imre Kaloz <[email protected]>
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+ */
+
+#ifndef _ATH79_MACHTYPE_H
+#define _ATH79_MACHTYPE_H
+
+#include <asm/mips_machine.h>
+
+enum ath79_mach_type {
+	ATH79_MACH_GENERIC = 0,
+};
+
+#endif /* _ATH79_MACHTYPE_H */
arch/mips/ath79/setup.c +15 -0
index 29dde98..5e57402 100644
@@ -20,11 +20,13 @@
 #include <asm/bootinfo.h>
 #include <asm/time.h>		/* for mips_hpt_frequency */
 #include <asm/reboot.h>		/* for _machine_{restart,halt} */
+#include <asm/mips_machine.h>
 
 #include <asm/mach-ath79/ath79.h>
 #include <asm/mach-ath79/ar71xx_regs.h>
 #include "common.h"
 #include "dev-common.h"
+#include "machtypes.h"
 
 #define ATH79_SYS_TYPE_LEN	64
 
@@ -184,7 +186,20 @@ static int __init ath79_setup(void)
 {
 	ath79_gpio_init();
 	ath79_register_uart();
+
+	mips_machine_setup();
+
 	return 0;
 }
 
 arch_initcall(ath79_setup);
+
+static void __init ath79_generic_init(void)
+{
+	/* Nothing to do */
+}
+
+MIPS_MACHINE(ATH79_MACH_GENERIC,
+	     "Generic",
+	     "Generic AR71XX/AR724X/AR913X based board",
+	     ath79_generic_init);
Signature · 1 line
1.7.2.1
Applied
#6 lore raw

Re: [PATCH v5 03/16] MIPS: ath79: utilize the MIPS multi-machine support

Thanks, applied.

Ralf

#7 lore raw

PATCH v5 4/16 MIPS: ath79: add initial support for the Atheros PB44 reference board

In reply to Gabor Juhos

---
Changes since RFC:
- don't use 'default n' for the ATH79_MACH_PB44 Kconfig option

Changes since v1:
- rebased against 2.6.37-rc7

Changes since v2: ---

Changes since v3:
- rebased against 2.6.37-rc8

Changes since v4: ---

 arch/mips/ath79/Kconfig     |   11 ++++++++
 arch/mips/ath79/Makefile    |    5 ++++
 arch/mips/ath79/mach-pb44.c |   56 +++++++++++++++++++++++++++++++++++++++++++
 arch/mips/ath79/machtypes.h |    1 +
 4 files changed, 73 insertions(+), 0 deletions(-)
 create mode 100644 arch/mips/ath79/mach-pb44.c
arch/mips/ath79/Kconfig +11 -0
index 50b9334..fabb2b0 100644
@@ -1,5 +1,16 @@
 if ATH79
 
+menu "Atheros AR71XX/AR724X/AR913X machine selection"
+
+config ATH79_MACH_PB44
+	bool "Atheros PB44 reference board"
+	select SOC_AR71XX
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Atheros PB44 reference board.
+
+endmenu
+
 config SOC_AR71XX
 	def_bool n
 
arch/mips/ath79/Makefile +5 -0
index e621d6c..c3093f7 100644
@@ -16,3 +16,8 @@ obj-$(CONFIG_EARLY_PRINTK)		+= early_printk.o
 # Devices
 #
 obj-y					+= dev-common.o
+
+#
+# Machines
+#
+obj-$(CONFIG_ATH79_MACH_PB44)		+= mach-pb44.o
arch/mips/ath79/mach-pb44.c new file +56 -0

56 lines not on this page · raw message

arch/mips/ath79/machtypes.h +1 -0
index fac0e26..a796fa3 100644
@@ -16,6 +16,7 @@
 
 enum ath79_mach_type {
 	ATH79_MACH_GENERIC = 0,
+	ATH79_MACH_PB44,		/* Atheros PB44 reference board */
 };
 
 #endif /* _ATH79_MACHTYPE_H */
Signature · 1 line
1.7.2.1
Applied
#8 lore raw

Re: [PATCH v5 04/16] MIPS: ath79: add initial support for the Atheros PB44 reference board

Thanks, applied.

Ralf

#9 lore raw

PATCH v5 5/16 MIPS: ath79: add common GPIO LEDs device

In reply to Gabor Juhos

Almost all boards have one or more LEDs connected to GPIO lines. This patch adds common code to register a platform_device for them.

The patch also adds support for the LEDs on the PB44 board.

---
Changes since RFC: ---

Changes since v1:
- rebased against 2.6.37-rc7

Changes since v2:
- don't use __init for function declarations

Changes since v3:
- rebased against 2.6.37-rc8

Changes since v4: ---

 arch/mips/ath79/Kconfig         |    4 +++
 arch/mips/ath79/Makefile        |    1 +
 arch/mips/ath79/dev-leds-gpio.c |   56 +++++++++++++++++++++++++++++++++++++++
 arch/mips/ath79/dev-leds-gpio.h |   21 ++++++++++++++
 arch/mips/ath79/mach-pb44.c     |   18 ++++++++++++
 5 files changed, 100 insertions(+), 0 deletions(-)
 create mode 100644 arch/mips/ath79/dev-leds-gpio.c
 create mode 100644 arch/mips/ath79/dev-leds-gpio.h
arch/mips/ath79/Kconfig +4 -0
index fabb2b0..5bc480e 100644
@@ -5,6 +5,7 @@ menu "Atheros AR71XX/AR724X/AR913X machine selection"
 config ATH79_MACH_PB44
 	bool "Atheros PB44 reference board"
 	select SOC_AR71XX
+	select ATH79_DEV_LEDS_GPIO
 	help
 	  Say 'Y' here if you want your kernel to support the
 	  Atheros PB44 reference board.
@@ -20,4 +21,7 @@ config SOC_AR724X
 config SOC_AR913X
 	def_bool n
 
+config ATH79_DEV_LEDS_GPIO
+	def_bool n
+
 endif
arch/mips/ath79/Makefile +1 -0
index c3093f7..f41c029 100644
@@ -16,6 +16,7 @@ obj-$(CONFIG_EARLY_PRINTK)		+= early_printk.o
 # Devices
 #
 obj-y					+= dev-common.o
+obj-$(CONFIG_ATH79_DEV_LEDS_GPIO)	+= dev-leds-gpio.o
 
 #
 # Machines
arch/mips/ath79/dev-leds-gpio.c new file +56 -0

56 lines not on this page · raw message

arch/mips/ath79/dev-leds-gpio.h new file +21 -0
new file mode 100644
index 0000000..6e5d885
@@ -0,0 +1,21 @@
+/*
+ *  Atheros AR71XX/AR724X/AR913X common GPIO LEDs support
+ *
+ *  Copyright (C) 2008-2010 Gabor Juhos <[email protected]>
+ *  Copyright (C) 2008 Imre Kaloz <[email protected]>
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+ */
+
+#ifndef _ATH79_DEV_LEDS_GPIO_H
+#define _ATH79_DEV_LEDS_GPIO_H
+
+#include <linux/leds.h>
+
+void ath79_register_leds_gpio(int id,
+			      unsigned num_leds,
+			      struct gpio_led *leds);
+
+#endif /* _ATH79_DEV_LEDS_GPIO_H */
arch/mips/ath79/mach-pb44.c +18 -0
index ffc24d7..e176779 100644
@@ -15,11 +15,14 @@
 #include <linux/i2c/pcf857x.h>
 
 #include "machtypes.h"
+#include "dev-leds-gpio.h"
 
 #define PB44_GPIO_I2C_SCL	0
 #define PB44_GPIO_I2C_SDA	1
 
 #define PB44_GPIO_EXP_BASE	16
+#define PB44_GPIO_LED_JUMP1	(PB44_GPIO_EXP_BASE + 9)
+#define PB44_GPIO_LED_JUMP2	(PB44_GPIO_EXP_BASE + 10)
 
 static struct i2c_gpio_platform_data pb44_i2c_gpio_data = {
 	.sda_pin        = PB44_GPIO_I2C_SDA,
@@ -45,11 +48,26 @@ static struct i2c_board_info pb44_i2c_board_info[] __initdata = {
 	},
 };
 
+static struct gpio_led pb44_leds_gpio[] __initdata = {
+	{
+		.name		= "pb44:amber:jump1",
+		.gpio		= PB44_GPIO_LED_JUMP1,
+		.active_low	= 1,
+	}, {
+		.name		= "pb44:green:jump2",
+		.gpio		= PB44_GPIO_LED_JUMP2,
+		.active_low	= 1,
+	},
+};
+
 static void __init pb44_init(void)
 {
 	i2c_register_board_info(0, pb44_i2c_board_info,
 				ARRAY_SIZE(pb44_i2c_board_info));
 	platform_device_register(&pb44_i2c_gpio_device);
+
+	ath79_register_leds_gpio(-1, ARRAY_SIZE(pb44_leds_gpio),
+				 pb44_leds_gpio);
 }
 
 MIPS_MACHINE(ATH79_MACH_PB44, "PB44", "Atheros PB44 reference board",
Signature · 1 line
1.7.2.1
Applied
#10 lore raw

Re: [PATCH v5 05/16] MIPS: ath79: add common GPIO LEDs device

Thanks, applied.

Ralf

#11 lore raw

PATCH v5 6/16 watchdog: add driver for the Atheros AR71XX/AR724X/AR913X SoCs

In reply to Gabor Juhos

This patch adds a driver for the built-in hardware watchdog device of the Atheros AR71XX/AR724X/AR913X SoCs.

---
Changes since RFC: ---

Changes since v1:
- rebased against 2.6.37-rc7

Changes since v2: ---

Changes since v3:
- remove #ifdef CONFIG_WATCHDOG_NOWAYOUT for nowayout module-parameter.
- add ath79_wdt_keepalive when doing un unexpected close of /dev/watchdog (the close is considered as communication with /dev/watchdog)
- replace reboot_notifier with a platform shutdown.
- add timeout module-parameter
- rebased against 2.6.37-rc8

Changes since v4:
- use __dev{init,exit,exit_p}
- remove DRIVER_DESC definition and use its value directly in the MODULE_DESCRIPTION() macro
- convert to use the clock API

 drivers/watchdog/Kconfig     |    7 +
 drivers/watchdog/Makefile    |    1 +
 drivers/watchdog/ath79_wdt.c |  305 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 313 insertions(+), 0 deletions(-)
 create mode 100644 drivers/watchdog/ath79_wdt.c
drivers/watchdog/Kconfig +7 -0
index a5ad77e..e4be010 100644
@@ -836,6 +836,13 @@ config SBC_EPX_C3_WATCHDOG
 
 # MIPS Architecture
 
+config ATH79_WDT
+	tristate "Atheros AR71XX/AR724X/AR913X hardware watchdog"
+	depends on ATH79
+	help
+	  Hardware driver for the built-in watchdog timer on the Atheros
+	  AR71XX/AR724X/AR913X SoCs.
+
 config BCM47XX_WDT
 	tristate "Broadcom BCM47xx Watchdog Timer"
 	depends on BCM47XX
drivers/watchdog/Makefile +1 -0
index 4b0ef38..01d9063 100644
@@ -108,6 +108,7 @@ obj-$(CONFIG_SBC_EPX_C3_WATCHDOG) += sbc_epx_c3.o
 # M68KNOMMU Architecture
 
 # MIPS Architecture
+obj-$(CONFIG_ATH79_WDT) += ath79_wdt.o
 obj-$(CONFIG_BCM47XX_WDT) += bcm47xx_wdt.o
 obj-$(CONFIG_BCM63XX_WDT) += bcm63xx_wdt.o
 obj-$(CONFIG_RC32434_WDT) += rc32434_wdt.o
drivers/watchdog/ath79_wdt.c new file +305 -0

305 lines not on this page · raw message

Signature · 1 line
1.7.2.1
#12 lore raw

Re: [PATCH v5 06/16] watchdog: add driver for the Atheros AR71XX/AR724X/AR913X SoCs

Dropped as this one has already been merged via the watchdog tree.

Thanks folks,

Ralf

#13 lore raw

PATCH v5 7/16 MIPS: ath79: add common watchdog device

In reply to Gabor Juhos

All supported SoCs have a built-in hardware watchdog driver. This patch registers a platform_device for that to make it usable.

---
Changes since RFC:
- remove the ATH79_DEV_WDT Kconfig option, and move the watchdog platform code into dev-common.[ch]

Changes since v1:
- rebased against 2.6.37-rc7

Changes since v2:
- don't use __init for function declarations

Changes since v3:
- rebased against 2.6.37-rc8

Changes since v4: ---

 arch/mips/ath79/dev-common.c |   10 ++++++++++
 arch/mips/ath79/dev-common.h |    1 +
 arch/mips/ath79/setup.c      |    1 +
 3 files changed, 12 insertions(+), 0 deletions(-)
arch/mips/ath79/dev-common.c +10 -0
index 3cfa100..3b82e32 100644
@@ -65,3 +65,13 @@ void __init ath79_register_uart(void)
 	ath79_uart_data[0].uartclk = clk_get_rate(clk);
 	platform_device_register(&ath79_uart_device);
 }
+
+static struct platform_device ath79_wdt_device = {
+	.name		= "ath79-wdt",
+	.id		= -1,
+};
+
+void __init ath79_register_wdt(void)
+{
+	platform_device_register(&ath79_wdt_device);
+}
arch/mips/ath79/dev-common.h +1 -0
index 248622c..0f514e1 100644
@@ -13,5 +13,6 @@
 #define _ATH79_DEV_COMMON_H
 
 void ath79_register_uart(void);
+void ath79_register_wdt(void);
 
 #endif /* _ATH79_DEV_COMMON_H */
arch/mips/ath79/setup.c +1 -0
index 5e57402..159b42f 100644
@@ -186,6 +186,7 @@ static int __init ath79_setup(void)
 {
 	ath79_gpio_init();
 	ath79_register_uart();
+	ath79_register_wdt();
 
 	mips_machine_setup();
 
Signature · 1 line
1.7.2.1
Applied
#14 lore raw

Re: [PATCH v5 07/16] MIPS: ath79: add common watchdog device

Thanks, applied.

Ralf

#15 lore raw

PATCH v5 8/16 MIPS: ath79: add common GPIO buttons device

In reply to Gabor Juhos

Almost all boards have one or more push buttons connected to GPIO lines. This patch adds common code to register a platform_device for them.

The patch also adds support for the buttons on the PB44 board.

---
Changes since RFC: ---

Changes since v1:
- converted to use the gpio_keys_polled driver
- rebased against 2.6.37-rc7

Changes since v2:
- don't use __init for function declarations

Changes since v3:
- rebased against 2.6.37-rc8

Changes since v4: ---

 arch/mips/ath79/Kconfig            |    4 ++
 arch/mips/ath79/Makefile           |    1 +
 arch/mips/ath79/dev-gpio-buttons.c |   58 ++++++++++++++++++++++++++++++++++++
 arch/mips/ath79/dev-gpio-buttons.h |   23 ++++++++++++++
 arch/mips/ath79/mach-pb44.c        |   27 ++++++++++++++++
 5 files changed, 113 insertions(+), 0 deletions(-)
 create mode 100644 arch/mips/ath79/dev-gpio-buttons.c
 create mode 100644 arch/mips/ath79/dev-gpio-buttons.h
arch/mips/ath79/Kconfig +4 -0
index 5bc480e..185a8d6 100644
@@ -5,6 +5,7 @@ menu "Atheros AR71XX/AR724X/AR913X machine selection"
 config ATH79_MACH_PB44
 	bool "Atheros PB44 reference board"
 	select SOC_AR71XX
+	select ATH79_DEV_GPIO_BUTTONS
 	select ATH79_DEV_LEDS_GPIO
 	help
 	  Say 'Y' here if you want your kernel to support the
@@ -21,6 +22,9 @@ config SOC_AR724X
 config SOC_AR913X
 	def_bool n
 
+config ATH79_DEV_GPIO_BUTTONS
+	def_bool n
+
 config ATH79_DEV_LEDS_GPIO
 	def_bool n
 
arch/mips/ath79/Makefile +1 -0
index f41c029..344e9ab 100644
@@ -16,6 +16,7 @@ obj-$(CONFIG_EARLY_PRINTK)		+= early_printk.o
 # Devices
 #
 obj-y					+= dev-common.o
+obj-$(CONFIG_ATH79_DEV_GPIO_BUTTONS)	+= dev-gpio-buttons.o
 obj-$(CONFIG_ATH79_DEV_LEDS_GPIO)	+= dev-leds-gpio.o
 
 #
arch/mips/ath79/dev-gpio-buttons.c new file +58 -0

58 lines not on this page · raw message

arch/mips/ath79/dev-gpio-buttons.h new file +23 -0
new file mode 100644
index 0000000..481847a
@@ -0,0 +1,23 @@
+/*
+ *  Atheros AR71XX/AR724X/AR913X GPIO button support
+ *
+ *  Copyright (C) 2008-2010 Gabor Juhos <[email protected]>
+ *  Copyright (C) 2008 Imre Kaloz <[email protected]>
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+ */
+
+#ifndef _ATH79_DEV_GPIO_BUTTONS_H
+#define _ATH79_DEV_GPIO_BUTTONS_H
+
+#include <linux/input.h>
+#include <linux/gpio_keys.h>
+
+void ath79_register_gpio_keys_polled(int id,
+				     unsigned poll_interval,
+				     unsigned nbuttons,
+				     struct gpio_keys_button *buttons);
+
+#endif /* _ATH79_DEV_GPIO_BUTTONS_H */
arch/mips/ath79/mach-pb44.c +27 -0
index e176779..3dc5080 100644
@@ -15,15 +15,21 @@
 #include <linux/i2c/pcf857x.h>
 
 #include "machtypes.h"
+#include "dev-gpio-buttons.h"
 #include "dev-leds-gpio.h"
 
 #define PB44_GPIO_I2C_SCL	0
 #define PB44_GPIO_I2C_SDA	1
 
 #define PB44_GPIO_EXP_BASE	16
+#define PB44_GPIO_SW_RESET	(PB44_GPIO_EXP_BASE + 6)
+#define PB44_GPIO_SW_JUMP	(PB44_GPIO_EXP_BASE + 8)
 #define PB44_GPIO_LED_JUMP1	(PB44_GPIO_EXP_BASE + 9)
 #define PB44_GPIO_LED_JUMP2	(PB44_GPIO_EXP_BASE + 10)
 
+#define PB44_KEYS_POLL_INTERVAL		20	/* msecs */
+#define PB44_KEYS_DEBOUNCE_INTERVAL	(3 * PB44_KEYS_POLL_INTERVAL)
+
 static struct i2c_gpio_platform_data pb44_i2c_gpio_data = {
 	.sda_pin        = PB44_GPIO_I2C_SDA,
 	.scl_pin        = PB44_GPIO_I2C_SCL,
@@ -60,6 +66,24 @@ static struct gpio_led pb44_leds_gpio[] __initdata = {
 	},
 };
 
+static struct gpio_keys_button pb44_gpio_keys[] __initdata = {
+	{
+		.desc		= "soft_reset",
+		.type		= EV_KEY,
+		.code		= KEY_RESTART,
+		.debounce_interval = PB44_KEYS_DEBOUNCE_INTERVAL,
+		.gpio		= PB44_GPIO_SW_RESET,
+		.active_low	= 1,
+	} , {
+		.desc		= "jumpstart",
+		.type		= EV_KEY,
+		.code		= KEY_WPS_BUTTON,
+		.debounce_interval = PB44_KEYS_DEBOUNCE_INTERVAL,
+		.gpio		= PB44_GPIO_SW_JUMP,
+		.active_low	= 1,
+	}
+};
+
 static void __init pb44_init(void)
 {
 	i2c_register_board_info(0, pb44_i2c_board_info,
@@ -68,6 +92,9 @@ static void __init pb44_init(void)
 
 	ath79_register_leds_gpio(-1, ARRAY_SIZE(pb44_leds_gpio),
 				 pb44_leds_gpio);
+	ath79_register_gpio_keys_polled(-1, PB44_KEYS_POLL_INTERVAL,
+					ARRAY_SIZE(pb44_gpio_keys),
+					pb44_gpio_keys);
 }
 
 MIPS_MACHINE(ATH79_MACH_PB44, "PB44", "Atheros PB44 reference board",
Signature · 1 line
1.7.2.1
Applied
#16 lore raw

Re: [PATCH v5 08/16] MIPS: ath79: add common GPIO buttons device

Thanks, applied.

Ralf

#17 lore raw

PATCH v5 9/16 spi: add SPI controller driver for the Atheros AR71XX/AR724X/AR913X SoCs

In reply to Gabor Juhos

The Atheros AR71XX/AR724X/AR913X SoCs have a built-in SPI controller. This patch implements a driver for that.

Cc David Brownell <[email protected]>
Cc spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org

---
Changes since RFC:
- remove DRV_DESC definition and use its previous value directly in the MODULE_DESCRIPTION() macro,
- use io{read,write}32 accesors instead of __raw_{read,write}l,
- use __dev{init,exit,exit_p} annotations where in the appropriate places,
- initialize 'master->bus_num' field to -1 if no platform data specified, so that a bus number can be dynamically assigned,
- rename ath79_spi_drv to ath79_spi_driver to avoid section mismatch warnings

Changes since v1:
- rebased against 2.6.37-rc7

Changes since v2: ---

Changes since v3:
- rebased against 2.6.37-rc8

Changes since v4:
- remove unused pdev field from struct ath79_spi
- rename spidev_to_sp to ath79_spidev_to_sp
- add ath79_spidev_controller_data structure
- fix a typo in MODULE_DESCRIPTION

 .../include/asm/mach-ath79/ath79_spi_platform.h    |   23 ++
 drivers/spi/Kconfig                                |    8 +
 drivers/spi/Makefile                               |    1 +
 drivers/spi/ath79_spi.c                            |  292 ++++++++++++++++++++
 4 files changed, 324 insertions(+), 0 deletions(-)
 create mode 100644 arch/mips/include/asm/mach-ath79/ath79_spi_platform.h
 create mode 100644 drivers/spi/ath79_spi.c
arch/mips/include/asm/mach-ath79/ath79_spi_platform.h new file +23 -0
new file mode 100644
index 0000000..aa2283e
@@ -0,0 +1,23 @@
+/*
+ *  Platform data definition for Atheros AR71XX/AR724X/AR913X SPI controller
+ *
+ *  Copyright (C) 2008-2010 Gabor Juhos <[email protected]>
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+ */
+
+#ifndef _ATH79_SPI_PLATFORM_H
+#define _ATH79_SPI_PLATFORM_H
+
+struct ath79_spi_platform_data {
+	unsigned	bus_num;
+	unsigned	num_chipselect;
+};
+
+struct ath79_spi_controller_data {
+	unsigned	gpio;
+};
+
+#endif /* _ATH79_SPI_PLATFORM_H */
drivers/spi/Kconfig +8 -0
index 78f9fd0..f2093e1 100644
@@ -53,6 +53,14 @@ if SPI_MASTER
 
 comment "SPI Master Controller Drivers"
 
+config SPI_ATH79
+	tristate "Atheros AR71XX/AR724X/AR913X SPI controller driver"
+	depends on ATH79 && GENERIC_GPIO
+	select SPI_BITBANG
+	help
+	  This enables support for the SPI controller present on the
+	  Atheros AR71XX/AR724X/AR913X SoCs.
+
 config SPI_ATMEL
 	tristate "Atmel SPI Controller"
 	depends on (ARCH_AT91 || AVR32)
drivers/spi/Makefile +1 -0
index 8bc1a5a..875bc3d 100644
@@ -10,6 +10,7 @@ obj-$(CONFIG_SPI_MASTER)		+= spi.o
 
 # SPI master controller drivers (bus)
 obj-$(CONFIG_SPI_ATMEL)			+= atmel_spi.o
+obj-$(CONFIG_SPI_ATH79)			+= ath79_spi.o
 obj-$(CONFIG_SPI_BFIN)			+= spi_bfin5xx.o
 obj-$(CONFIG_SPI_BITBANG)		+= spi_bitbang.o
 obj-$(CONFIG_SPI_AU1550)		+= au1550_spi.o
drivers/spi/ath79_spi.c new file +292 -0

292 lines not on this page · raw message

Signature · 9 lines
1.7.2.1


------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
#18 lore raw

Re: [PATCH v5 09/16] spi: add SPI controller driver for the Atheros AR71XX/AR724X/AR913X SoCs

Thanks everybody, applied.

Ralf

#19 lore raw

PATCH v5 10/16 MIPS: ath79: add common SPI controller device

In reply to Gabor Juhos

Several boards are using the built-in SPI controller of the AR71XX/AR724X/AR913X SoCs. This patch adds common platform_device and helper code to register it. Additionally, the patch registers the SPI bus on the PB44 board.

---
Changes since RFC: ---

Changes since v1:
- rebased against 2.6.37-rc7

Changes since v2:
- don't use __init for function declarations

Changes since v3
- rebased against 2.6.37-rc8

Changes since v4: ---

 arch/mips/ath79/Kconfig                        |    4 ++
 arch/mips/ath79/Makefile                       |    1 +
 arch/mips/ath79/dev-spi.c                      |   38 ++++++++++++++++++++++++
 arch/mips/ath79/dev-spi.h                      |   22 ++++++++++++++
 arch/mips/ath79/mach-pb44.c                    |   17 ++++++++++
 arch/mips/include/asm/mach-ath79/ar71xx_regs.h |    2 +
 6 files changed, 84 insertions(+), 0 deletions(-)
 create mode 100644 arch/mips/ath79/dev-spi.c
 create mode 100644 arch/mips/ath79/dev-spi.h
arch/mips/ath79/Kconfig +4 -0
index 185a8d6..cd6c738 100644
@@ -7,6 +7,7 @@ config ATH79_MACH_PB44
 	select SOC_AR71XX
 	select ATH79_DEV_GPIO_BUTTONS
 	select ATH79_DEV_LEDS_GPIO
+	select ATH79_DEV_SPI
 	help
 	  Say 'Y' here if you want your kernel to support the
 	  Atheros PB44 reference board.
@@ -28,4 +29,7 @@ config ATH79_DEV_GPIO_BUTTONS
 config ATH79_DEV_LEDS_GPIO
 	def_bool n
 
+config ATH79_DEV_SPI
+	def_bool n
+
 endif
arch/mips/ath79/Makefile +1 -0
index 344e9ab..42f4295 100644
@@ -18,6 +18,7 @@ obj-$(CONFIG_EARLY_PRINTK)		+= early_printk.o
 obj-y					+= dev-common.o
 obj-$(CONFIG_ATH79_DEV_GPIO_BUTTONS)	+= dev-gpio-buttons.o
 obj-$(CONFIG_ATH79_DEV_LEDS_GPIO)	+= dev-leds-gpio.o
+obj-$(CONFIG_ATH79_DEV_SPI)		+= dev-spi.o
 
 #
 # Machines
arch/mips/ath79/dev-spi.c new file +38 -0
new file mode 100644
index 0000000..aa30163
@@ -0,0 +1,38 @@
+/*
+ *  Atheros AR71XX/AR724X/AR913X SPI controller device
+ *
+ *  Copyright (C) 2008-2010 Gabor Juhos <[email protected]>
+ *  Copyright (C) 2008 Imre Kaloz <[email protected]>
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+ */
+
+#include <linux/platform_device.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
+#include "dev-spi.h"
+
+static struct resource ath79_spi_resources[] = {
+	{
+		.start	= AR71XX_SPI_BASE,
+		.end	= AR71XX_SPI_BASE + AR71XX_SPI_SIZE - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+};
+
+static struct platform_device ath79_spi_device = {
+	.name		= "ath79-spi",
+	.id		= -1,
+	.resource	= ath79_spi_resources,
+	.num_resources	= ARRAY_SIZE(ath79_spi_resources),
+};
+
+void __init ath79_register_spi(struct ath79_spi_platform_data *pdata,
+			       struct spi_board_info const *info,
+			       unsigned n)
+{
+	spi_register_board_info(info, n);
+	ath79_spi_device.dev.platform_data = pdata;
+	platform_device_register(&ath79_spi_device);
+}
arch/mips/ath79/dev-spi.h new file +22 -0
new file mode 100644
index 0000000..d732565
@@ -0,0 +1,22 @@
+/*
+ *  Atheros AR71XX/AR724X/AR913X SPI controller device
+ *
+ *  Copyright (C) 2008-2010 Gabor Juhos <[email protected]>
+ *  Copyright (C) 2008 Imre Kaloz <[email protected]>
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+ */
+
+#ifndef _ATH79_DEV_SPI_H
+#define _ATH79_DEV_SPI_H
+
+#include <linux/spi/spi.h>
+#include <asm/mach-ath79/ath79_spi_platform.h>
+
+void ath79_register_spi(struct ath79_spi_platform_data *pdata,
+			 struct spi_board_info const *info,
+			 unsigned n);
+
+#endif /* _ATH79_DEV_SPI_H */
arch/mips/ath79/mach-pb44.c +17 -0
index 3dc5080..ec7b7a1 100644
@@ -17,6 +17,7 @@
 #include "machtypes.h"
 #include "dev-gpio-buttons.h"
 #include "dev-leds-gpio.h"
+#include "dev-spi.h"
 
 #define PB44_GPIO_I2C_SCL	0
 #define PB44_GPIO_I2C_SDA	1
@@ -84,6 +85,20 @@ static struct gpio_keys_button pb44_gpio_keys[] __initdata = {
 	}
 };
 
+static struct spi_board_info pb44_spi_info[] = {
+	{
+		.bus_num	= 0,
+		.chip_select	= 0,
+		.max_speed_hz	= 25000000,
+		.modalias	= "m25p64",
+	},
+};
+
+static struct ath79_spi_platform_data pb44_spi_data = {
+	.bus_num		= 0,
+	.num_chipselect		= 1,
+};
+
 static void __init pb44_init(void)
 {
 	i2c_register_board_info(0, pb44_i2c_board_info,
@@ -95,6 +110,8 @@ static void __init pb44_init(void)
 	ath79_register_gpio_keys_polled(-1, PB44_KEYS_POLL_INTERVAL,
 					ARRAY_SIZE(pb44_gpio_keys),
 					pb44_gpio_keys);
+	ath79_register_spi(&pb44_spi_data, pb44_spi_info,
+			   ARRAY_SIZE(pb44_spi_info));
 }
 
 MIPS_MACHINE(ATH79_MACH_PB44, "PB44", "Atheros PB44 reference board",
arch/mips/include/asm/mach-ath79/ar71xx_regs.h +2 -0
index 7f2933d..4f2b621 100644
@@ -20,6 +20,8 @@
 #include <linux/bitops.h>
 
 #define AR71XX_APB_BASE		0x18000000
+#define AR71XX_SPI_BASE		0x1f000000
+#define AR71XX_SPI_SIZE		0x01000000
 
 #define AR71XX_DDR_CTRL_BASE	(AR71XX_APB_BASE + 0x00000000)
 #define AR71XX_DDR_CTRL_SIZE	0x100
Signature · 1 line
1.7.2.1
Applied
#20 lore raw

Re: [PATCH v5 10/16] MIPS: ath79: add common SPI controller device

Thanks, applied.

Ralf

#21 lore raw

PATCH v5 11/16 USB: ehci: add workaround for Synopsys HC bug

In reply to Gabor Juhos

A Synopsys USB core used in various SoCs has a bug which might cause that the host controller not issuing ping.

When software uses the Doorbell mechanism to remove queue heads, the host controller still has references to the removed queue head even after indicating an Interrupt on Async Advance. This happens if the last executed queue head's Next Link queue head is removed.

Consequences of the defect:
The Host controller fetches the removed queue head, using memory that would otherwise be deallocated.This results in incorrect transactions on both the USB and system memory. This may result in undefined behavior.

Workarounds:

1) If no queue head is active (no Status field's Active bit is set) after removing the queue heads, the software can write one of the valid queue head addresses to the ASYNCLISTADDR register and deallocate the removed queue head's memory after 2 microframes.

If one or more of the queue heads is active (the Active bit is set in the Status field) after removing the queue heads, the software can delay memory deallocation after time X, where X is the time required for the Host Controller to go through all the queue heads once. X varies with the number of queue heads and the time required to process periodic
transactions: if more periodic transactions must be performed, the Host Controller has less time to process asynchronous transaction processing.

2) Do not use the Doorbell mechanism to remove the queue heads. Disable the Asynchronous Schedule Enable bit instead.

The bug has been discussed on the linux-usb-devel mailing-list four years ago, the original thread can be found here:
http://www.mail-archive.com/[email protected]/msg45345.html

This patch implements the first workaround as suggested by David Brownell. The built-in USB host controller of the Atheros AR7130/AR7141/AR7161 SoCs requires this to work properly.

Cc David Brownell <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>

---
Changes since RFC: ---

Changes since v1:
- rebased against 2.6.37-rc7

Changes since v2: ---

Changes since v3:
- rebased against 2.6.37-rc8

Changes since v4: ---

 drivers/usb/host/ehci-q.c |    3 +++
 drivers/usb/host/ehci.h   |    1 +
 2 files changed, 4 insertions(+), 0 deletions(-)
drivers/usb/host/ehci-q.c +3 -0
index 233c288..343b8de 100644
@@ -1193,6 +1193,9 @@ static void end_unlink_async (struct ehci_hcd *ehci)
 		ehci->reclaim = NULL;
 		start_unlink_async (ehci, next);
 	}
+
+	if (ehci->has_synopsys_hc_bug)
+		writel((u32)ehci->async->qh_dma, &ehci->regs->async_next);
 }
 
 /* makes sure the async qh will become idle */
drivers/usb/host/ehci.h +1 -0
index ba8eab3..6da85b2 100644
@@ -133,6 +133,7 @@ struct ehci_hcd {			/* one per controller */
 	unsigned		broken_periodic:1;
 	unsigned		fs_i_thresh:1;	/* Intel iso scheduling */
 	unsigned		use_dummy_qh:1;	/* AMD Frame List table quirk*/
+	unsigned		has_synopsys_hc_bug:1; /* Synopsys HC */
 
 	/* required for usb32 quirk */
 	#define OHCI_CTRL_HCFS          (3 << 6)
Signature · 1 line
1.7.2.1
#22 lore raw

PATCH v5 12/16 USB: ehci: add bus glue for the Atheros AR71XX/AR724X/AR913X SoCs

In reply to Gabor Juhos

The Atheros AR71XX/AR724X/AR913X SoCs have a built-in EHCI controller. This patch adds the necessary glue code to make the generic EHCI driver usable for them.

---
Changes since RFC:
- don't use 'default y if SOC_*', select USB_ARCH_HAS_EHCI option in the platform specific Kconfig file instead
- add missing 'ath79_ehci_platform.h' file

Changes since v1:
- rebased against 2.6.37-rc7

Changes since v2: ---

Changes since v3:
- rebased against 2.6.37-rc8

Changes since v4: ---

 arch/mips/ath79/Kconfig                            |    3 +
 .../include/asm/mach-ath79/ath79_ehci_platform.h   |   18 ++
 drivers/usb/host/Kconfig                           |    8 +
 drivers/usb/host/ehci-ath79.c                      |  176 ++++++++++++++++++++
 drivers/usb/host/ehci-hcd.c                        |    5 +
 5 files changed, 210 insertions(+), 0 deletions(-)
 create mode 100644 arch/mips/include/asm/mach-ath79/ath79_ehci_platform.h
 create mode 100644 drivers/usb/host/ehci-ath79.c
arch/mips/ath79/Kconfig +3 -0
index cd6c738..647f535 100644
@@ -15,12 +15,15 @@ config ATH79_MACH_PB44
 endmenu
 
 config SOC_AR71XX
+	select USB_ARCH_HAS_EHCI
 	def_bool n
 
 config SOC_AR724X
+	select USB_ARCH_HAS_EHCI
 	def_bool n
 
 config SOC_AR913X
+	select USB_ARCH_HAS_EHCI
 	def_bool n
 
 config ATH79_DEV_GPIO_BUTTONS
arch/mips/include/asm/mach-ath79/ath79_ehci_platform.h new file +18 -0
new file mode 100644
index 0000000..6ee075f
@@ -0,0 +1,18 @@
+/*
+ *  Platform data definition for Atheros AR71XX/AR913X EHCI controller
+ *
+ *  Copyright (C) 2008-2010 Gabor Juhos <[email protected]>
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+ */
+
+#ifndef _ATH79_EHCI_PLATFORM_H
+#define _ATH79_EHCI_PLATFORM_H
+
+struct ath79_ehci_platform_data {
+	u8	is_ar913x;
+};
+
+#endif /* _ATH79_EHCI_PLATFORM_H */
drivers/usb/host/Kconfig +8 -0
index 6f4f8e6..3a2667a 100644
@@ -147,6 +147,14 @@ config USB_W90X900_EHCI
 	---help---
 		Enables support for the W90X900 USB controller
 
+config USB_EHCI_ATH79
+	bool "EHCI support for AR71XX/AR724X/AR913X SoCs"
+	depends on USB_EHCI_HCD && ATH79
+	select USB_EHCI_ROOT_HUB_TT
+	---help---
+	  Enables support for the built-in EHCI controller present
+	  on the Atheros AR71XX/AR724X/AR913X SoCs.
+
 config USB_OXU210HP_HCD
 	tristate "OXU210HP HCD support"
 	depends on USB
drivers/usb/host/ehci-ath79.c new file +176 -0

176 lines not on this page · raw message

drivers/usb/host/ehci-hcd.c +5 -0
index e906280..b1313af 100644
@@ -1216,6 +1216,11 @@ MODULE_LICENSE ("GPL");
 #define PLATFORM_DRIVER		ehci_octeon_driver
 #endif
 
+#ifdef CONFIG_USB_EHCI_ATH79
+#include "ehci-ath79.c"
+#define PLATFORM_DRIVER		ehci_ath79_driver
+#endif
+
 #if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \
     !defined(PS3_SYSTEM_BUS_DRIVER) && !defined(OF_PLATFORM_DRIVER) && \
     !defined(XILINX_OF_PLATFORM_DRIVER)
Signature · 1 line
1.7.2.1
#23 lore raw

PATCH v5 13/16 USB: ohci: add bus glue for the Atheros AR71XX/AR7240 SoCs

In reply to Gabor Juhos

The Atheros AR71XX/AR7240 SoCs have a built-in OHCI controller. This patch adds the necessary glue code to make the generic OHCI driver usable for them.

---
Changes since RFC:
- don't use 'defauly y if SOC_*', select the USB_ARCH_HAS_OHCI option in the platform specific Kconfig file instead
- remove ath79_ehci_platform.h, it belongs to the EHCI patch

Changes since v1:
- rebased against 2.6.37-rc7

Changes since v2: ---

Changes since v3:
- rebased against 2.6.37-rc8

Changes since v4: ---

 arch/mips/ath79/Kconfig       |    2 +
 drivers/usb/host/Kconfig      |    8 ++
 drivers/usb/host/ohci-ath79.c |  162 +++++++++++++++++++++++++++++++++++++++++
 drivers/usb/host/ohci-hcd.c   |    5 +
 4 files changed, 177 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/host/ohci-ath79.c
arch/mips/ath79/Kconfig +2 -0
index 647f535..d4456ce 100644
@@ -16,10 +16,12 @@ endmenu
 
 config SOC_AR71XX
 	select USB_ARCH_HAS_EHCI
+	select USB_ARCH_HAS_OHCI
 	def_bool n
 
 config SOC_AR724X
 	select USB_ARCH_HAS_EHCI
+	select USB_ARCH_HAS_OHCI
 	def_bool n
 
 config SOC_AR913X
drivers/usb/host/Kconfig +8 -0
index 3a2667a..39ed353 100644
@@ -240,6 +240,14 @@ config USB_OHCI_HCD_OMAP3
 	  Enables support for the on-chip OHCI controller on
 	  OMAP3 and later chips.
 
+config USB_OHCI_ATH79
+	bool "USB OHCI support for the Atheros AR71XX/AR724X SoCs"
+	depends on USB_OHCI_HCD && (SOC_AR71XX || SOC_AR724X)
+	default y
+	help
+	  Enables support for the uilt-in OHCI controller present on the
+	  Atheros AR71XX/AR724X SoCs.
+
 config USB_OHCI_HCD_PPC_SOC
 	bool "OHCI support for on-chip PPC USB controller"
 	depends on USB_OHCI_HCD && (STB03xxx || PPC_MPC52xx)
drivers/usb/host/ohci-ath79.c new file +162 -0

162 lines not on this page · raw message

drivers/usb/host/ohci-hcd.c +5 -0
index 5179acb..6daeb68 100644
@@ -1111,6 +1111,11 @@ MODULE_LICENSE ("GPL");
 #define PLATFORM_DRIVER		ohci_octeon_driver
 #endif
 
+#ifdef CONFIG_USB_OHCI_ATH79
+#include "ohci-ath79.c"
+#define PLATFORM_DRIVER		ohci_hcd_ath79_driver
+#endif
+
 #if	!defined(PCI_DRIVER) &&		\
 	!defined(PLATFORM_DRIVER) &&	\
 	!defined(OMAP1_PLATFORM_DRIVER) &&	\
Signature · 1 line
1.7.2.1
#24 lore raw

PATCH v5 14/16 MIPS: ath79: add common USB Host Controller device

In reply to Gabor Juhos

Add common platform_device and helper code to make the registration of the built-in USB controllers easier on the board which are using them. Also register the USB controller on the PB44 board.

---
Changes since RFC: ---

Changes since v1:
- rebased against 2.6.37-rc7

Changes since v2:
- don't use __init for function declarations

Changes since v3:
- rebased against 2.6.37-rc8

Changes since v4: ---

 arch/mips/ath79/Kconfig                        |    4 +
 arch/mips/ath79/Makefile                       |    1 +
 arch/mips/ath79/dev-usb.c                      |  194 ++++++++++++++++++++++++
 arch/mips/ath79/dev-usb.h                      |   17 ++
 arch/mips/ath79/mach-pb44.c                    |    2 +
 arch/mips/include/asm/mach-ath79/ar71xx_regs.h |   22 +++-
 6 files changed, 239 insertions(+), 1 deletions(-)
 create mode 100644 arch/mips/ath79/dev-usb.c
 create mode 100644 arch/mips/ath79/dev-usb.h
arch/mips/ath79/Kconfig +4 -0
index d4456ce..5d67942 100644
@@ -8,6 +8,7 @@ config ATH79_MACH_PB44
 	select ATH79_DEV_GPIO_BUTTONS
 	select ATH79_DEV_LEDS_GPIO
 	select ATH79_DEV_SPI
+	select ATH79_DEV_USB
 	help
 	  Say 'Y' here if you want your kernel to support the
 	  Atheros PB44 reference board.
@@ -37,4 +38,7 @@ config ATH79_DEV_LEDS_GPIO
 config ATH79_DEV_SPI
 	def_bool n
 
+config ATH79_DEV_USB
+	def_bool n
+
 endif
arch/mips/ath79/Makefile +1 -0
index 42f4295..563e235 100644
@@ -19,6 +19,7 @@ obj-y					+= dev-common.o
 obj-$(CONFIG_ATH79_DEV_GPIO_BUTTONS)	+= dev-gpio-buttons.o
 obj-$(CONFIG_ATH79_DEV_LEDS_GPIO)	+= dev-leds-gpio.o
 obj-$(CONFIG_ATH79_DEV_SPI)		+= dev-spi.o
+obj-$(CONFIG_ATH79_DEV_USB)		+= dev-usb.o
 
 #
 # Machines
arch/mips/ath79/dev-usb.c new file +194 -0

194 lines not on this page · raw message

arch/mips/ath79/dev-usb.h new file +17 -0
new file mode 100644
index 0000000..4b86a69
@@ -0,0 +1,17 @@
+/*
+ *  Atheros AR71XX/AR724X/AR913X USB Host Controller support
+ *
+ *  Copyright (C) 2008-2010 Gabor Juhos <[email protected]>
+ *  Copyright (C) 2008 Imre Kaloz <[email protected]>
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+ */
+
+#ifndef _ATH79_DEV_USB_H
+#define _ATH79_DEV_USB_H
+
+void ath79_register_usb(void);
+
+#endif /* _ATH79_DEV_USB_H */
arch/mips/ath79/mach-pb44.c +2 -0
index ec7b7a1..fe9701a 100644
@@ -18,6 +18,7 @@
 #include "dev-gpio-buttons.h"
 #include "dev-leds-gpio.h"
 #include "dev-spi.h"
+#include "dev-usb.h"
 
 #define PB44_GPIO_I2C_SCL	0
 #define PB44_GPIO_I2C_SDA	1
@@ -112,6 +113,7 @@ static void __init pb44_init(void)
 					pb44_gpio_keys);
 	ath79_register_spi(&pb44_spi_data, pb44_spi_info,
 			   ARRAY_SIZE(pb44_spi_info));
+	ath79_register_usb();
 }
 
 MIPS_MACHINE(ATH79_MACH_PB44, "PB44", "Atheros PB44 reference board",
arch/mips/include/asm/mach-ath79/ar71xx_regs.h +21 -1
index 4f2b621..f125f1e 100644
@@ -20,6 +20,10 @@
 #include <linux/bitops.h>
 
 #define AR71XX_APB_BASE		0x18000000
+#define AR71XX_EHCI_BASE	0x1b000000
+#define AR71XX_EHCI_SIZE	0x1000
+#define AR71XX_OHCI_BASE	0x1c000000
+#define AR71XX_OHCI_SIZE	0x1000
 #define AR71XX_SPI_BASE		0x1f000000
 #define AR71XX_SPI_SIZE		0x01000000
 
@@ -27,6 +31,8 @@
 #define AR71XX_DDR_CTRL_SIZE	0x100
 #define AR71XX_UART_BASE	(AR71XX_APB_BASE + 0x00020000)
 #define AR71XX_UART_SIZE	0x100
+#define AR71XX_USB_CTRL_BASE	(AR71XX_APB_BASE + 0x00030000)
+#define AR71XX_USB_CTRL_SIZE	0x100
 #define AR71XX_GPIO_BASE        (AR71XX_APB_BASE + 0x00040000)
 #define AR71XX_GPIO_SIZE        0x100
 #define AR71XX_PLL_BASE		(AR71XX_APB_BASE + 0x00050000)
@@ -34,6 +40,9 @@
 #define AR71XX_RESET_BASE	(AR71XX_APB_BASE + 0x00060000)
 #define AR71XX_RESET_SIZE	0x100
 
+#define AR7240_OHCI_BASE	0x1b000000
+#define AR7240_OHCI_SIZE	0x1000
+
 /*
  * DDR_CTRL block
  */
@@ -102,6 +111,12 @@
 #define AR913X_AHB_DIV_MASK		0x1
 
 /*
+ * USB_CONFIG block
+ */
+#define AR71XX_USB_CTRL_REG_FLADJ	0x00
+#define AR71XX_USB_CTRL_REG_CONFIG	0x04
+
+/*
  * RESET block
  */
 #define AR71XX_RESET_REG_TIMER			0x00
@@ -155,12 +170,17 @@
 #define AR71XX_RESET_PCI_BUS		BIT(1)
 #define AR71XX_RESET_PCI_CORE		BIT(0)
 
+#define AR7240_RESET_USB_HOST		BIT(5)
+#define AR7240_RESET_OHCI_DLL		BIT(3)
+
 #define AR724X_RESET_GE1_MDIO		BIT(23)
 #define AR724X_RESET_GE0_MDIO		BIT(22)
 #define AR724X_RESET_PCIE_PHY_SERIAL	BIT(10)
 #define AR724X_RESET_PCIE_PHY		BIT(7)
 #define AR724X_RESET_PCIE		BIT(6)
-#define AR724X_RESET_OHCI_DLL		BIT(3)
+#define AR724X_RESET_USB_HOST		BIT(5)
+#define AR724X_RESET_USB_PHY		BIT(4)
+#define AR724X_RESET_USBSUS_OVERRIDE	BIT(3)
 
 #define AR913X_RESET_AMBA2WMAC		BIT(22)
 
Signature · 1 line
1.7.2.1
Applied
#25 lore raw

Re: [PATCH v5 14/16] MIPS: ath79: add common USB Host Controller device

Thanks, applied.

Ralf

#26 lore raw

PATCH v5 15/16 MIPS: ath79: add initial support for the Atheros AP81 reference board

In reply to Gabor Juhos

---
Changes since RFC:
- don't use 'default n' for the ATH79_MACH_AP81 Kconfig option

Changes since v1:
- rebased against 2.6.37-rc7

Changes since v2: ---

Changes since v3:
- rebased against 2.6.37-rc8

Changes since v4: ---

 arch/mips/ath79/Kconfig     |   11 +++++
 arch/mips/ath79/Makefile    |    1 +
 arch/mips/ath79/mach-ap81.c |   94 +++++++++++++++++++++++++++++++++++++++++++
 arch/mips/ath79/machtypes.h |    1 +
 4 files changed, 107 insertions(+), 0 deletions(-)
 create mode 100644 arch/mips/ath79/mach-ap81.c
arch/mips/ath79/Kconfig +11 -0
index 5d67942..1912d54 100644
@@ -2,6 +2,17 @@ if ATH79
 
 menu "Atheros AR71XX/AR724X/AR913X machine selection"
 
+config ATH79_MACH_AP81
+	bool "Atheros AP81 reference board"
+	select SOC_AR913X
+	select ATH79_DEV_GPIO_BUTTONS
+	select ATH79_DEV_LEDS_GPIO
+	select ATH79_DEV_SPI
+	select ATH79_DEV_USB
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Atheros AP81 reference board.
+
 config ATH79_MACH_PB44
 	bool "Atheros PB44 reference board"
 	select SOC_AR71XX
arch/mips/ath79/Makefile +1 -0
index 563e235..3d74e1c 100644
@@ -24,4 +24,5 @@ obj-$(CONFIG_ATH79_DEV_USB)		+= dev-usb.o
 #
 # Machines
 #
+obj-$(CONFIG_ATH79_MACH_AP81)		+= mach-ap81.o
 obj-$(CONFIG_ATH79_MACH_PB44)		+= mach-pb44.o
arch/mips/ath79/mach-ap81.c new file +94 -0

94 lines not on this page · raw message

arch/mips/ath79/machtypes.h +1 -0
index a796fa3..3940fe4 100644
@@ -16,6 +16,7 @@
 
 enum ath79_mach_type {
 	ATH79_MACH_GENERIC = 0,
+	ATH79_MACH_AP81,		/* Atheros AP81 reference board */
 	ATH79_MACH_PB44,		/* Atheros PB44 reference board */
 };
 
Signature · 1 line
1.7.2.1
Applied
#27 lore raw

Re: [PATCH v5 15/16] MIPS: ath79: add initial support for the Atheros AP81 reference board

Thanks, applied.

Ralf

#28 lore raw

PATCH v5 16/16 MIPS: ath79: add common WMAC device for AR913X based boards

In reply to Gabor Juhos

Add common platform_device and helper code to make the registration of the built-in wireless MAC easier on the Atheros AR9130/AR9132 based boards. Also register the WMAC device on the AR81 board.

---
Changes since RFC: ---

Changes since v1:
- rebased against 2.6.37-rc7

Changes since v2:
- don't use __init for function declarations

Changes since v3:
- rebased against 2.6.37-rc8

Changes since v4: ---

 arch/mips/ath79/Kconfig                        |    5 ++
 arch/mips/ath79/Makefile                       |    1 +
 arch/mips/ath79/dev-ar913x-wmac.c              |   60 ++++++++++++++++++++++++
 arch/mips/ath79/dev-ar913x-wmac.h              |   17 +++++++
 arch/mips/ath79/mach-ap81.c                    |    6 ++
 arch/mips/include/asm/mach-ath79/ar71xx_regs.h |    3 +
 6 files changed, 92 insertions(+), 0 deletions(-)
 create mode 100644 arch/mips/ath79/dev-ar913x-wmac.c
 create mode 100644 arch/mips/ath79/dev-ar913x-wmac.h
arch/mips/ath79/Kconfig +5 -0
index 1912d54..af01669 100644
@@ -5,6 +5,7 @@ menu "Atheros AR71XX/AR724X/AR913X machine selection"
 config ATH79_MACH_AP81
 	bool "Atheros AP81 reference board"
 	select SOC_AR913X
+	select ATH79_DEV_AR913X_WMAC
 	select ATH79_DEV_GPIO_BUTTONS
 	select ATH79_DEV_LEDS_GPIO
 	select ATH79_DEV_SPI
@@ -40,6 +41,10 @@ config SOC_AR913X
 	select USB_ARCH_HAS_EHCI
 	def_bool n
 
+config ATH79_DEV_AR913X_WMAC
+	depends on SOC_AR913X
+	def_bool n
+
 config ATH79_DEV_GPIO_BUTTONS
 	def_bool n
 
arch/mips/ath79/Makefile +1 -0
index 3d74e1c..57188b6 100644
@@ -16,6 +16,7 @@ obj-$(CONFIG_EARLY_PRINTK)		+= early_printk.o
 # Devices
 #
 obj-y					+= dev-common.o
+obj-$(CONFIG_ATH79_DEV_AR913X_WMAC)	+= dev-ar913x-wmac.o
 obj-$(CONFIG_ATH79_DEV_GPIO_BUTTONS)	+= dev-gpio-buttons.o
 obj-$(CONFIG_ATH79_DEV_LEDS_GPIO)	+= dev-leds-gpio.o
 obj-$(CONFIG_ATH79_DEV_SPI)		+= dev-spi.o
arch/mips/ath79/dev-ar913x-wmac.c new file +60 -0

60 lines not on this page · raw message

arch/mips/ath79/dev-ar913x-wmac.h new file +17 -0
new file mode 100644
index 0000000..579d562
@@ -0,0 +1,17 @@
+/*
+ *  Atheros AR913X SoC built-in WMAC device support
+ *
+ *  Copyright (C) 2008-2010 Gabor Juhos <[email protected]>
+ *  Copyright (C) 2008 Imre Kaloz <[email protected]>
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+ */
+
+#ifndef _ATH79_DEV_AR913X_WMAC_H
+#define _ATH79_DEV_AR913X_WMAC_H
+
+void ath79_register_ar913x_wmac(u8 *cal_data);
+
+#endif /* _ATH79_DEV_AR913X_WMAC_H */
arch/mips/ath79/mach-ap81.c +6 -0
index 909ca5d..03719b8 100644
@@ -10,6 +10,7 @@
  */
 
 #include "machtypes.h"
+#include "dev-ar913x-wmac.h"
 #include "dev-gpio-buttons.h"
 #include "dev-leds-gpio.h"
 #include "dev-spi.h"
@@ -26,6 +27,8 @@
 #define AP81_KEYS_POLL_INTERVAL		20	/* msecs */
 #define AP81_KEYS_DEBOUNCE_INTERVAL	(3 * AP81_KEYS_POLL_INTERVAL)
 
+#define AP81_CAL_DATA_ADDR	0x1fff1000
+
 static struct gpio_led ap81_leds_gpio[] __initdata = {
 	{
 		.name		= "ap81:green:status",
@@ -80,6 +83,8 @@ static struct ath79_spi_platform_data ap81_spi_data = {
 
 static void __init ap81_setup(void)
 {
+	u8 *cal_data = (u8 *) KSEG1ADDR(AP81_CAL_DATA_ADDR);
+
 	ath79_register_leds_gpio(-1, ARRAY_SIZE(ap81_leds_gpio),
 				 ap81_leds_gpio);
 	ath79_register_gpio_keys_polled(-1, AP81_KEYS_POLL_INTERVAL,
@@ -88,6 +93,7 @@ static void __init ap81_setup(void)
 	ath79_register_spi(&ap81_spi_data, ap81_spi_info,
 			   ARRAY_SIZE(ap81_spi_info));
 	ath79_register_usb();
+	ath79_register_ar913x_wmac(cal_data);
 }
 
 MIPS_MACHINE(ATH79_MACH_AP81, "AP81", "Atheros AP81 reference board",
arch/mips/include/asm/mach-ath79/ar71xx_regs.h +3 -0
index f125f1e..9beb073 100644
@@ -43,6 +43,9 @@
 #define AR7240_OHCI_BASE	0x1b000000
 #define AR7240_OHCI_SIZE	0x1000
 
+#define AR913X_WMAC_BASE	(AR71XX_APB_BASE + 0x000C0000)
+#define AR913X_WMAC_SIZE	0x30000
+
 /*
  * DDR_CTRL block
  */
Signature · 1 line
1.7.2.1
Applied
#29 lore raw

Re: [PATCH v5 16/16] MIPS: ath79: add common WMAC device for AR913X based boards

Thanks, applied.

Ralf