xref: /openbmc/linux/arch/arm/mach-lpc32xx/phy3250.c (revision 023e4163)
1 /*
2  * Platform support for LPC32xx SoC
3  *
4  * Author: Kevin Wells <kevin.wells@nxp.com>
5  *
6  * Copyright (C) 2012 Roland Stigge <stigge@antcom.de>
7  * Copyright (C) 2010 NXP Semiconductors
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  */
19 
20 #include <linux/init.h>
21 #include <linux/platform_device.h>
22 #include <linux/device.h>
23 #include <linux/interrupt.h>
24 #include <linux/irq.h>
25 #include <linux/dma-mapping.h>
26 #include <linux/gpio.h>
27 #include <linux/amba/bus.h>
28 #include <linux/amba/clcd.h>
29 #include <linux/amba/pl08x.h>
30 #include <linux/amba/mmci.h>
31 #include <linux/of.h>
32 #include <linux/of_address.h>
33 #include <linux/of_irq.h>
34 #include <linux/of_platform.h>
35 #include <linux/clk.h>
36 #include <linux/mtd/lpc32xx_slc.h>
37 #include <linux/mtd/lpc32xx_mlc.h>
38 
39 #include <asm/setup.h>
40 #include <asm/mach-types.h>
41 #include <asm/mach/arch.h>
42 
43 #include <mach/hardware.h>
44 #include <mach/platform.h>
45 #include <mach/board.h>
46 #include "common.h"
47 
48 static struct pl08x_channel_data pl08x_slave_channels[] = {
49 	{
50 		.bus_id = "nand-slc",
51 		.min_signal = 1, /* SLC NAND Flash */
52 		.max_signal = 1,
53 		.periph_buses = PL08X_AHB1,
54 	},
55 	{
56 		.bus_id = "nand-mlc",
57 		.min_signal = 12, /* MLC NAND Flash */
58 		.max_signal = 12,
59 		.periph_buses = PL08X_AHB1,
60 	},
61 };
62 
63 static int pl08x_get_signal(const struct pl08x_channel_data *cd)
64 {
65 	return cd->min_signal;
66 }
67 
68 static void pl08x_put_signal(const struct pl08x_channel_data *cd, int ch)
69 {
70 }
71 
72 static struct pl08x_platform_data pl08x_pd = {
73 	/* Some reasonable memcpy defaults */
74 	.memcpy_burst_size = PL08X_BURST_SZ_256,
75 	.memcpy_bus_width = PL08X_BUS_WIDTH_32_BITS,
76 	.slave_channels = &pl08x_slave_channels[0],
77 	.num_slave_channels = ARRAY_SIZE(pl08x_slave_channels),
78 	.get_xfer_signal = pl08x_get_signal,
79 	.put_xfer_signal = pl08x_put_signal,
80 	.lli_buses = PL08X_AHB1,
81 	.mem_buses = PL08X_AHB1,
82 };
83 
84 static struct lpc32xx_slc_platform_data lpc32xx_slc_data = {
85 	.dma_filter = pl08x_filter_id,
86 };
87 
88 static struct lpc32xx_mlc_platform_data lpc32xx_mlc_data = {
89 	.dma_filter = pl08x_filter_id,
90 };
91 
92 static const struct of_dev_auxdata lpc32xx_auxdata_lookup[] __initconst = {
93 	OF_DEV_AUXDATA("arm,pl022", 0x20084000, "dev:ssp0", NULL),
94 	OF_DEV_AUXDATA("arm,pl022", 0x2008C000, "dev:ssp1", NULL),
95 	OF_DEV_AUXDATA("arm,pl080", 0x31000000, "pl08xdmac", &pl08x_pd),
96 	OF_DEV_AUXDATA("nxp,lpc3220-slc", 0x20020000, "20020000.flash",
97 		       &lpc32xx_slc_data),
98 	OF_DEV_AUXDATA("nxp,lpc3220-mlc", 0x200a8000, "200a8000.flash",
99 		       &lpc32xx_mlc_data),
100 	{ }
101 };
102 
103 static void __init lpc3250_machine_init(void)
104 {
105 	lpc32xx_serial_init();
106 
107 	/* Test clock needed for UDA1380 initial init */
108 	__raw_writel(LPC32XX_CLKPWR_TESTCLK2_SEL_MOSC |
109 		LPC32XX_CLKPWR_TESTCLK_TESTCLK2_EN,
110 		LPC32XX_CLKPWR_TEST_CLK_SEL);
111 
112 	of_platform_default_populate(NULL, lpc32xx_auxdata_lookup, NULL);
113 }
114 
115 static const char *const lpc32xx_dt_compat[] __initconst = {
116 	"nxp,lpc3220",
117 	"nxp,lpc3230",
118 	"nxp,lpc3240",
119 	"nxp,lpc3250",
120 	NULL
121 };
122 
123 DT_MACHINE_START(LPC32XX_DT, "LPC32XX SoC (Flattened Device Tree)")
124 	.atag_offset	= 0x100,
125 	.map_io		= lpc32xx_map_io,
126 	.init_machine	= lpc3250_machine_init,
127 	.dt_compat	= lpc32xx_dt_compat,
128 MACHINE_END
129