Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
arch
arm
mach-kirkwood
board-dnskw.c
Go to the documentation of this file.
1
/*
2
* Copyright 2012 (C), Jamie Lentin <
[email protected]
>
3
*
4
* arch/arm/mach-kirkwood/board-dnskw.c
5
*
6
* D-link DNS-320 & DNS-325 NAS Init for drivers not converted to
7
* flattened device tree yet.
8
*
9
* This file is licensed under the terms of the GNU General Public
10
* License version 2. This program is licensed "as is" without any
11
* warranty of any kind, whether express or implied.
12
*/
13
14
#include <linux/kernel.h>
15
#include <
linux/init.h
>
16
#include <
linux/platform_device.h
>
17
#include <
linux/mv643xx_eth.h
>
18
#include <
linux/gpio.h
>
19
#include "
common.h
"
20
#include "
mpp.h
"
21
22
static
struct
mv643xx_eth_platform_data
dnskw_ge00_data = {
23
.phy_addr =
MV643XX_ETH_PHY_ADDR
(8),
24
};
25
26
static
unsigned
int
dnskw_mpp_config[]
__initdata
= {
27
MPP13_UART1_TXD
,
/* Custom ... */
28
MPP14_UART1_RXD
,
/* ... Controller (DNS-320 only) */
29
MPP20_SATA1_ACTn
,
/* LED: White Right HDD */
30
MPP21_SATA0_ACTn
,
/* LED: White Left HDD */
31
MPP24_GPIO
,
32
MPP25_GPIO
,
33
MPP26_GPIO
,
/* LED: Power */
34
MPP27_GPIO
,
/* LED: Red Right HDD */
35
MPP28_GPIO
,
/* LED: Red Left HDD */
36
MPP29_GPIO
,
/* LED: Red USB (DNS-325 only) */
37
MPP30_GPIO
,
38
MPP31_GPIO
,
39
MPP32_GPIO
,
40
MPP33_GPO
,
41
MPP34_GPIO
,
/* Button: Front power */
42
MPP35_GPIO
,
/* LED: Red USB (DNS-320 only) */
43
MPP36_GPIO
,
/* Power: Turn off board */
44
MPP37_GPIO
,
/* Power: Turn back on after power failure */
45
MPP38_GPIO
,
46
MPP39_GPIO
,
/* Power: SATA0 */
47
MPP40_GPIO
,
/* Power: SATA1 */
48
MPP41_GPIO
,
/* SATA0 present */
49
MPP42_GPIO
,
/* SATA1 present */
50
MPP43_GPIO
,
/* LED: White USB */
51
MPP44_GPIO
,
/* Fan: Tachometer Pin */
52
MPP45_GPIO
,
/* Fan: high speed */
53
MPP46_GPIO
,
/* Fan: low speed */
54
MPP47_GPIO
,
/* Button: Back unmount */
55
MPP48_GPIO
,
/* Button: Back reset */
56
MPP49_GPIO
,
/* Temp Alarm (DNS-325) Pin of U5 (DNS-320) */
57
0
58
};
59
60
static
void
dnskw_power_off(
void
)
61
{
62
gpio_set_value
(36, 1);
63
}
64
65
/* Register any GPIO for output and set the value */
66
static
void
__init
dnskw_gpio_register(
unsigned
gpio
,
char
*
name
,
int
def)
67
{
68
if
(
gpio_request
(gpio, name) == 0 &&
69
gpio_direction_output
(gpio, 0) == 0) {
70
gpio_set_value
(gpio, def);
71
if
(gpio_export(gpio, 0) != 0)
72
pr_err
(
"dnskw: Failed to export GPIO %s\n"
, name);
73
}
else
74
pr_err
(
"dnskw: Failed to register %s\n"
, name);
75
}
76
77
void
__init
dnskw_init
(
void
)
78
{
79
kirkwood_mpp_conf
(dnskw_mpp_config);
80
81
kirkwood_ehci_init
();
82
kirkwood_ge00_init
(&dnskw_ge00_data);
83
84
/* Register power-off GPIO. */
85
if
(
gpio_request
(36,
"dnskw:power:off"
) == 0
86
&&
gpio_direction_output
(36, 0) == 0)
87
pm_power_off
= dnskw_power_off;
88
else
89
pr_err
(
"dnskw: failed to configure power-off GPIO\n"
);
90
91
/* Ensure power is supplied to both HDDs */
92
dnskw_gpio_register(39,
"dnskw:power:sata0"
, 1);
93
dnskw_gpio_register(40,
"dnskw:power:sata1"
, 1);
94
95
/* Set NAS to turn back on after a power failure */
96
dnskw_gpio_register(37,
"dnskw:power:recover"
, 1);
97
}
Generated on Thu Jan 10 2013 12:59:35 for Linux Kernel by
1.8.2