18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0+
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Platform support for LPC32xx SoC
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Author: Kevin Wells <kevin.wells@nxp.com>
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Copyright (C) 2012 Roland Stigge <stigge@antcom.de>
88c2ecf20Sopenharmony_ci * Copyright (C) 2010 NXP Semiconductors
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <linux/amba/pl08x.h>
128c2ecf20Sopenharmony_ci#include <linux/mtd/lpc32xx_mlc.h>
138c2ecf20Sopenharmony_ci#include <linux/mtd/lpc32xx_slc.h>
148c2ecf20Sopenharmony_ci#include <linux/of_platform.h>
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#include <asm/mach/arch.h>
178c2ecf20Sopenharmony_ci#include "common.h"
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_cistatic struct pl08x_channel_data pl08x_slave_channels[] = {
208c2ecf20Sopenharmony_ci	{
218c2ecf20Sopenharmony_ci		.bus_id = "nand-slc",
228c2ecf20Sopenharmony_ci		.min_signal = 1, /* SLC NAND Flash */
238c2ecf20Sopenharmony_ci		.max_signal = 1,
248c2ecf20Sopenharmony_ci		.periph_buses = PL08X_AHB1,
258c2ecf20Sopenharmony_ci	},
268c2ecf20Sopenharmony_ci	{
278c2ecf20Sopenharmony_ci		.bus_id = "nand-mlc",
288c2ecf20Sopenharmony_ci		.min_signal = 12, /* MLC NAND Flash */
298c2ecf20Sopenharmony_ci		.max_signal = 12,
308c2ecf20Sopenharmony_ci		.periph_buses = PL08X_AHB1,
318c2ecf20Sopenharmony_ci	},
328c2ecf20Sopenharmony_ci};
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_cistatic int pl08x_get_signal(const struct pl08x_channel_data *cd)
358c2ecf20Sopenharmony_ci{
368c2ecf20Sopenharmony_ci	return cd->min_signal;
378c2ecf20Sopenharmony_ci}
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_cistatic void pl08x_put_signal(const struct pl08x_channel_data *cd, int ch)
408c2ecf20Sopenharmony_ci{
418c2ecf20Sopenharmony_ci}
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_cistatic struct pl08x_platform_data pl08x_pd = {
448c2ecf20Sopenharmony_ci	/* Some reasonable memcpy defaults */
458c2ecf20Sopenharmony_ci	.memcpy_burst_size = PL08X_BURST_SZ_256,
468c2ecf20Sopenharmony_ci	.memcpy_bus_width = PL08X_BUS_WIDTH_32_BITS,
478c2ecf20Sopenharmony_ci	.slave_channels = &pl08x_slave_channels[0],
488c2ecf20Sopenharmony_ci	.num_slave_channels = ARRAY_SIZE(pl08x_slave_channels),
498c2ecf20Sopenharmony_ci	.get_xfer_signal = pl08x_get_signal,
508c2ecf20Sopenharmony_ci	.put_xfer_signal = pl08x_put_signal,
518c2ecf20Sopenharmony_ci	.lli_buses = PL08X_AHB1,
528c2ecf20Sopenharmony_ci	.mem_buses = PL08X_AHB1,
538c2ecf20Sopenharmony_ci};
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_cistatic struct lpc32xx_slc_platform_data lpc32xx_slc_data = {
568c2ecf20Sopenharmony_ci	.dma_filter = pl08x_filter_id,
578c2ecf20Sopenharmony_ci};
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_cistatic struct lpc32xx_mlc_platform_data lpc32xx_mlc_data = {
608c2ecf20Sopenharmony_ci	.dma_filter = pl08x_filter_id,
618c2ecf20Sopenharmony_ci};
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_cistatic const struct of_dev_auxdata lpc32xx_auxdata_lookup[] __initconst = {
648c2ecf20Sopenharmony_ci	OF_DEV_AUXDATA("arm,pl080", 0x31000000, "pl08xdmac", &pl08x_pd),
658c2ecf20Sopenharmony_ci	OF_DEV_AUXDATA("nxp,lpc3220-slc", 0x20020000, "20020000.flash",
668c2ecf20Sopenharmony_ci		       &lpc32xx_slc_data),
678c2ecf20Sopenharmony_ci	OF_DEV_AUXDATA("nxp,lpc3220-mlc", 0x200a8000, "200a8000.flash",
688c2ecf20Sopenharmony_ci		       &lpc32xx_mlc_data),
698c2ecf20Sopenharmony_ci	{ }
708c2ecf20Sopenharmony_ci};
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_cistatic void __init lpc3250_machine_init(void)
738c2ecf20Sopenharmony_ci{
748c2ecf20Sopenharmony_ci	lpc32xx_serial_init();
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci	of_platform_default_populate(NULL, lpc32xx_auxdata_lookup, NULL);
778c2ecf20Sopenharmony_ci}
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_cistatic const char *const lpc32xx_dt_compat[] __initconst = {
808c2ecf20Sopenharmony_ci	"nxp,lpc3220",
818c2ecf20Sopenharmony_ci	"nxp,lpc3230",
828c2ecf20Sopenharmony_ci	"nxp,lpc3240",
838c2ecf20Sopenharmony_ci	"nxp,lpc3250",
848c2ecf20Sopenharmony_ci	NULL
858c2ecf20Sopenharmony_ci};
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ciDT_MACHINE_START(LPC32XX_DT, "LPC32XX SoC (Flattened Device Tree)")
888c2ecf20Sopenharmony_ci	.atag_offset	= 0x100,
898c2ecf20Sopenharmony_ci	.map_io		= lpc32xx_map_io,
908c2ecf20Sopenharmony_ci	.init_machine	= lpc3250_machine_init,
918c2ecf20Sopenharmony_ci	.dt_compat	= lpc32xx_dt_compat,
928c2ecf20Sopenharmony_ciMACHINE_END
93