2 * jjPlus JWAP230 board support
4 * Copyright (C) 2016 Piotr Dymacz <pepe2k@gmail.com>
6 * Based on mach-wpj558.c and mach-tl-wr1043nd-v2.c
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 as published
10 * by the Free Software Foundation.
13 #include <linux/pci.h>
14 #include <linux/phy.h>
15 #include <linux/gpio.h>
16 #include <linux/platform_device.h>
17 #include <linux/ar8216_platform.h>
19 #include <asm/mach-ath79/ath79.h>
20 #include <asm/mach-ath79/ar71xx_regs.h>
23 #include "dev-ap9x-pci.h"
25 #include "dev-leds-gpio.h"
26 #include "dev-m25p80.h"
29 #include "machtypes.h"
32 #define JWAP230_GPIO_LED_LED1 23
33 #define JWAP230_GPIO_LED_LED2 22
34 #define JWAP230_GPIO_LED_LED3 21
36 #define JWAP230_MAC0_OFFSET 0x0
37 #define JWAP230_MAC1_OFFSET 0x6
38 #define JWAP230_WMAC_CALDATA_OFFSET 0x1000
40 static struct gpio_led jwap230_leds_gpio
[] __initdata
= {
42 .name
= "jwap230:green:led1",
43 .gpio
= JWAP230_GPIO_LED_LED1
,
47 .name
= "jwap230:green:led2",
48 .gpio
= JWAP230_GPIO_LED_LED2
,
52 .name
= "jwap230:green:led3",
53 .gpio
= JWAP230_GPIO_LED_LED3
,
58 static const struct ar8327_led_info jwap230_leds_qca8337
[] = {
59 AR8327_LED_INFO(PHY0_0
, HW
, "jwap230:green:lan"),
60 AR8327_LED_INFO(PHY4_0
, HW
, "jwap230:green:wan"),
63 /* Blink rate: 1 Gbps -> 8 hz, 100 Mbs -> 4 Hz, 10 Mbps -> 2 Hz */
64 static struct ar8327_led_cfg jwap230_qca8337_led_cfg
= {
65 .led_ctrl0
= 0xcf37cf37,
66 .led_ctrl1
= 0xcf37cf37,
67 .led_ctrl2
= 0xcf37cf37,
72 /* QCA8337 GMAC0 is connected with QCA9558 over RGMII */
73 static struct ar8327_pad_cfg jwap230_qca8337_pad0_cfg
= {
74 .mode
= AR8327_PAD_MAC_RGMII
,
75 .txclk_delay_en
= true,
76 .rxclk_delay_en
= true,
77 .txclk_delay_sel
= AR8327_CLK_DELAY_SEL1
,
78 .rxclk_delay_sel
= AR8327_CLK_DELAY_SEL2
,
79 .mac06_exchange_dis
= true,
82 /* QCA8337 GMAC6 is connected with QCA9558 over SGMII */
83 static struct ar8327_pad_cfg jwap230_qca8337_pad6_cfg
= {
84 .mode
= AR8327_PAD_MAC_SGMII
,
85 .sgmii_delay_en
= true,
86 .rxclk_delay_sel
= AR8327_CLK_DELAY_SEL0
,
89 static struct ar8327_platform_data jwap230_qca8337_data
= {
90 .pad0_cfg
= &jwap230_qca8337_pad0_cfg
,
91 .pad6_cfg
= &jwap230_qca8337_pad6_cfg
,
94 .speed
= AR8327_PORT_SPEED_1000
,
101 .speed
= AR8327_PORT_SPEED_1000
,
106 .led_cfg
= &jwap230_qca8337_led_cfg
,
107 .num_leds
= ARRAY_SIZE(jwap230_leds_qca8337
),
108 .leds
= jwap230_leds_qca8337
,
111 static struct mdio_board_info jwap230_mdio0_info
[] = {
113 .bus_id
= "ag71xx-mdio.0",
115 .platform_data
= &jwap230_qca8337_data
,
119 static void __init
jwap230_setup(void)
121 u8
*art
= (u8
*) KSEG1ADDR(0x1fff0000);
123 ath79_register_m25p80(NULL
);
125 ath79_register_leds_gpio(-1, ARRAY_SIZE(jwap230_leds_gpio
),
128 mdiobus_register_board_info(jwap230_mdio0_info
,
129 ARRAY_SIZE(jwap230_mdio0_info
));
130 ath79_register_mdio(0, 0x0);
132 ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN
);
134 /* QCA9558 GMAC0 is connected to RMGII interface */
135 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RGMII
;
136 ath79_eth0_data
.phy_mask
= BIT(0);
137 ath79_eth0_data
.mii_bus_dev
= &ath79_mdio0_device
.dev
;
138 ath79_eth0_pll_data
.pll_1000
= 0xa6000000;
140 ath79_init_mac(ath79_eth0_data
.mac_addr
, art
+ JWAP230_MAC0_OFFSET
, 0);
141 ath79_register_eth(0);
143 /* QCA9558 GMAC1 is connected to SGMII interface */
144 ath79_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_SGMII
;
145 ath79_eth1_data
.speed
= SPEED_1000
;
146 ath79_eth1_data
.duplex
= DUPLEX_FULL
;
147 ath79_eth1_pll_data
.pll_1000
= 0x03000101;
149 ath79_init_mac(ath79_eth1_data
.mac_addr
, art
+ JWAP230_MAC1_OFFSET
, 0);
150 ath79_register_eth(1);
152 ath79_register_wmac(art
+ JWAP230_WMAC_CALDATA_OFFSET
, NULL
);
154 ath79_register_pci();
155 ath79_register_usb();
158 MIPS_MACHINE(ATH79_MACH_JWAP230
, "JWAP230", "jjPlus JWAP230", jwap230_setup
);