xref: /linux/arch/mips/loongson32/ls1b/board.c (revision 44f57d78)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (c) 2011-2016 Zhang, Keguang <keguang.zhang@gmail.com>
4  */
5 
6 #include <linux/leds.h>
7 #include <linux/mtd/partitions.h>
8 #include <linux/sizes.h>
9 
10 #include <loongson1.h>
11 #include <dma.h>
12 #include <nand.h>
13 #include <platform.h>
14 
15 static const struct gpio_led ls1x_gpio_leds[] __initconst = {
16 	{
17 		.name			= "LED9",
18 		.default_trigger	= "heartbeat",
19 		.gpio			= 38,
20 		.active_low		= 1,
21 		.default_state		= LEDS_GPIO_DEFSTATE_OFF,
22 	}, {
23 		.name			= "LED6",
24 		.default_trigger	= "nand-disk",
25 		.gpio			= 39,
26 		.active_low		= 1,
27 		.default_state		= LEDS_GPIO_DEFSTATE_OFF,
28 	},
29 };
30 
31 static const struct gpio_led_platform_data ls1x_led_pdata __initconst = {
32 	.num_leds	= ARRAY_SIZE(ls1x_gpio_leds),
33 	.leds		= ls1x_gpio_leds,
34 };
35 
36 static struct platform_device *ls1b_platform_devices[] __initdata = {
37 	&ls1x_uart_pdev,
38 	&ls1x_cpufreq_pdev,
39 	&ls1x_eth0_pdev,
40 	&ls1x_eth1_pdev,
41 	&ls1x_ehci_pdev,
42 	&ls1x_gpio0_pdev,
43 	&ls1x_gpio1_pdev,
44 	&ls1x_rtc_pdev,
45 	&ls1x_wdt_pdev,
46 };
47 
48 static int __init ls1b_platform_init(void)
49 {
50 	ls1x_serial_set_uartclk(&ls1x_uart_pdev);
51 
52 	gpio_led_register_device(-1, &ls1x_led_pdata);
53 
54 	return platform_add_devices(ls1b_platform_devices,
55 				   ARRAY_SIZE(ls1b_platform_devices));
56 }
57 
58 arch_initcall(ls1b_platform_init);
59