blob: 66701bf432488bede04a1b706c6975fddc9425e2 [file] [log] [blame]
Vladimir Zapolskiye861cfb2019-04-19 22:55:28 +03001// SPDX-License-Identifier: GPL-2.0+
Kevin Wells19d95e12010-07-27 08:44:37 -07002/*
Roland Stiggef5c42272012-04-22 12:01:19 +02003 * Platform support for LPC32xx SoC
Kevin Wells19d95e12010-07-27 08:44:37 -07004 *
5 * Author: Kevin Wells <kevin.wells@nxp.com>
6 *
Roland Stiggef5c42272012-04-22 12:01:19 +02007 * Copyright (C) 2012 Roland Stigge <stigge@antcom.de>
Kevin Wells19d95e12010-07-27 08:44:37 -07008 * Copyright (C) 2010 NXP Semiconductors
Kevin Wells19d95e12010-07-27 08:44:37 -07009 */
10
Roland Stigge291dd712012-06-14 16:16:17 +020011#include <linux/amba/pl08x.h>
Roland Stigge5b941232012-09-06 11:39:18 +020012#include <linux/mtd/lpc32xx_mlc.h>
Vladimir Zapolskiya1e65c22019-04-19 22:55:26 +030013#include <linux/mtd/lpc32xx_slc.h>
14#include <linux/of_platform.h>
Kevin Wells19d95e12010-07-27 08:44:37 -070015
Kevin Wells19d95e12010-07-27 08:44:37 -070016#include <asm/mach/arch.h>
Kevin Wells19d95e12010-07-27 08:44:37 -070017#include "common.h"
18
Roland Stigged807af42012-06-14 16:16:17 +020019static struct pl08x_channel_data pl08x_slave_channels[] = {
20 {
21 .bus_id = "nand-slc",
22 .min_signal = 1, /* SLC NAND Flash */
23 .max_signal = 1,
24 .periph_buses = PL08X_AHB1,
25 },
26 {
27 .bus_id = "nand-mlc",
28 .min_signal = 12, /* MLC NAND Flash */
29 .max_signal = 12,
30 .periph_buses = PL08X_AHB1,
31 },
32};
33
Roland Stigge8ba85f82012-07-12 14:01:04 +020034static int pl08x_get_signal(const struct pl08x_channel_data *cd)
Roland Stigged807af42012-06-14 16:16:17 +020035{
Roland Stigge8ba85f82012-07-12 14:01:04 +020036 return cd->min_signal;
Roland Stigged807af42012-06-14 16:16:17 +020037}
38
Roland Stigge8ba85f82012-07-12 14:01:04 +020039static void pl08x_put_signal(const struct pl08x_channel_data *cd, int ch)
Roland Stigged807af42012-06-14 16:16:17 +020040{
41}
42
Roland Stiggef5c42272012-04-22 12:01:19 +020043static struct pl08x_platform_data pl08x_pd = {
Linus Walleij4166a562017-05-20 23:42:50 +020044 /* Some reasonable memcpy defaults */
45 .memcpy_burst_size = PL08X_BURST_SZ_256,
46 .memcpy_bus_width = PL08X_BUS_WIDTH_32_BITS,
Roland Stigged807af42012-06-14 16:16:17 +020047 .slave_channels = &pl08x_slave_channels[0],
48 .num_slave_channels = ARRAY_SIZE(pl08x_slave_channels),
Mark Brownd7cabee2013-06-19 20:38:28 +010049 .get_xfer_signal = pl08x_get_signal,
50 .put_xfer_signal = pl08x_put_signal,
Roland Stigged807af42012-06-14 16:16:17 +020051 .lli_buses = PL08X_AHB1,
52 .mem_buses = PL08X_AHB1,
Kevin Wells19d95e12010-07-27 08:44:37 -070053};
54
Roland Stigge5b941232012-09-06 11:39:18 +020055static struct lpc32xx_slc_platform_data lpc32xx_slc_data = {
56 .dma_filter = pl08x_filter_id,
57};
58
59static struct lpc32xx_mlc_platform_data lpc32xx_mlc_data = {
60 .dma_filter = pl08x_filter_id,
61};
62
Vladimir Zapolskiy71d42e92016-04-18 04:37:38 +030063static const struct of_dev_auxdata lpc32xx_auxdata_lookup[] __initconst = {
Roland Stiggef5c42272012-04-22 12:01:19 +020064 OF_DEV_AUXDATA("arm,pl080", 0x31000000, "pl08xdmac", &pl08x_pd),
Roland Stigge5b941232012-09-06 11:39:18 +020065 OF_DEV_AUXDATA("nxp,lpc3220-slc", 0x20020000, "20020000.flash",
66 &lpc32xx_slc_data),
67 OF_DEV_AUXDATA("nxp,lpc3220-mlc", 0x200a8000, "200a8000.flash",
68 &lpc32xx_mlc_data),
Roland Stiggef5c42272012-04-22 12:01:19 +020069 { }
Kevin Wells19d95e12010-07-27 08:44:37 -070070};
71
Roland Stiggef5c42272012-04-22 12:01:19 +020072static void __init lpc3250_machine_init(void)
Kevin Wells19d95e12010-07-27 08:44:37 -070073{
Kevin Wells19d95e12010-07-27 08:44:37 -070074 lpc32xx_serial_init();
75
Kefeng Wang435ebcb2016-06-01 14:53:05 +080076 of_platform_default_populate(NULL, lpc32xx_auxdata_lookup, NULL);
Kevin Wells19d95e12010-07-27 08:44:37 -070077}
78
Nicolas Pitre19c233b2015-07-27 18:27:52 -040079static const char *const lpc32xx_dt_compat[] __initconst = {
Roland Stiggef5c42272012-04-22 12:01:19 +020080 "nxp,lpc3220",
81 "nxp,lpc3230",
82 "nxp,lpc3240",
83 "nxp,lpc3250",
84 NULL
85};
86
87DT_MACHINE_START(LPC32XX_DT, "LPC32XX SoC (Flattened Device Tree)")
Nicolas Pitrebdec5dd2011-07-05 22:38:14 -040088 .atag_offset = 0x100,
Kevin Wells19d95e12010-07-27 08:44:37 -070089 .map_io = lpc32xx_map_io,
Roland Stiggef5c42272012-04-22 12:01:19 +020090 .init_machine = lpc3250_machine_init,
91 .dt_compat = lpc32xx_dt_compat,
Kevin Wells19d95e12010-07-27 08:44:37 -070092MACHINE_END