xref: /openbmc/linux/arch/mips/loongson32/ls1b/board.c (revision 09c434b8)
1 /*
2  * Copyright (c) 2011-2016 Zhang, Keguang <keguang.zhang@gmail.com>
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; either version 2 of the License, or (at your
7  * option) any later version.
8  */
9 
10 #include <linux/leds.h>
11 #include <linux/mtd/partitions.h>
12 #include <linux/sizes.h>
13 
14 #include <loongson1.h>
15 #include <dma.h>
16 #include <nand.h>
17 #include <platform.h>
18 
19 static const struct gpio_led ls1x_gpio_leds[] __initconst = {
20 	{
21 		.name			= "LED9",
22 		.default_trigger	= "heartbeat",
23 		.gpio			= 38,
24 		.active_low		= 1,
25 		.default_state		= LEDS_GPIO_DEFSTATE_OFF,
26 	}, {
27 		.name			= "LED6",
28 		.default_trigger	= "nand-disk",
29 		.gpio			= 39,
30 		.active_low		= 1,
31 		.default_state		= LEDS_GPIO_DEFSTATE_OFF,
32 	},
33 };
34 
35 static const struct gpio_led_platform_data ls1x_led_pdata __initconst = {
36 	.num_leds	= ARRAY_SIZE(ls1x_gpio_leds),
37 	.leds		= ls1x_gpio_leds,
38 };
39 
40 static struct platform_device *ls1b_platform_devices[] __initdata = {
41 	&ls1x_uart_pdev,
42 	&ls1x_cpufreq_pdev,
43 	&ls1x_eth0_pdev,
44 	&ls1x_eth1_pdev,
45 	&ls1x_ehci_pdev,
46 	&ls1x_gpio0_pdev,
47 	&ls1x_gpio1_pdev,
48 	&ls1x_rtc_pdev,
49 	&ls1x_wdt_pdev,
50 };
51 
52 static int __init ls1b_platform_init(void)
53 {
54 	ls1x_serial_set_uartclk(&ls1x_uart_pdev);
55 
56 	gpio_led_register_device(-1, &ls1x_led_pdata);
57 
58 	return platform_add_devices(ls1b_platform_devices,
59 				   ARRAY_SIZE(ls1b_platform_devices));
60 }
61 
62 arch_initcall(ls1b_platform_init);
63