Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  * Copyright (c) 2011-2016 Zhang, Keguang <keguang.zhang@gmail.com>
0004  */
0005 
0006 #include <linux/leds.h>
0007 #include <linux/mtd/partitions.h>
0008 #include <linux/sizes.h>
0009 
0010 #include <loongson1.h>
0011 #include <dma.h>
0012 #include <nand.h>
0013 #include <platform.h>
0014 
0015 static const struct gpio_led ls1x_gpio_leds[] __initconst = {
0016     {
0017         .name           = "LED9",
0018         .default_trigger    = "heartbeat",
0019         .gpio           = 38,
0020         .active_low     = 1,
0021         .default_state      = LEDS_GPIO_DEFSTATE_OFF,
0022     }, {
0023         .name           = "LED6",
0024         .default_trigger    = "nand-disk",
0025         .gpio           = 39,
0026         .active_low     = 1,
0027         .default_state      = LEDS_GPIO_DEFSTATE_OFF,
0028     },
0029 };
0030 
0031 static const struct gpio_led_platform_data ls1x_led_pdata __initconst = {
0032     .num_leds   = ARRAY_SIZE(ls1x_gpio_leds),
0033     .leds       = ls1x_gpio_leds,
0034 };
0035 
0036 static struct platform_device *ls1b_platform_devices[] __initdata = {
0037     &ls1x_uart_pdev,
0038     &ls1x_cpufreq_pdev,
0039     &ls1x_eth0_pdev,
0040     &ls1x_eth1_pdev,
0041     &ls1x_ehci_pdev,
0042     &ls1x_gpio0_pdev,
0043     &ls1x_gpio1_pdev,
0044     &ls1x_rtc_pdev,
0045     &ls1x_wdt_pdev,
0046 };
0047 
0048 static int __init ls1b_platform_init(void)
0049 {
0050     ls1x_serial_set_uartclk(&ls1x_uart_pdev);
0051 
0052     gpio_led_register_device(-1, &ls1x_led_pdata);
0053 
0054     return platform_add_devices(ls1b_platform_devices,
0055                    ARRAY_SIZE(ls1b_platform_devices));
0056 }
0057 
0058 arch_initcall(ls1b_platform_init);