2 * Bitmain Antminer S1 board support
4 * Copyright (C) 2015 L. D. Pinney <ldpinney@gmail.com>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
11 #include <linux/gpio.h>
13 #include <asm/mach-ath79/ath79.h>
14 #include <asm/mach-ath79/ar71xx_regs.h>
18 #include "dev-gpio-buttons.h"
19 #include "dev-leds-gpio.h"
20 #include "dev-m25p80.h"
22 #include "machtypes.h"
25 #define ANTMINER_S1_GPIO_BTN_RESET 11
27 #define ANTMINER_S1_GPIO_LED_SYSTEM 23
28 #define ANTMINER_S1_GPIO_LED_WLAN 0
29 #define ANTMINER_S1_GPIO_USB_POWER 26
31 #define ANTMINER_S1_KEYSPOLL_INTERVAL 20 /* msecs */
32 #define ANTMINER_S1_KEYSDEBOUNCE_INTERVAL (3 * ANTMINER_S1_KEYSPOLL_INTERVAL)
34 static const char *ANTMINER_S1_part_probes
[] = {
39 static struct flash_platform_data ANTMINER_S1_flash_data
= {
40 .part_probes
= ANTMINER_S1_part_probes
,
43 static struct gpio_led ANTMINER_S1_leds_gpio
[] __initdata
= {
45 .name
= "antminer-s1:green:system",
46 .gpio
= ANTMINER_S1_GPIO_LED_SYSTEM
,
49 .name
= "antminer-s1:green:wlan",
50 .gpio
= ANTMINER_S1_GPIO_LED_WLAN
,
55 static struct gpio_keys_button ANTMINER_S1_GPIO_keys
[] __initdata
= {
60 .debounce_interval
= ANTMINER_S1_KEYSDEBOUNCE_INTERVAL
,
61 .gpio
= ANTMINER_S1_GPIO_BTN_RESET
,
66 static void __init
antminer_s1_setup(void)
68 u8
*mac
= (u8
*) KSEG1ADDR(0x1f01fc00);
69 u8
*ee
= (u8
*) KSEG1ADDR(0x1fff1000);
71 /* disable PHY_SWAP and PHY_ADDR_SWAP bits */
72 ath79_setup_ar933x_phy4_switch(false, false);
74 ath79_register_leds_gpio(-1, ARRAY_SIZE(ANTMINER_S1_leds_gpio
),
75 ANTMINER_S1_leds_gpio
);
77 ath79_register_gpio_keys_polled(-1, ANTMINER_S1_KEYSPOLL_INTERVAL
,
78 ARRAY_SIZE(ANTMINER_S1_GPIO_keys
),
79 ANTMINER_S1_GPIO_keys
);
81 gpio_request_one(ANTMINER_S1_GPIO_USB_POWER
,
82 GPIOF_OUT_INIT_HIGH
| GPIOF_EXPORT_DIR_FIXED
,
86 ath79_register_m25p80(&ANTMINER_S1_flash_data
);
87 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac
, 1);
88 ath79_init_mac(ath79_eth1_data
.mac_addr
, mac
, -1);
90 ath79_register_mdio(0, 0x0);
91 ath79_register_eth(0);
92 ath79_register_eth(1);
94 ath79_register_wmac(ee
, mac
);
97 MIPS_MACHINE(ATH79_MACH_ANTMINER_S1
, "ANTMINER-S1",
98 "Antminer-S1", antminer_s1_setup
);