blob: 4d88581e95f09bd2a45f8415dd316eeeee401401 [file] [log] [blame]
Kevin Wells19d95e12010-07-27 08:44:37 -07001/*
Roland Stiggef5c42272012-04-22 12:01:19 +02002 * Platform support for LPC32xx SoC
Kevin Wells19d95e12010-07-27 08:44:37 -07003 *
4 * Author: Kevin Wells <kevin.wells@nxp.com>
5 *
Roland Stiggef5c42272012-04-22 12:01:19 +02006 * Copyright (C) 2012 Roland Stigge <stigge@antcom.de>
Kevin Wells19d95e12010-07-27 08:44:37 -07007 * 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
Roland Stigge291dd712012-06-14 16:16:17 +020020#include <linux/amba/pl08x.h>
Roland Stigge5b941232012-09-06 11:39:18 +020021#include <linux/mtd/lpc32xx_mlc.h>
Vladimir Zapolskiya1e65c22019-04-19 22:55:26 +030022#include <linux/mtd/lpc32xx_slc.h>
23#include <linux/of_platform.h>
Kevin Wells19d95e12010-07-27 08:44:37 -070024
Kevin Wells19d95e12010-07-27 08:44:37 -070025#include <asm/mach/arch.h>
Kevin Wells19d95e12010-07-27 08:44:37 -070026#include "common.h"
27
Roland Stigged807af42012-06-14 16:16:17 +020028static struct pl08x_channel_data pl08x_slave_channels[] = {
29 {
30 .bus_id = "nand-slc",
31 .min_signal = 1, /* SLC NAND Flash */
32 .max_signal = 1,
33 .periph_buses = PL08X_AHB1,
34 },
35 {
36 .bus_id = "nand-mlc",
37 .min_signal = 12, /* MLC NAND Flash */
38 .max_signal = 12,
39 .periph_buses = PL08X_AHB1,
40 },
41};
42
Roland Stigge8ba85f82012-07-12 14:01:04 +020043static int pl08x_get_signal(const struct pl08x_channel_data *cd)
Roland Stigged807af42012-06-14 16:16:17 +020044{
Roland Stigge8ba85f82012-07-12 14:01:04 +020045 return cd->min_signal;
Roland Stigged807af42012-06-14 16:16:17 +020046}
47
Roland Stigge8ba85f82012-07-12 14:01:04 +020048static void pl08x_put_signal(const struct pl08x_channel_data *cd, int ch)
Roland Stigged807af42012-06-14 16:16:17 +020049{
50}
51
Roland Stiggef5c42272012-04-22 12:01:19 +020052static struct pl08x_platform_data pl08x_pd = {
Linus Walleij4166a562017-05-20 23:42:50 +020053 /* Some reasonable memcpy defaults */
54 .memcpy_burst_size = PL08X_BURST_SZ_256,
55 .memcpy_bus_width = PL08X_BUS_WIDTH_32_BITS,
Roland Stigged807af42012-06-14 16:16:17 +020056 .slave_channels = &pl08x_slave_channels[0],
57 .num_slave_channels = ARRAY_SIZE(pl08x_slave_channels),
Mark Brownd7cabee2013-06-19 20:38:28 +010058 .get_xfer_signal = pl08x_get_signal,
59 .put_xfer_signal = pl08x_put_signal,
Roland Stigged807af42012-06-14 16:16:17 +020060 .lli_buses = PL08X_AHB1,
61 .mem_buses = PL08X_AHB1,
Kevin Wells19d95e12010-07-27 08:44:37 -070062};
63
Roland Stigge5b941232012-09-06 11:39:18 +020064static struct lpc32xx_slc_platform_data lpc32xx_slc_data = {
65 .dma_filter = pl08x_filter_id,
66};
67
68static struct lpc32xx_mlc_platform_data lpc32xx_mlc_data = {
69 .dma_filter = pl08x_filter_id,
70};
71
Vladimir Zapolskiy71d42e92016-04-18 04:37:38 +030072static const struct of_dev_auxdata lpc32xx_auxdata_lookup[] __initconst = {
Roland Stiggea4bc7872012-09-25 10:15:49 +020073 OF_DEV_AUXDATA("arm,pl022", 0x20084000, "dev:ssp0", NULL),
74 OF_DEV_AUXDATA("arm,pl022", 0x2008C000, "dev:ssp1", NULL),
Roland Stiggef5c42272012-04-22 12:01:19 +020075 OF_DEV_AUXDATA("arm,pl080", 0x31000000, "pl08xdmac", &pl08x_pd),
Roland Stigge5b941232012-09-06 11:39:18 +020076 OF_DEV_AUXDATA("nxp,lpc3220-slc", 0x20020000, "20020000.flash",
77 &lpc32xx_slc_data),
78 OF_DEV_AUXDATA("nxp,lpc3220-mlc", 0x200a8000, "200a8000.flash",
79 &lpc32xx_mlc_data),
Roland Stiggef5c42272012-04-22 12:01:19 +020080 { }
Kevin Wells19d95e12010-07-27 08:44:37 -070081};
82
Roland Stiggef5c42272012-04-22 12:01:19 +020083static void __init lpc3250_machine_init(void)
Kevin Wells19d95e12010-07-27 08:44:37 -070084{
Kevin Wells19d95e12010-07-27 08:44:37 -070085 lpc32xx_serial_init();
86
Kefeng Wang435ebcb2016-06-01 14:53:05 +080087 of_platform_default_populate(NULL, lpc32xx_auxdata_lookup, NULL);
Kevin Wells19d95e12010-07-27 08:44:37 -070088}
89
Nicolas Pitre19c233b2015-07-27 18:27:52 -040090static const char *const lpc32xx_dt_compat[] __initconst = {
Roland Stiggef5c42272012-04-22 12:01:19 +020091 "nxp,lpc3220",
92 "nxp,lpc3230",
93 "nxp,lpc3240",
94 "nxp,lpc3250",
95 NULL
96};
97
98DT_MACHINE_START(LPC32XX_DT, "LPC32XX SoC (Flattened Device Tree)")
Nicolas Pitrebdec5dd2011-07-05 22:38:14 -040099 .atag_offset = 0x100,
Kevin Wells19d95e12010-07-27 08:44:37 -0700100 .map_io = lpc32xx_map_io,
Roland Stiggef5c42272012-04-22 12:01:19 +0200101 .init_machine = lpc3250_machine_init,
102 .dt_compat = lpc32xx_dt_compat,
Kevin Wells19d95e12010-07-27 08:44:37 -0700103MACHINE_END