2 * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com>
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
10 #include <linux/clk.h>
11 #include <linux/dma-mapping.h>
12 #include <linux/err.h>
13 #include <linux/phy.h>
14 #include <linux/serial_8250.h>
15 #include <linux/stmmac.h>
16 #include <linux/usb/ehci_pdriver.h>
17 #include <asm-generic/sizes.h>
19 #include <loongson1.h>
21 #define LS1X_UART(_id) \
23 .mapbase = LS1X_UART ## _id ## _BASE, \
24 .irq = LS1X_UART ## _id ## _IRQ, \
26 .flags = UPF_IOREMAP | UPF_FIXED_TYPE, \
27 .type = PORT_16550A, \
30 static struct plat_serial8250_port ls1x_serial8250_port
[] = {
38 struct platform_device ls1x_uart_device
= {
40 .id
= PLAT8250_DEV_PLATFORM
,
42 .platform_data
= ls1x_serial8250_port
,
46 void __init
ls1x_serial_setup(struct platform_device
*pdev
)
49 struct plat_serial8250_port
*p
;
51 clk
= clk_get(NULL
, pdev
->name
);
53 panic("unable to get %s clock, err=%ld",
54 pdev
->name
, PTR_ERR(clk
));
56 for (p
= pdev
->dev
.platform_data
; p
->flags
!= 0; ++p
)
57 p
->uartclk
= clk_get_rate(clk
);
60 /* Synopsys Ethernet GMAC */
61 static struct resource ls1x_eth0_resources
[] = {
63 .start
= LS1X_GMAC0_BASE
,
64 .end
= LS1X_GMAC0_BASE
+ SZ_64K
- 1,
65 .flags
= IORESOURCE_MEM
,
69 .start
= LS1X_GMAC0_IRQ
,
70 .flags
= IORESOURCE_IRQ
,
74 static struct stmmac_mdio_bus_data ls1x_mdio_bus_data
= {
78 static struct plat_stmmacenet_data ls1x_eth_data
= {
81 .mdio_bus_data
= &ls1x_mdio_bus_data
,
86 struct platform_device ls1x_eth0_device
= {
89 .num_resources
= ARRAY_SIZE(ls1x_eth0_resources
),
90 .resource
= ls1x_eth0_resources
,
92 .platform_data
= &ls1x_eth_data
,
97 static u64 ls1x_ehci_dmamask
= DMA_BIT_MASK(32);
99 static struct resource ls1x_ehci_resources
[] = {
101 .start
= LS1X_EHCI_BASE
,
102 .end
= LS1X_EHCI_BASE
+ SZ_32K
- 1,
103 .flags
= IORESOURCE_MEM
,
106 .start
= LS1X_EHCI_IRQ
,
107 .flags
= IORESOURCE_IRQ
,
111 static struct usb_ehci_pdata ls1x_ehci_pdata
= {
114 struct platform_device ls1x_ehci_device
= {
115 .name
= "ehci-platform",
117 .num_resources
= ARRAY_SIZE(ls1x_ehci_resources
),
118 .resource
= ls1x_ehci_resources
,
120 .dma_mask
= &ls1x_ehci_dmamask
,
121 .platform_data
= &ls1x_ehci_pdata
,
125 /* Real Time Clock */
126 struct platform_device ls1x_rtc_device
= {