linux-3.11/linux-3.11-dns320l.patch
changeset 4 1b9d05c730cb
equal deleted inserted replaced
3:f2f1be1cc4ba 4:1b9d05c730cb
       
     1 diff -purN linux-3.11.orig/arch/arm/mach-kirkwood/common.c linux-3.11/arch/arm/mach-kirkwood/common.c
       
     2 --- linux-3.11.orig/arch/arm/mach-kirkwood/common.c	2013-09-02 22:46:10.000000000 +0200
       
     3 +++ linux-3.11/arch/arm/mach-kirkwood/common.c	2013-09-09 19:39:04.839177000 +0200
       
     4 @@ -665,6 +665,11 @@ char * __init kirkwood_id(void)
       
     5  			return "MV88F6282-Rev-A1";
       
     6  		else
       
     7  			return "MV88F6282-Rev-Unsupported";
       
     8 +    } else if (dev == MV88F6702_DEV_ID) {
       
     9 +        if (rev == MV88F6702_REV_A1)
       
    10 +            return "MV88F67-2-Rev-A1";
       
    11 +        else
       
    12 +            return "MV88F6702-Rev-Unsupported";			
       
    13  	} else {
       
    14  		return "Device-Unknown";
       
    15  	}
       
    16 diff -purN linux-3.11.orig/arch/arm/mach-kirkwood/dns320l-setup.c linux-3.11/arch/arm/mach-kirkwood/dns320l-setup.c
       
    17 --- linux-3.11.orig/arch/arm/mach-kirkwood/dns320l-setup.c	1970-01-01 01:00:00.000000000 +0100
       
    18 +++ linux-3.11/arch/arm/mach-kirkwood/dns320l-setup.c	2013-09-09 20:31:07.965673261 +0200
       
    19 @@ -0,0 +1,242 @@
       
    20 +/*
       
    21 + * arch/arm/mach-kirkwood/dns320l-setup.c
       
    22 + *
       
    23 + * D-Link DNS-320L Setup File
       
    24 + *
       
    25 + * This file is licensed under the terms of the GNU General Public
       
    26 + * License version 2.  This program is licensed "as is" without any
       
    27 + * warranty of any kind, whether express or implied.
       
    28 + */
       
    29 +
       
    30 +#include <linux/kernel.h>
       
    31 +#include <linux/init.h>
       
    32 +#include <linux/platform_device.h>
       
    33 +#include <linux/ata_platform.h>
       
    34 +#include <linux/mtd/partitions.h>
       
    35 +#include <linux/mv643xx_eth.h>
       
    36 +#include <linux/gpio.h>
       
    37 +#include <linux/leds.h>
       
    38 +#include <asm/mach-types.h>
       
    39 +#include <asm/mach/arch.h>
       
    40 +#include <mach/kirkwood.h>
       
    41 +#include "common.h"
       
    42 +#include "mpp.h"
       
    43 +#include <linux/sysfs.h>
       
    44 +#include <linux/kobject.h>
       
    45 +#include <linux/mtd/nand.h>
       
    46 +#include <linux/i2c.h>
       
    47 +#include <linux/gpio_keys.h>
       
    48 +#include <linux/gpio-fan.h>
       
    49 +#include <linux/input.h>
       
    50 +
       
    51 +#define DNS320L_GPIO_LED_SATA1_BLUE     20
       
    52 +#define DNS320L_GPIO_LED_SATA0_BLUE     21
       
    53 +#define DNS320L_GPIO_LED_SATA1_RED      22
       
    54 +#define DNS320L_GPIO_LED_SATA0_RED      23
       
    55 +#define DNS320L_GPIO_POWER_SATA         24
       
    56 +#define DNS320L_GPIO_LED_USB_BLUE       25
       
    57 +#define DNS320L_GPIO_LED_USB_ORANGE     26
       
    58 +#define DNS320L_GPIO_BUTTON_USB         27
       
    59 +#define DNS320L_GPIO_BUTTON_RESET       28
       
    60 +#define DNS320L_GPIO_BUTTON_POWER       29
       
    61 +
       
    62 +static struct mtd_partition dns320l_nand_parts[] = {
       
    63 +	{
       
    64 +		.name = "u-boot",
       
    65 +		.offset = 0,
       
    66 +		.size = SZ_1M
       
    67 +	}, {
       
    68 +		.name = "uImage",
       
    69 +		.offset = MTDPART_OFS_NXTBLK,
       
    70 +		.size = 5 * SZ_1M
       
    71 +	}, {
       
    72 +		.name = "ramdisk",
       
    73 +		.offset = MTDPART_OFS_NXTBLK,
       
    74 +		.size = 5 * SZ_1M
       
    75 +	}, {
       
    76 +		.name = "image",
       
    77 +		.offset = MTDPART_OFS_NXTBLK,
       
    78 +		.size = 100 * SZ_1M
       
    79 +	}, {
       
    80 +	    .name = "rescue firmware",
       
    81 +	    .offset = MTDPART_OFS_NXTBLK,
       
    82 +	    .size = 10 * SZ_1M
       
    83 +	}, {
       
    84 +	    .name = "config",
       
    85 +	    .offset = MTDPART_OFS_NXTBLK,
       
    86 +	    .size = 5 * SZ_1M
       
    87 +	}, {
       
    88 +	    .name = "my-dlink",
       
    89 +	    .offset = MTDPART_OFS_NXTBLK,
       
    90 +	    .size = 2 * SZ_1M
       
    91 +	},
       
    92 +};
       
    93 +
       
    94 +
       
    95 +static struct mv643xx_eth_platform_data dns320l_ge00_data = {
       
    96 +	.phy_addr	= MV643XX_ETH_PHY_ADDR(0),
       
    97 +};
       
    98 +
       
    99 +static struct mv_sata_platform_data dns320l_sata_data = {
       
   100 +	.n_ports	= 2,
       
   101 +};
       
   102 +
       
   103 +static void __init dns320l_gpio_register_output(unsigned gpio, char *name, int def)
       
   104 +{
       
   105 +	if (gpio_request(gpio, name) == 0 &&
       
   106 +	    gpio_direction_output(gpio, 0) == 0) {
       
   107 +		gpio_set_value(gpio, def);
       
   108 +		if (gpio_export(gpio, 0) != 0)
       
   109 +			pr_err("dns320l: Failed to export GPIO %s\n", name);
       
   110 +	} else
       
   111 +		pr_err("dns320l: Failed to register %s\n", name);
       
   112 +}
       
   113 +
       
   114 +static void __init dns320l_gpio_register_input(unsigned gpio, char *name)
       
   115 +{
       
   116 +    if (gpio_request(gpio, name) == 0 && 
       
   117 +        gpio_direction_input(gpio) == 0) {
       
   118 +        if(gpio_export(gpio, 0) != 0)
       
   119 +            pr_err("dns320L: Failed to export GPIO %s\n", name);
       
   120 +    } else
       
   121 +        pr_err("dns32l: Failed to register %s\n", name);
       
   122 +}
       
   123 +
       
   124 +/*****************************************************************************
       
   125 + * Buttons
       
   126 + ****************************************************************************/
       
   127 +
       
   128 +static struct gpio_keys_button dns320l_button_pins[] = {
       
   129 +	{
       
   130 +		.code		= KEY_COPY,
       
   131 +		.type       = EV_KEY,
       
   132 +		.gpio		= DNS320L_GPIO_BUTTON_USB,
       
   133 +		.desc		= "USB Copy button",
       
   134 +		.active_low	= 1,
       
   135 +		.debounce_interval = 1000,
       
   136 +	},
       
   137 +	{
       
   138 +	    .code       = KEY_OPTION,
       
   139 +	    .type       = EV_KEY,
       
   140 +	    .gpio       = DNS320L_GPIO_BUTTON_RESET,
       
   141 +	    .desc       = "Reset Button",
       
   142 +	    .active_low = 1,
       
   143 +	    .debounce_interval = 1000,
       
   144 +	},
       
   145 +};
       
   146 +
       
   147 +static struct gpio_keys_platform_data dns320l_button_data = {
       
   148 +	.buttons	= dns320l_button_pins,
       
   149 +	.nbuttons	= ARRAY_SIZE(dns320l_button_pins),
       
   150 +};
       
   151 +
       
   152 +static struct platform_device dns320l_button_device = {
       
   153 +	.name		= "gpio-keys",
       
   154 +	.id		= -1,
       
   155 +	.dev		= {
       
   156 +		.platform_data	= &dns320l_button_data,
       
   157 +	}
       
   158 +};
       
   159 +
       
   160 +/*****************************************************************************
       
   161 + * LEDs
       
   162 + ****************************************************************************/
       
   163 +
       
   164 +static struct gpio_led dns320l_led_pins[] = {
       
   165 +	{
       
   166 +		.name	= "dns320l:blue:usb",
       
   167 +		.gpio	= DNS320L_GPIO_LED_USB_BLUE,
       
   168 +		.default_trigger = "default-on",
       
   169 +	},
       
   170 +	{
       
   171 +		.name	= "dns320l:orange:usb",
       
   172 +		.gpio	= DNS320L_GPIO_LED_USB_ORANGE,
       
   173 +	},
       
   174 +	{
       
   175 +	    .name   = "dns320l:blue:sata0",
       
   176 +	    .gpio   = DNS320L_GPIO_LED_SATA0_BLUE,
       
   177 +	    .default_trigger = "ide-disk"
       
   178 +	},
       
   179 +	{
       
   180 +	    .name   = "dns320l:blue:sata1",
       
   181 +	    .gpio   = DNS320L_GPIO_LED_SATA1_BLUE,
       
   182 +	    .default_trigger = "ide-disk"
       
   183 +	},
       
   184 +	{
       
   185 +	    .name   = "dns320l:red:sata0",
       
   186 +	    .gpio   = DNS320L_GPIO_LED_SATA0_RED,
       
   187 +	},
       
   188 +	{
       
   189 +	    .name   = "dns320l:red:sata1",
       
   190 +	    .gpio   = DNS320L_GPIO_LED_SATA1_RED,
       
   191 +	},
       
   192 +};
       
   193 +
       
   194 +static struct gpio_led_platform_data dns320l_led_data = {
       
   195 +	.num_leds	= ARRAY_SIZE(dns320l_led_pins),
       
   196 +	.leds		= dns320l_led_pins,
       
   197 +};
       
   198 +
       
   199 +static struct platform_device dns320l_led_device = {
       
   200 +	.name		= "leds-gpio",
       
   201 +	.id		= -1,
       
   202 +	.dev		= {
       
   203 +		.platform_data	= &dns320l_led_data,
       
   204 +	},
       
   205 +};
       
   206 +
       
   207 +/*****************************************************************************
       
   208 + * Fan
       
   209 + ****************************************************************************/
       
   210 +
       
   211 +static unsigned int dns320l_mpp_config[] __initdata = {
       
   212 +    MPP13_UART1_TXD,
       
   213 +	MPP14_UART1_RXD,
       
   214 +	MPP20_GPIO,    // SATA LED BLUE
       
   215 +	MPP21_GPIO,    // SATA LED BLUE
       
   216 +	MPP22_GPIO,    // SATA LED RED
       
   217 +	MPP23_GPIO,    // SATA LED RED
       
   218 +	MPP24_GPIO,    // SATA Power
       
   219 +	MPP25_GPIO,    // USB LED Blue
       
   220 +	MPP26_GPIO,	   // USB LED Orange
       
   221 +	MPP27_GPIO,	   // Button USB Copy
       
   222 +	MPP28_GPIO,	   // Button Reset
       
   223 +	MPP29_GPIO,	   // Button Power
       
   224 +	0
       
   225 +};
       
   226 +
       
   227 +static void __init dns320l_init(void)
       
   228 +{
       
   229 +    /*
       
   230 +     * Basic setup. Needs to be called early.
       
   231 +     */
       
   232 +    
       
   233 +    kirkwood_init();
       
   234 +    /* setup gpio pin select */
       
   235 +    kirkwood_mpp_conf(dns320l_mpp_config);
       
   236 +    kirkwood_uart0_init();
       
   237 +    kirkwood_uart1_init();
       
   238 +    kirkwood_nand_init(ARRAY_AND_SIZE(dns320l_nand_parts), 40);
       
   239 +
       
   240 +    kirkwood_ehci_init();
       
   241 +    kirkwood_i2c_init();
       
   242 +    kirkwood_ge00_init(&dns320l_ge00_data);
       
   243 +    platform_device_register(&dns320l_led_device);
       
   244 +	dns320l_gpio_register_output(DNS320L_GPIO_POWER_SATA, "dns320l:power:sata", 1);
       
   245 +	dns320l_gpio_register_input(DNS320L_GPIO_BUTTON_POWER, "dns320l:button:power");
       
   246 +    kirkwood_sata_init(&dns320l_sata_data);
       
   247 +    
       
   248 +    platform_device_register(&dns320l_button_device);
       
   249 +}
       
   250 +
       
   251 +MACHINE_START(DNS320L, "DNS-320L")
       
   252 +	/* Maintainer: Andreas Boehler <andreas@aboehler.at> */
       
   253 +	.atag_offset	= 0x00000100,
       
   254 +	.init_machine	= dns320l_init,
       
   255 +	.map_io		= kirkwood_map_io,
       
   256 +	.init_early	= kirkwood_init_early,
       
   257 +	.init_irq	= kirkwood_init_irq,
       
   258 +	.init_time		= kirkwood_timer_init,
       
   259 +	.restart      = kirkwood_restart,
       
   260 +MACHINE_END
       
   261 +
       
   262 diff -purN linux-3.11.orig/arch/arm/mach-kirkwood/include/mach/kirkwood.h linux-3.11/arch/arm/mach-kirkwood/include/mach/kirkwood.h
       
   263 --- linux-3.11.orig/arch/arm/mach-kirkwood/include/mach/kirkwood.h	2013-09-02 22:46:10.000000000 +0200
       
   264 +++ linux-3.11/arch/arm/mach-kirkwood/include/mach/kirkwood.h	2013-09-09 20:35:39.848991746 +0200
       
   265 @@ -139,4 +139,7 @@
       
   266  #define MV88F6282_DEV_ID	0x6282
       
   267  #define MV88F6282_REV_A0	0
       
   268  #define MV88F6282_REV_A1	1
       
   269 +
       
   270 +#define MV88F6702_DEV_ID    0x6702
       
   271 +#define MV88F6702_REV_A1    3
       
   272  #endif
       
   273 diff -purN linux-3.11.orig/arch/arm/mach-kirkwood/Kconfig linux-3.11/arch/arm/mach-kirkwood/Kconfig
       
   274 --- linux-3.11.orig/arch/arm/mach-kirkwood/Kconfig	2013-09-02 22:46:10.000000000 +0200
       
   275 +++ linux-3.11/arch/arm/mach-kirkwood/Kconfig	2013-09-09 19:40:16.162506000 +0200
       
   276 @@ -123,6 +123,12 @@ config MACH_TS41X
       
   277  	  Say 'Y' here if you want your kernel to support the
       
   278  	  QNAP TS-410, TS-410U, TS-419P, TS-419P+ and TS-419U Turbo
       
   279  	  NAS devices.
       
   280 +	  
       
   281 +config MACH_DNS320L
       
   282 +	bool "D-Link DNS-320L NAS"
       
   283 +	help
       
   284 +	  Say 'Y' here if you want your kernel to support the
       
   285 +	  D-Link DNS-320L.	  
       
   286  
       
   287  comment "Device tree entries"
       
   288  
       
   289 diff -purN linux-3.11.orig/arch/arm/mach-kirkwood/Makefile linux-3.11/arch/arm/mach-kirkwood/Makefile
       
   290 --- linux-3.11.orig/arch/arm/mach-kirkwood/Makefile	2013-09-02 22:46:10.000000000 +0200
       
   291 +++ linux-3.11/arch/arm/mach-kirkwood/Makefile	2013-09-09 19:40:34.945838000 +0200
       
   292 @@ -17,6 +17,7 @@ obj-$(CONFIG_MACH_SHEEVAPLUG)		+= sheeva
       
   293  obj-$(CONFIG_MACH_T5325)		+= t5325-setup.o
       
   294  obj-$(CONFIG_MACH_TS219)		+= ts219-setup.o tsx1x-common.o
       
   295  obj-$(CONFIG_MACH_TS41X)		+= ts41x-setup.o tsx1x-common.o
       
   296 +obj-$(CONFIG_MACH_DNS320L)       += dns320l-setup.o
       
   297  
       
   298  obj-$(CONFIG_ARCH_KIRKWOOD_DT)		+= board-dt.o
       
   299  obj-$(CONFIG_MACH_CLOUDBOX_DT)		+= board-ns2.o
       
   300 diff -purN linux-3.11.orig/arch/arm/mach-kirkwood/mpp.c linux-3.11/arch/arm/mach-kirkwood/mpp.c
       
   301 --- linux-3.11.orig/arch/arm/mach-kirkwood/mpp.c	2013-09-02 22:46:10.000000000 +0200
       
   302 +++ linux-3.11/arch/arm/mach-kirkwood/mpp.c	2013-09-09 19:39:36.232508000 +0200
       
   303 @@ -26,7 +26,8 @@ static unsigned int __init kirkwood_vari
       
   304  		return MPP_F6281_MASK;
       
   305  	if (dev == MV88F6282_DEV_ID)
       
   306  		return MPP_F6282_MASK;
       
   307 -	if (dev == MV88F6192_DEV_ID && rev >= MV88F6192_REV_A0)
       
   308 +	if ((dev == MV88F6192_DEV_ID && rev >= MV88F6192_REV_A0) ||
       
   309 +	    (dev == MV88F6702_DEV_ID))
       
   310  		return MPP_F6192_MASK;
       
   311  	if (dev == MV88F6180_DEV_ID)
       
   312  		return MPP_F6180_MASK;
       
   313 diff -purN linux-3.11.orig/arch/arm/tools/mach-types linux-3.11/arch/arm/tools/mach-types
       
   314 --- linux-3.11.orig/arch/arm/tools/mach-types	2013-09-02 22:46:10.000000000 +0200
       
   315 +++ linux-3.11/arch/arm/tools/mach-types	2013-09-09 19:43:44.112495000 +0200
       
   316 @@ -1007,3 +1007,4 @@ eco5_bx2		MACH_ECO5_BX2		ECO5_BX2		4572
       
   317  eukrea_cpuimx28sd	MACH_EUKREA_CPUIMX28SD	EUKREA_CPUIMX28SD	4573
       
   318  domotab			MACH_DOMOTAB		DOMOTAB			4574
       
   319  pfla03			MACH_PFLA03		PFLA03			4575
       
   320 +dns320l         MACH_DNS320L        DNS320L     4746