core/linux-kirkwood - add NSA325

This commit is contained in:
Jason Plum 2013-09-21 08:15:36 -04:00
parent 7a3a11f5c9
commit 4004cc97b0
4 changed files with 349 additions and 7 deletions

View file

@ -9,7 +9,7 @@ pkgname=('linux-kirkwood' 'linux-headers-kirkwood')
_kernelname=${pkgname#linux}
_basekernel=3.11.1
pkgver=${_basekernel}
pkgrel=1
pkgrel=2
cryptover=1.6
bfqver=v6r2
uksmver="0.1.2.2"
@ -33,8 +33,8 @@ source=("ftp://ftp.kernel.org/pub/linux/kernel/v3.x/linux-${_basekernel}.tar.xz"
"http://algo.ing.unimo.it/people/paolo/disk_sched/patches/$(echo $_basekernel |cut -c 1-4).0-${bfqver}/0003-block-bfq-add-Early-Queue-Merge-EQM-to-BFQ-${bfqver}-for-$(echo $_basekernel |cut -c 1-4).0.patch")
md5sums=('466c042aa58d4839396443bf4438fdc5'
'738377b860fcb83fb653cfb8bf03265d'
'0484f0f6355e46332d888362564fe413'
'fc81175b156d9cce09cec61600de903b'
'580f50d328b821d78d13bd3de7e75af4'
'SKIP'
'65d5a4f313310bb2a732d022d51ea7e7'
'9b5a265440abf57d2052838f31486a3a'

View file

@ -1565,7 +1565,7 @@ diff -ruN a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
config MACH_RD88F6192_NAS
bool "Marvell RD-88F6192-NAS Reference Board"
help
@@ -124,6 +136,66 @@
@@ -124,6 +136,72 @@
QNAP TS-410, TS-410U, TS-419P, TS-419P+ and TS-419U Turbo
NAS devices.
@ -1628,6 +1628,12 @@ diff -ruN a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
+ help
+ Say 'Y' here if you want your kernel to support the
+ ZyXel NSA320.
+
+config MACH_NSA325
+ bool "ZyXEL NSA325 2-Bay Power Media Server"
+ help
+ Say 'Y' here if you want your kernel to support the
+ ZyXel NSA325.
+
comment "Device tree entries"
@ -1706,7 +1712,7 @@ diff -ruN a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
obj-$(CONFIG_MACH_INETSPACE_V2) += netspace_v2-setup.o lacie_v2-common.o
obj-$(CONFIG_MACH_MV88F6281GTW_GE) += mv88f6281gtw_ge-setup.o
obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
@@ -17,6 +18,17 @@
@@ -17,6 +18,18 @@
obj-$(CONFIG_MACH_T5325) += t5325-setup.o
obj-$(CONFIG_MACH_TS219) += ts219-setup.o tsx1x-common.o
obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o
@ -1721,6 +1727,7 @@ diff -ruN a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
+obj-$(CONFIG_MACH_BUBBA3) += bubba3-setup.o bubba3-gpio.o
+obj-$(CONFIG_MACH_NSA310) += nsa310-setup.o
+obj-$(CONFIG_MACH_NSA320) += nsa320-setup.o
+obj-$(CONFIG_MACH_NSA325) += nsa325-setup.o
obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o
obj-$(CONFIG_MACH_CLOUDBOX_DT) += board-ns2.o
@ -2580,7 +2587,7 @@ diff -ruN a/arch/arm/mach-kirkwood/nsa320-setup.c b/arch/arm/mach-kirkwood/nsa32
+
+ if (gpio_request(NSA320_GPIO_USB_POWER, "USB Power Enable") ||
+ gpio_direction_output(NSA320_GPIO_USB_POWER, usb_power))
+ pr_err("nsa320: failed to configure USB power enable GPIO)\n");
+ pr_err("nsa320: failed to configure USB power enable GPIO\n");
+ gpio_free(NSA320_GPIO_USB_POWER);
+
+ kirkwood_ehci_init();
@ -2602,6 +2609,340 @@ diff -ruN a/arch/arm/mach-kirkwood/nsa320-setup.c b/arch/arm/mach-kirkwood/nsa32
+ .init_time = kirkwood_timer_init,
+ .restart = kirkwood_restart,
+MACHINE_END
diff -rupN a/arch/arm/mach-kirkwood/nsa325-setup.c b/arch/arm/mach-kirkwood/nsa325-setup.c
--- a/arch/arm/mach-kirkwood/nsa325-setup.c 1969-12-31 19:00:00.000000000 -0500
+++ b/arch/arm/mach-kirkwood/nsa325-setup.c 2013-09-18 23:36:55.430043273 -0400
@@ -0,0 +1,330 @@
+/*
+ * arch/arm/mach-kirkwood/nsa325-setup.c
+ *
+ * ZyXEL NSA325 2-Bay Power Media Server Setup
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/mtd/nand.h>
+#include <linux/mtd/partitions.h>
+#include <linux/ata_platform.h>
+#include <linux/mv643xx_eth.h>
+#include <linux/i2c.h>
+#include <linux/gpio.h>
+#include <linux/gpio_keys.h>
+#include <linux/leds.h>
+#include <linux/pci.h>
+#include <linux/input.h>
+#include <linux/nsa3xx-hwmon.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <mach/kirkwood.h>
+#include <plat/orion-gpio.h>
+#include "common.h"
+#include "mpp.h"
+
+static struct mtd_partition nsa325_nand_parts[] = {
+ {
+ .name = "uboot",
+ .offset = 0,
+ .size = SZ_1M,
+ .mask_flags = MTD_WRITEABLE
+ }, {
+ .name = "uboot_env",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = SZ_512K
+ }, {
+ .name = "key_store",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = SZ_512K
+ }, {
+ .name = "info",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = SZ_512K
+ }, {
+ .name = "etc",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 10 * SZ_1M
+ }, {
+ .name = "kernel_1",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 10 * SZ_1M
+ }, {
+ .name = "rootfs1",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 48 * SZ_1M - SZ_256K
+ }, {
+ .name = "kernel_2",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 10 * SZ_1M
+ }, {
+ .name = "rootfs2",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 48 * SZ_1M - SZ_256K
+ },
+};
+
+static struct i2c_board_info __initdata nsa325_i2c_rtc = {
+ I2C_BOARD_INFO("pcf8563", 0x51),
+};
+
+static struct mv643xx_eth_platform_data nsa325_ge00_data = {
+ .phy_addr = MV643XX_ETH_PHY_ADDR(1),
+};
+
+static struct mv_sata_platform_data nsa325_sata_data = {
+ .n_ports = 2,
+};
+
+static struct gpio_keys_button nsa325_button_pins[] = {
+ {
+ .code = KEY_RESTART,
+ .gpio = 36,
+ .desc = "Reset",
+ .active_low = 1,
+ .debounce_interval = 1000,
+ }, {
+ .code = KEY_COPY,
+ .gpio = 37,
+ .desc = "Copy",
+ .active_low = 1,
+ .debounce_interval = 1000,
+ }, {
+ .code = KEY_POWER,
+ .gpio = 46,
+ .desc = "Power",
+ .active_low = 0,
+ .debounce_interval = 1000,
+ },
+};
+
+static struct gpio_keys_platform_data nsa325_button_data = {
+ .buttons = nsa325_button_pins,
+ .nbuttons = ARRAY_SIZE(nsa325_button_pins),
+};
+
+static struct platform_device nsa325_buttons = {
+ .name = "gpio-keys",
+ .id = -1,
+ .num_resources = 0,
+ .dev = {
+ .platform_data = &nsa325_button_data,
+ },
+};
+
+static struct gpio_led nsa325_led_pins[] = {
+ {
+ .name = "nsa325:green:hdd2",
+ .default_trigger = "ide-disk",
+ .gpio = 12,
+ .active_low = 0,
+ }, {
+ .name = "nsa325:red:hdd2",
+ .default_trigger = "default-off",
+ .gpio = 13,
+ .active_low = 0,
+ }, {
+ .name = "nsa325:green:usb",
+ .default_trigger = "default-off",
+ .gpio = 15,
+ .active_low = 0,
+ }, {
+ .name = "nsa325:green:sys",
+ .default_trigger = "default-off",
+ .gpio = 28,
+ .active_low = 0,
+ }, {
+ .name = "nsa325:orange:sys",
+ .default_trigger = "default-on",
+ .gpio = 29,
+ .active_low = 0,
+ }, {
+ .name = "nsa325:green:copy",
+ .default_trigger = "default-off",
+ .gpio = 39,
+ .active_low = 0,
+ }, {
+ .name = "nsa325:red:copy",
+ .default_trigger = "default-off",
+ .gpio = 40,
+ .active_low = 0,
+ }, {
+ .name = "nsa325:green:hdd1",
+ .default_trigger = "ide-disk",
+ .gpio = 41,
+ .active_low = 0,
+ }, {
+ .name = "nsa325:red:hdd1",
+ .default_trigger = "default-off",
+ .gpio = 42,
+ .active_low = 0,
+ },
+};
+
+static int nsa325_gpio_blink_set(unsigned gpio, int state,
+ unsigned long *delay_on, unsigned long *delay_off)
+{
+ switch(state) {
+ case GPIO_LED_NO_BLINK_LOW:
+ case GPIO_LED_NO_BLINK_HIGH:
+ orion_gpio_set_blink(gpio, 0);
+ gpio_set_value(gpio, state);
+ break;
+ case GPIO_LED_BLINK:
+ orion_gpio_set_blink(gpio, 1);
+ break;
+ }
+ return 0;
+}
+
+static struct gpio_led_platform_data nsa325_led_data = {
+ .leds = nsa325_led_pins,
+ .num_leds = ARRAY_SIZE(nsa325_led_pins),
+ .gpio_blink_set = nsa325_gpio_blink_set,
+};
+
+static struct platform_device nsa325_leds = {
+ .name = "leds-gpio",
+ .id = -1,
+ .dev = {
+ .platform_data = &nsa325_led_data,
+ },
+};
+
+static struct nsa3xx_hwmon_platform_data nsa325_hwmon_data = {
+ /* GPIOs connected to Holtek HT46R065 MCU */
+ .act_pin = 17,
+ .clk_pin = 16,
+ .data_pin = 14,
+};
+
+static struct platform_device nsa325_hwmon = {
+ .name = "nsa3xx-hwmon",
+ .id = -1,
+ .num_resources = 0,
+ .dev = {
+ .platform_data = &nsa325_hwmon_data,
+ },
+};
+
+static unsigned int nsa325_mpp_config[] __initdata = {
+ MPP8_TW0_SDA, /* PCF8563 RTC chip */
+ MPP9_TW0_SCK, /* connected to TWSI */
+ MPP12_GPO, /* HDD2 LED (green) */
+ MPP13_GPIO, /* ? HDD2 LED (red) ? */
+ MPP14_GPIO, /* MCU DATA pin (in) */
+ MPP15_GPIO, /* USB LED (green) */
+ MPP16_GPIO, /* MCU CLK pin (out) */
+ MPP17_GPIO, /* MCU ACT pin (out) */
+ MPP21_GPIO, /* USB power */
+ MPP28_GPIO, /* SYS LED (green) */
+ MPP29_GPIO, /* SYS LED (orange) */
+ MPP36_GPIO, /* reset button */
+ MPP37_GPIO, /* copy button */
+ MPP38_GPIO, /* VID B0 */
+ MPP39_GPIO, /* COPY LED (green) */
+ MPP40_GPIO, /* COPY LED (red) */
+ MPP41_GPIO, /* HDD1 LED (green) */
+ MPP42_GPIO, /* HDD1 LED (red) */
+ MPP43_GPIO, /* HTP pin */
+ MPP44_GPIO, /* buzzer */
+ MPP45_GPIO, /* VID B1 */
+ MPP46_GPIO, /* power button */
+ MPP47_GPIO, /* HDD2 power */
+ MPP48_GPIO, /* power off */
+ MPP49_GPIO, /* power resume clock */
+ 0
+};
+
+#define NSA325_GPIO_WATCHDOG 14
+#define NSA325_GPIO_USB_POWER 21
+#define NSA325_GPIO_HDD2_POWER 47
+#define NSA325_GPIO_POWER_OFF 48
+
+static void nsa325_power_off(void)
+{
+ gpio_set_value(NSA325_GPIO_POWER_OFF, 1);
+}
+
+static int __initdata usb_power = 1; /* default "on" */
+
+static int __init nsa325_usb_power(char *str)
+{
+ usb_power = strncmp(str, "off", 3) ? 1 : 0;
+ return 1;
+}
+/* Parse boot_command_line string nsa325_usb_power=on|off */
+__setup("nsa325_usb_power=", nsa325_usb_power);
+
+static void __init nsa325_init(void)
+{
+ /*
+ * Basic setup. Needs to be called early.
+ */
+ kirkwood_init();
+
+ kirkwood_mpp_conf(nsa325_mpp_config);
+ /* turn OFF the watchdog */
+ if (gpio_request(NSA325_GPIO_WATCHDOG, "Watchdog Disable") ||
+ gpio_direction_output(NSA325_GPIO_WATCHDOG,0))
+ pr_err("nsa325: failed to disable Watchdog via GPIO\n");
+ gpio_free(NSA325_GPIO_WATCHDOG);
+
+ kirkwood_uart0_init();
+ kirkwood_nand_init(ARRAY_AND_SIZE(nsa325_nand_parts), 40);
+ kirkwood_ge00_init(&nsa325_ge00_data);
+
+ /* turn on the second drive bay */
+ if (gpio_request(NSA325_GPIO_HDD2_POWER, "HDD2 Power Enable") ||
+ gpio_direction_output(NSA325_GPIO_HDD2_POWER,0))
+ pr_err("nsa325: failed to configure HDD2 power enable GPIO\n");
+ gpio_free(NSA325_GPIO_HDD2_POWER);
+
+ kirkwood_sata_init(&nsa325_sata_data);
+
+ platform_device_register(&nsa325_leds);
+ platform_device_register(&nsa325_buttons);
+ platform_device_register(&nsa325_hwmon);
+
+ kirkwood_i2c_init();
+ i2c_register_board_info(0, &nsa325_i2c_rtc, 1);
+
+ if (gpio_request(NSA325_GPIO_USB_POWER, "USB Power Enable") ||
+ gpio_direction_output(NSA325_GPIO_USB_POWER, usb_power))
+ pr_err("nsa325: failed to configure USB power enable GPIO\n");
+ gpio_free(NSA325_GPIO_USB_POWER);
+
+ kirkwood_ehci_init();
+
+ if (gpio_request(NSA325_GPIO_POWER_OFF, "power-off") ||
+ gpio_direction_output(NSA325_GPIO_POWER_OFF, 0))
+ pr_err("nsa325: failed to configure power-off GPIO\n");
+ else
+ pm_power_off = nsa325_power_off;
+}
+
+static int __init nsa325_pci_init(void)
+{
+ if (machine_is_nsa325())
+ kirkwood_pcie_init(KW_PCIE0);
+
+ return 0;
+}
+subsys_initcall(nsa325_pci_init);
+
+MACHINE_START(NSA325, "ZyXEL NSA325 2-Bay Power Media Server")
+ /* Maintainer: Jason Plum <max@warheads.net> */
+ .atag_offset = 0x100,
+ .init_machine = nsa325_init,
+ .map_io = kirkwood_map_io,
+ .init_early = kirkwood_init_early,
+ .init_irq = kirkwood_init_irq,
+ .init_time = kirkwood_timer_init,
+ .restart = kirkwood_restart,
+MACHINE_END
diff -ruN a/arch/arm/mach-kirkwood/pogo_e02-setup.c b/arch/arm/mach-kirkwood/pogo_e02-setup.c
--- a/arch/arm/mach-kirkwood/pogo_e02-setup.c 1969-12-31 17:00:00.000000000 -0700
+++ b/arch/arm/mach-kirkwood/pogo_e02-setup.c 2013-09-07 00:15:20.292272610 -0600

View file

@ -344,6 +344,7 @@ CONFIG_MACH_TOPKICK=y
CONFIG_MACH_IONICS_STRATUS=y
CONFIG_MACH_NSA310=y
CONFIG_MACH_NSA320=y
CONFIG_MACH_NSA325=y
#
# Device tree entries

View file

@ -2,7 +2,7 @@
# arg 2: the old package version
KERNEL_NAME=-kirkwood
KERNEL_VERSION=3.10.9-3-ARCH
KERNEL_VERSION=3.11.1-2-ARCH
post_install () {
# updating module dependencies