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