xref: /openbmc/linux/arch/mips/loongson32/ls1b/board.c (revision 61f4d204)
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_eth0_pdev,
39 	&ls1x_eth1_pdev,
40 	&ls1x_ehci_pdev,
41 	&ls1x_gpio0_pdev,
42 	&ls1x_gpio1_pdev,
43 	&ls1x_rtc_pdev,
44 	&ls1x_wdt_pdev,
45 };
46 
47 static int __init ls1b_platform_init(void)
48 {
49 	ls1x_serial_set_uartclk(&ls1x_uart_pdev);
50 
51 	gpio_led_register_device(-1, &ls1x_led_pdata);
52 
53 	return platform_add_devices(ls1b_platform_devices,
54 				   ARRAY_SIZE(ls1b_platform_devices));
55 }
56 
57 arch_initcall(ls1b_platform_init);
58