kernel.patches/3.2.34/lschlv2.patch

257 lines
6.1 KiB
Diff
Raw Normal View History

2012-11-24 17:08:51 +01:00
--- a/arch/arm/mach-kirkwood/include/mach/system.h
+++ b/arch/arm/mach-kirkwood/include/mach/system.h
@@ -9,6 +9,8 @@
#ifndef __ASM_ARCH_SYSTEM_H
#define __ASM_ARCH_SYSTEM_H
+#include <linux/io.h>
+#include <asm/proc-fns.h>
#include <mach/bridge-regs.h>
static inline void arch_idle(void)
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -87,6 +87,12 @@
Say 'Y' here if you want your kernel to support the
HP t5325 Thin Client.
+config MACH_LINKSTATION_CHLV2
+ bool "Buffalo LS-CHLv2 Series"
+ help
+ Say 'Y' here if you want your kernel to support the
+ Buffalo LS-CHLv2 Series.
+
endmenu
endif
--- a/arch/arm/mach-kirkwood/lschlv2-setup.c
+++ b/arch/arm/mach-kirkwood/lschlv2-setup.c
@@ -0,0 +1,210 @@
+/*
+ * arch/arm/mach-kirkwood/lschlv2-setup.c
+ *
+ * Buffalo LS Kirkwood Series 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/gpio.h>
+#include <linux/gpio_keys.h>
+#include <linux/init.h>
+#include <linux/input.h>
+#include <linux/leds.h>
+#include <linux/platform_device.h>
+#include <linux/ata_platform.h>
+#include <linux/mv643xx_eth.h>
+#include <linux/mtd/physmap.h>
+#include <linux/spi/flash.h>
+#include <linux/spi/spi.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include "include/mach/system.h"
+#include <mach/kirkwood.h>
+#include "common.h"
+#include "mpp.h"
+
+/*****************************************************************************
+ * 512KB SPI Flash on BOOT Device
+ ****************************************************************************/
+static struct mtd_partition lschlv2_partitions[] = {
+ {
+ .name = "u-boot",
+ .offset = 0x00000,
+ .size = 0x70000,
+ .mask_flags = MTD_WRITEABLE,
+ },
+ {
+ .name = "u-boot env",
+ .offset = MTDPART_OFS_APPEND,
+ .size = 0x10000,
+ }
+};
+
+static struct flash_platform_data lschlv2_spi_slave_data = {
+ .type = "m25p40",
+ .parts = lschlv2_partitions,
+ .nr_parts = ARRAY_SIZE(lschlv2_partitions),
+};
+
+static struct spi_board_info __initdata lschlv2_spi_slave_info[] = {
+ {
+ .modalias = "m25p80",
+ .platform_data = &lschlv2_spi_slave_data,
+ .irq = -1,
+ .max_speed_hz = 20000000,
+ .bus_num = 0,
+ .chip_select = 0,
+ }
+};
+
+static struct mv643xx_eth_platform_data lschlv2_ge00_data = {
+ .phy_addr = MV643XX_ETH_PHY_ADDR(0),
+};
+
+static struct mv643xx_eth_platform_data lschlv2_ge01_data = {
+ .phy_addr = MV643XX_ETH_PHY_ADDR(8),
+};
+
+static unsigned int lschlv2_mpp_config[] __initdata = {
+ MPP10_GPO, /* HDD Power */
+ MPP11_GPIO, /* USB Vbus Power */
+ MPP18_GPO, /* FAN High on:0, off:1 */
+ MPP19_GPO, /* FAN Low on:0, off:1 */
+ MPP36_GPIO, /* FUNC LED */
+ MPP37_GPIO, /* ALARM LED */
+ MPP38_GPIO, /* INFO LED */
+ MPP39_GPIO, /* POWER LED */
+ MPP40_GPIO, /* FAN LOCK */
+ MPP41_GPIO, /* FUNC SW */
+ MPP42_GPIO, /* POWER SW */
+ MPP43_GPIO, /* POWER AUTO SW */
+ MPP48_GPIO, /* FUNC RED LED */
+ MPP49_GPIO, /* UART EN */
+ 0
+};
+
+static struct mv_sata_platform_data lschlv2_sata_data = {
+ .n_ports = 1,
+};
+
+static struct gpio_led lschlv2_led_pins[] = {
+ {
+ .name = "func",
+ .gpio = 36,
+ .active_low = 1,
+ },
+ {
+ .name = "alarm",
+ .gpio = 37,
+ .active_low = 1,
+ },
+ {
+ .name = "info",
+ .gpio = 38,
+ .active_low = 1,
+ },
+ {
+ .name = "power",
+ .gpio = 39,
+ .default_trigger = "default-on",
+ .active_low = 1,
+ },
+ {
+ .name = "func2",
+ .gpio = 48,
+ .active_low = 1,
+ },
+};
+
+static struct gpio_led_platform_data lschlv2_led_data = {
+ .leds = lschlv2_led_pins,
+ .num_leds = ARRAY_SIZE(lschlv2_led_pins),
+};
+
+static struct platform_device lschlv2_leds = {
+ .name = "leds-gpio",
+ .id = -1,
+ .dev = {
+ .platform_data = &lschlv2_led_data,
+ }
+};
+
+#define LSCHLv2_GPIO_USB_VBUS_EN 11
+#define LSCHLv2_GPIO_KEY_FUNC 41
+
+static struct gpio_keys_button lschlv2_buttons[] = {
+ {
+ .code = KEY_OPTION,
+ .gpio = LSCHLv2_GPIO_KEY_FUNC,
+ .desc = "Function Button",
+ .active_low = 1,
+ },
+};
+
+static struct gpio_keys_platform_data lschlv2_button_data = {
+ .buttons = lschlv2_buttons,
+ .nbuttons = ARRAY_SIZE(lschlv2_buttons),
+};
+
+static struct platform_device lschlv2_button_device = {
+ .name = "gpio-keys",
+ .id = -1,
+ .num_resources = 0,
+ .dev = {
+ .platform_data = &lschlv2_button_data,
+ },
+};
+
+static void lschlv2_power_off(void)
+{
+ arch_reset(0, NULL);
+}
+
+static void __init lschlv2_init(void)
+{
+ /*
+ * Basic setup. Needs to be called early.
+ */
+ kirkwood_init();
+ kirkwood_mpp_conf(lschlv2_mpp_config);
+
+ kirkwood_uart0_init();
+
+ if (gpio_request(LSCHLv2_GPIO_USB_VBUS_EN, "USB Power Enable") != 0 ||
+ gpio_direction_output(LSCHLv2_GPIO_USB_VBUS_EN, 1) != 0)
+ printk(KERN_ERR "can't set up USB Power Enable\n");
+ kirkwood_ehci_init();
+
+ kirkwood_ge00_init(&lschlv2_ge00_data);
+ kirkwood_ge01_init(&lschlv2_ge01_data);
+
+ kirkwood_sata_init(&lschlv2_sata_data);
+
+ kirkwood_spi_init();
+
+ platform_device_register(&lschlv2_leds);
+ platform_device_register(&lschlv2_button_device);
+
+ spi_register_board_info(lschlv2_spi_slave_info,
+ ARRAY_SIZE(lschlv2_spi_slave_info));
+
+ /* register power-off method */
+ pm_power_off = lschlv2_power_off;
+
+ pr_info("%s: finished\n", __func__);
+}
+
+
+
+MACHINE_START(LINKSTATION_CHLV2, "Buffalo Linkstation LS-CHLv2")
+ .atag_offset = 0x100,
+ .init_machine = lschlv2_init,
+ .map_io = kirkwood_map_io,
+ .init_early = kirkwood_init_early,
+ .init_irq = kirkwood_init_irq,
+ .timer = &kirkwood_timer,
+MACHINE_END
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -20,3 +20,4 @@
obj-$(CONFIG_MACH_T5325) += t5325-setup.o
+obj-$(CONFIG_MACH_LINKSTATION_CHLV2) += lschlv2-setup.o
obj-$(CONFIG_CPU_IDLE) += cpuidle.o
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -32,6 +32,7 @@
#include <plat/orion_nand.h>
#include <plat/orion_wdt.h>
#include <plat/time.h>
+#include <asm/mach-types.h>
#include "common.h"
/*****************************************************************************