From 0b6e32a7b0e4d303ae2eb6d4278d3c75421660b8 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 26 Mar 2010 22:35:52 +0000 Subject: ar71xx: add basic kernel support for pb92 SVN-Revision: 20495 --- target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig | 11 ++ .../linux/ar71xx/files/arch/mips/ar71xx/Makefile | 2 + .../ar71xx/files/arch/mips/ar71xx/dev-pb9x-pci.c | 33 ++++++ .../ar71xx/files/arch/mips/ar71xx/dev-pb9x-pci.h | 22 ++++ .../ar71xx/files/arch/mips/ar71xx/mach-pb92.c | 111 +++++++++++++++++++++ .../linux/ar71xx/files/arch/mips/ar71xx/machtype.h | 1 + 6 files changed, 180 insertions(+) create mode 100644 target/linux/ar71xx/files/arch/mips/ar71xx/dev-pb9x-pci.c create mode 100644 target/linux/ar71xx/files/arch/mips/ar71xx/dev-pb9x-pci.h create mode 100644 target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb92.c (limited to 'target/linux/ar71xx/files/arch/mips') diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig b/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig index 8149a54..427eda2 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig @@ -62,6 +62,14 @@ config AR71XX_MACH_PB44 select AR71XX_DEV_USB default n +config AR71XX_MACH_PB92 + bool "Atheros PB92 board support" + select AR71XX_DEV_GPIO_BUTTONS + select AR71XX_DEV_PB9X_PCI if PCI + select AR71XX_DEV_LEDS_GPIO + select AR71XX_DEV_USB + default n + config AR71XX_MACH_AW_NR580 bool "AzureWave AW-NR580 board support" select AR71XX_DEV_M25P80 @@ -236,6 +244,9 @@ config AR71XX_DEV_LEDS_GPIO config AR71XX_DEV_PB42_PCI def_bool n +config AR71XX_DEV_PB9X_PCI + def_bool n + config AR71XX_DEV_USB def_bool n diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile b/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile index ba348e3..e24df57 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile @@ -22,6 +22,7 @@ obj-$(CONFIG_AR71XX_DEV_GPIO_BUTTONS) += dev-gpio-buttons.o obj-$(CONFIG_AR71XX_DEV_LEDS_GPIO) += dev-leds-gpio.o obj-$(CONFIG_AR71XX_DEV_M25P80) += dev-m25p80.o obj-$(CONFIG_AR71XX_DEV_PB42_PCI) += dev-pb42-pci.o +obj-$(CONFIG_AR71XX_DEV_PB9X_PCI) += dev-pb9x-pci.o obj-$(CONFIG_AR71XX_DEV_USB) += dev-usb.o obj-$(CONFIG_AR71XX_NVRAM) += nvram.o @@ -36,6 +37,7 @@ obj-$(CONFIG_AR71XX_MACH_MZK_W04NU) += mach-mzk-w04nu.o obj-$(CONFIG_AR71XX_MACH_MZK_W300NH) += mach-mzk-w300nh.o obj-$(CONFIG_AR71XX_MACH_PB42) += mach-pb42.o obj-$(CONFIG_AR71XX_MACH_PB44) += mach-pb44.o +obj-$(CONFIG_AR71XX_MACH_PB92) += mach-pb92.o obj-$(CONFIG_AR71XX_MACH_RB4XX) += mach-rb4xx.o obj-$(CONFIG_AR71XX_MACH_RB750) += mach-rb750.o obj-$(CONFIG_AR71XX_MACH_TEW_632BRP) += mach-tew-632brp.o diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/dev-pb9x-pci.c b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-pb9x-pci.c new file mode 100644 index 0000000..762bd55 --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-pb9x-pci.c @@ -0,0 +1,33 @@ +/* + * Atheros PB9x reference board PCI initialization + * + * Copyright (C) 2010 Felix Fietkau + * Copyright (C) 2008-2009 Gabor Juhos + * Copyright (C) 2008 Imre Kaloz + * + * 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. + */ + +#include + +#include +#include + +#include "dev-pb9x-pci.h" + +static struct ar71xx_pci_irq pb9x_pci_irqs[] __initdata = { + { + .slot = 0, + .pin = 1, + .irq = AR71XX_PCI_IRQ_DEV0, + } +}; + +void __init pb9x_pci_init(void) +{ + ar71xx_pci_init(ARRAY_SIZE(pb9x_pci_irqs), pb9x_pci_irqs); +} diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/dev-pb9x-pci.h b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-pb9x-pci.h new file mode 100644 index 0000000..be53f0a --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-pb9x-pci.h @@ -0,0 +1,22 @@ +/* + * Atheros PB9x reference board PCI initialization + * + * Copyright (C) 2010 Felix Fietkau + * Copyright (C) 2008-2009 Gabor Juhos + * Copyright (C) 2008 Imre Kaloz + * + * 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 _AR71XX_DEV_PB9X_PCI_H +#define _AR71XX_DEV_PB9X_PCI_H + +#if defined(CONFIG_AR71XX_DEV_PB9X_PCI) +void pb9x_pci_init(void) __init; +#else +static inline void pb9x_pci_init(void) { } +#endif + +#endif /* _AR71XX_DEV_PB9X_PCI_H */ diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb92.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb92.c new file mode 100644 index 0000000..e368895 --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb92.c @@ -0,0 +1,111 @@ +/* + * Atheros PB92 board support + * + * Copyright (C) 2010 Felix Fietkau + * Copyright (C) 2008-2009 Gabor Juhos + * Copyright (C) 2008 Imre Kaloz + * + * 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 +#include +#include + +#include "machtype.h" +#include "devices.h" +#include "dev-m25p80.h" +#include "dev-gpio-buttons.h" +#include "dev-pb9x-pci.h" +#include "dev-usb.h" + +#ifdef CONFIG_MTD_PARTITIONS +static struct mtd_partition pb92_partitions[] = { + { + .name = "u-boot", + .offset = 0, + .size = 0x040000, + .mask_flags = MTD_WRITEABLE, + } , { + .name = "u-boot-env", + .offset = 0x040000, + .size = 0x010000, + } , { + .name = "rootfs", + .offset = 0x050000, + .size = 0x2b0000, + } , { + .name = "uImage", + .offset = 0x300000, + .size = 0x0e0000, + } , { + .name = "ART", + .offset = 0x3e0000, + .size = 0x020000, + .mask_flags = MTD_WRITEABLE, + } +}; +#endif /* CONFIG_MTD_PARTITIONS */ + +static struct flash_platform_data pb92_flash_data = { +#ifdef CONFIG_MTD_PARTITIONS + .parts = pb92_partitions, + .nr_parts = ARRAY_SIZE(pb92_partitions), +#endif +}; + + +#define PB92_BUTTONS_POLL_INTERVAL 20 + +#define PB92_GPIO_BTN_SW4 8 +#define PB92_GPIO_BTN_SW5 3 + +static struct gpio_button pb92_gpio_buttons[] __initdata = { + { + .desc = "sw4", + .type = EV_KEY, + .code = BTN_0, + .threshold = 3, + .gpio = PB92_GPIO_BTN_SW4, + .active_low = 1, + } , { + .desc = "sw5", + .type = EV_KEY, + .code = BTN_1, + .threshold = 3, + .gpio = PB92_GPIO_BTN_SW5, + .active_low = 1, + } +}; + +#define PB92_WAN_PHYMASK BIT(20) +#define PB92_LAN_PHYMASK (BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4)) +#define PB92_MDIO_PHYMASK (PB92_LAN_PHYMASK | PB92_WAN_PHYMASK) + +static void __init pb92_init(void) +{ + ar71xx_add_device_m25p80(&pb92_flash_data); + + ar71xx_add_device_mdio(~PB92_MDIO_PHYMASK); + + ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; + ar71xx_eth0_data.phy_mask = PB92_WAN_PHYMASK; + + ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; + ar71xx_eth1_data.phy_mask = PB92_LAN_PHYMASK; + ar71xx_eth1_data.speed = SPEED_1000; + ar71xx_eth1_data.duplex = DUPLEX_FULL; + + ar71xx_add_device_eth(0); + ar71xx_add_device_eth(1); + + ar71xx_add_device_gpio_buttons(-1, PB92_BUTTONS_POLL_INTERVAL, + ARRAY_SIZE(pb92_gpio_buttons), + pb92_gpio_buttons); + + pb9x_pci_init(); +} + +MIPS_MACHINE(AR71XX_MACH_PB92, "PB92", "Atheros PB92", pb92_init); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h b/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h index 419cbd4..a8679d9 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h @@ -32,6 +32,7 @@ enum ar71xx_mach_type { AR71XX_MACH_RB_750, /* MikroTik RouterBOARD 750 */ AR71XX_MACH_PB42, /* Atheros PB42 */ AR71XX_MACH_PB44, /* Atheros PB44 */ + AR71XX_MACH_PB92, /* Atheros PB92 */ AR71XX_MACH_MZK_W04NU, /* Planex MZK-W04NU */ AR71XX_MACH_MZK_W300NH, /* Planex MZK-W300NH */ AR71XX_MACH_TEW_632BRP, /* TRENDnet TEW-632BRP */ -- cgit v1.1