2022-06-07 22:11:14 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2010-09-03 01:58:07 +08:00
|
|
|
/*
|
|
|
|
* Critical Link MityOMAP-L138 SoM
|
|
|
|
*
|
2020-07-19 18:20:20 +08:00
|
|
|
* Copyright (C) 2010 Critical Link LLC - https://www.criticallink.com
|
2010-09-03 01:58:07 +08:00
|
|
|
*/
|
|
|
|
|
2014-11-01 08:51:51 +08:00
|
|
|
#define pr_fmt(fmt) "MityOMAPL138: " fmt
|
|
|
|
|
2010-09-03 01:58:07 +08:00
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/console.h>
|
|
|
|
#include <linux/platform_device.h>
|
2019-01-08 17:15:38 +08:00
|
|
|
#include <linux/property.h>
|
2010-09-03 01:58:07 +08:00
|
|
|
#include <linux/mtd/partitions.h>
|
2019-01-08 17:15:37 +08:00
|
|
|
#include <linux/notifier.h>
|
|
|
|
#include <linux/nvmem-consumer.h>
|
2018-11-13 22:01:15 +08:00
|
|
|
#include <linux/nvmem-provider.h>
|
2010-09-06 01:29:39 +08:00
|
|
|
#include <linux/regulator/machine.h>
|
|
|
|
#include <linux/i2c.h>
|
2010-09-17 21:56:06 +08:00
|
|
|
#include <linux/etherdevice.h>
|
2011-02-24 12:52:47 +08:00
|
|
|
#include <linux/spi/spi.h>
|
|
|
|
#include <linux/spi/flash.h>
|
2010-09-03 01:58:07 +08:00
|
|
|
|
2011-06-16 19:01:34 +08:00
|
|
|
#include <asm/io.h>
|
2010-09-03 01:58:07 +08:00
|
|
|
#include <asm/mach-types.h>
|
|
|
|
#include <asm/mach/arch.h>
|
2022-04-28 15:32:09 +08:00
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
#include "da8xx.h"
|
|
|
|
#include "mux.h"
|
|
|
|
|
2012-08-24 21:11:34 +08:00
|
|
|
#include <linux/platform_data/mtd-davinci.h>
|
2014-01-30 19:03:40 +08:00
|
|
|
#include <linux/platform_data/mtd-davinci-aemif.h>
|
2018-06-28 17:57:47 +08:00
|
|
|
#include <linux/platform_data/ti-aemif.h>
|
2012-08-24 21:11:34 +08:00
|
|
|
#include <linux/platform_data/spi-davinci.h>
|
2010-09-03 01:58:07 +08:00
|
|
|
|
2011-03-23 20:15:42 +08:00
|
|
|
#define MITYOMAPL138_PHY_ID ""
|
2010-09-17 21:56:06 +08:00
|
|
|
|
|
|
|
#define FACTORY_CONFIG_MAGIC 0x012C0138
|
|
|
|
#define FACTORY_CONFIG_VERSION 0x00010001
|
|
|
|
|
|
|
|
/* Data Held in On-Board I2C device */
|
|
|
|
struct factory_config {
|
|
|
|
u32 magic;
|
|
|
|
u32 version;
|
|
|
|
u8 mac[6];
|
|
|
|
u32 fpga_type;
|
|
|
|
u32 spare;
|
|
|
|
u32 serialnumber;
|
|
|
|
char partnum[32];
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct factory_config factory_config;
|
|
|
|
|
2016-02-02 04:35:56 +08:00
|
|
|
#ifdef CONFIG_CPU_FREQ
|
2011-01-04 20:50:23 +08:00
|
|
|
struct part_no_info {
|
|
|
|
const char *part_no; /* part number string of interest */
|
|
|
|
int max_freq; /* khz */
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct part_no_info mityomapl138_pn_info[] = {
|
|
|
|
{
|
|
|
|
.part_no = "L138-C",
|
|
|
|
.max_freq = 300000,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.part_no = "L138-D",
|
|
|
|
.max_freq = 375000,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.part_no = "L138-F",
|
|
|
|
.max_freq = 456000,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.part_no = "1808-C",
|
|
|
|
.max_freq = 300000,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.part_no = "1808-D",
|
|
|
|
.max_freq = 375000,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.part_no = "1808-F",
|
|
|
|
.max_freq = 456000,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.part_no = "1810-D",
|
|
|
|
.max_freq = 375000,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static void mityomapl138_cpufreq_init(const char *partnum)
|
|
|
|
{
|
|
|
|
int i, ret;
|
|
|
|
|
|
|
|
for (i = 0; partnum && i < ARRAY_SIZE(mityomapl138_pn_info); i++) {
|
|
|
|
/*
|
|
|
|
* the part number has additional characters beyond what is
|
|
|
|
* stored in the table. This information is not needed for
|
|
|
|
* determining the speed grade, and would require several
|
|
|
|
* more table entries. Only check the first N characters
|
|
|
|
* for a match.
|
|
|
|
*/
|
|
|
|
if (!strncmp(partnum, mityomapl138_pn_info[i].part_no,
|
|
|
|
strlen(mityomapl138_pn_info[i].part_no))) {
|
|
|
|
da850_max_speed = mityomapl138_pn_info[i].max_freq;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = da850_register_cpufreq("pll0_sysclk3");
|
|
|
|
if (ret)
|
2014-11-01 08:51:51 +08:00
|
|
|
pr_warn("cpufreq registration failed: %d\n", ret);
|
2011-01-04 20:50:23 +08:00
|
|
|
}
|
|
|
|
#else
|
|
|
|
static void mityomapl138_cpufreq_init(const char *partnum) { }
|
|
|
|
#endif
|
|
|
|
|
2019-01-08 17:15:37 +08:00
|
|
|
static int read_factory_config(struct notifier_block *nb,
|
|
|
|
unsigned long event, void *data)
|
2010-09-17 21:56:06 +08:00
|
|
|
{
|
|
|
|
int ret;
|
2011-01-04 20:50:23 +08:00
|
|
|
const char *partnum = NULL;
|
2019-01-08 17:15:37 +08:00
|
|
|
struct nvmem_device *nvmem = data;
|
|
|
|
|
|
|
|
if (strcmp(nvmem_dev_name(nvmem), "1-00500") != 0)
|
|
|
|
return NOTIFY_DONE;
|
2010-09-17 21:56:06 +08:00
|
|
|
|
2016-03-16 05:34:45 +08:00
|
|
|
if (!IS_BUILTIN(CONFIG_NVMEM)) {
|
|
|
|
pr_warn("Factory Config not available without CONFIG_NVMEM\n");
|
|
|
|
goto bad_config;
|
|
|
|
}
|
|
|
|
|
2016-02-27 03:59:24 +08:00
|
|
|
ret = nvmem_device_read(nvmem, 0, sizeof(factory_config),
|
|
|
|
&factory_config);
|
2010-09-17 21:56:06 +08:00
|
|
|
if (ret != sizeof(struct factory_config)) {
|
2014-11-01 08:51:51 +08:00
|
|
|
pr_warn("Read Factory Config Failed: %d\n", ret);
|
2011-01-04 20:50:23 +08:00
|
|
|
goto bad_config;
|
2010-09-17 21:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (factory_config.magic != FACTORY_CONFIG_MAGIC) {
|
2014-11-01 08:51:51 +08:00
|
|
|
pr_warn("Factory Config Magic Wrong (%X)\n",
|
|
|
|
factory_config.magic);
|
2011-01-04 20:50:23 +08:00
|
|
|
goto bad_config;
|
2010-09-17 21:56:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (factory_config.version != FACTORY_CONFIG_VERSION) {
|
2014-11-01 08:51:51 +08:00
|
|
|
pr_warn("Factory Config Version Wrong (%X)\n",
|
|
|
|
factory_config.version);
|
2011-01-04 20:50:23 +08:00
|
|
|
goto bad_config;
|
2010-09-17 21:56:06 +08:00
|
|
|
}
|
|
|
|
|
2011-01-04 20:50:23 +08:00
|
|
|
partnum = factory_config.partnum;
|
2014-11-01 08:51:51 +08:00
|
|
|
pr_info("Part Number = %s\n", partnum);
|
2011-01-04 20:50:23 +08:00
|
|
|
|
|
|
|
bad_config:
|
|
|
|
/* default maximum speed is valid for all platforms */
|
|
|
|
mityomapl138_cpufreq_init(partnum);
|
2019-01-08 17:15:37 +08:00
|
|
|
|
|
|
|
return NOTIFY_STOP;
|
2010-09-17 21:56:06 +08:00
|
|
|
}
|
|
|
|
|
2019-01-08 17:15:37 +08:00
|
|
|
static struct notifier_block mityomapl138_nvmem_notifier = {
|
|
|
|
.notifier_call = read_factory_config,
|
|
|
|
};
|
|
|
|
|
2018-11-13 22:01:15 +08:00
|
|
|
/*
|
|
|
|
* We don't define a cell for factory config as it will be accessed from the
|
|
|
|
* board file using the nvmem notifier chain.
|
|
|
|
*/
|
|
|
|
static struct nvmem_cell_info mityomapl138_nvmem_cells[] = {
|
|
|
|
{
|
|
|
|
.name = "macaddr",
|
|
|
|
.offset = 0x64,
|
|
|
|
.bytes = ETH_ALEN,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct nvmem_cell_table mityomapl138_nvmem_cell_table = {
|
|
|
|
.nvmem_name = "1-00500",
|
|
|
|
.cells = mityomapl138_nvmem_cells,
|
|
|
|
.ncells = ARRAY_SIZE(mityomapl138_nvmem_cells),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct nvmem_cell_lookup mityomapl138_nvmem_cell_lookup = {
|
|
|
|
.nvmem_name = "1-00500",
|
|
|
|
.cell_name = "macaddr",
|
|
|
|
.dev_id = "davinci_emac.1",
|
|
|
|
.con_id = "mac-address",
|
|
|
|
};
|
|
|
|
|
2019-01-08 17:15:38 +08:00
|
|
|
static const struct property_entry mityomapl138_fd_chip_properties[] = {
|
|
|
|
PROPERTY_ENTRY_U32("pagesize", 8),
|
|
|
|
PROPERTY_ENTRY_BOOL("read-only"),
|
|
|
|
{ }
|
2010-09-17 21:56:06 +08:00
|
|
|
};
|
|
|
|
|
2021-03-29 18:50:37 +08:00
|
|
|
static const struct software_node mityomapl138_fd_chip_node = {
|
|
|
|
.properties = mityomapl138_fd_chip_properties,
|
|
|
|
};
|
|
|
|
|
2010-09-06 01:29:39 +08:00
|
|
|
static struct davinci_i2c_platform_data mityomap_i2c_0_pdata = {
|
|
|
|
.bus_freq = 100, /* kHz */
|
|
|
|
.bus_delay = 0, /* usec */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* TPS65023 voltage regulator support */
|
|
|
|
/* 1.2V Core */
|
2010-10-12 12:55:22 +08:00
|
|
|
static struct regulator_consumer_supply tps65023_dcdc1_consumers[] = {
|
2010-09-06 01:29:39 +08:00
|
|
|
{
|
|
|
|
.supply = "cvdd",
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
/* 1.8V */
|
2010-10-12 12:55:22 +08:00
|
|
|
static struct regulator_consumer_supply tps65023_dcdc2_consumers[] = {
|
2010-09-06 01:29:39 +08:00
|
|
|
{
|
|
|
|
.supply = "usb0_vdda18",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.supply = "usb1_vdda18",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.supply = "ddr_dvdd18",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.supply = "sata_vddr",
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
/* 1.2V */
|
2010-10-12 12:55:22 +08:00
|
|
|
static struct regulator_consumer_supply tps65023_dcdc3_consumers[] = {
|
2010-09-06 01:29:39 +08:00
|
|
|
{
|
|
|
|
.supply = "sata_vdd",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.supply = "usb_cvdd",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.supply = "pll0_vdda",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.supply = "pll1_vdda",
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
/* 1.8V Aux LDO, not used */
|
2010-10-12 12:55:22 +08:00
|
|
|
static struct regulator_consumer_supply tps65023_ldo1_consumers[] = {
|
2010-09-06 01:29:39 +08:00
|
|
|
{
|
|
|
|
.supply = "1.8v_aux",
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
/* FPGA VCC Aux (2.5 or 3.3) LDO */
|
2010-10-12 12:55:22 +08:00
|
|
|
static struct regulator_consumer_supply tps65023_ldo2_consumers[] = {
|
2010-09-06 01:29:39 +08:00
|
|
|
{
|
|
|
|
.supply = "vccaux",
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2010-10-12 12:55:22 +08:00
|
|
|
static struct regulator_init_data tps65023_regulator_data[] = {
|
2010-09-06 01:29:39 +08:00
|
|
|
/* dcdc1 */
|
|
|
|
{
|
|
|
|
.constraints = {
|
|
|
|
.min_uV = 1150000,
|
|
|
|
.max_uV = 1350000,
|
|
|
|
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
|
|
|
|
REGULATOR_CHANGE_STATUS,
|
|
|
|
.boot_on = 1,
|
|
|
|
},
|
|
|
|
.num_consumer_supplies = ARRAY_SIZE(tps65023_dcdc1_consumers),
|
|
|
|
.consumer_supplies = tps65023_dcdc1_consumers,
|
|
|
|
},
|
|
|
|
/* dcdc2 */
|
|
|
|
{
|
|
|
|
.constraints = {
|
|
|
|
.min_uV = 1800000,
|
|
|
|
.max_uV = 1800000,
|
|
|
|
.valid_ops_mask = REGULATOR_CHANGE_STATUS,
|
|
|
|
.boot_on = 1,
|
|
|
|
},
|
|
|
|
.num_consumer_supplies = ARRAY_SIZE(tps65023_dcdc2_consumers),
|
|
|
|
.consumer_supplies = tps65023_dcdc2_consumers,
|
|
|
|
},
|
|
|
|
/* dcdc3 */
|
|
|
|
{
|
|
|
|
.constraints = {
|
|
|
|
.min_uV = 1200000,
|
|
|
|
.max_uV = 1200000,
|
|
|
|
.valid_ops_mask = REGULATOR_CHANGE_STATUS,
|
|
|
|
.boot_on = 1,
|
|
|
|
},
|
|
|
|
.num_consumer_supplies = ARRAY_SIZE(tps65023_dcdc3_consumers),
|
|
|
|
.consumer_supplies = tps65023_dcdc3_consumers,
|
|
|
|
},
|
|
|
|
/* ldo1 */
|
|
|
|
{
|
|
|
|
.constraints = {
|
|
|
|
.min_uV = 1800000,
|
|
|
|
.max_uV = 1800000,
|
|
|
|
.valid_ops_mask = REGULATOR_CHANGE_STATUS,
|
|
|
|
.boot_on = 1,
|
|
|
|
},
|
|
|
|
.num_consumer_supplies = ARRAY_SIZE(tps65023_ldo1_consumers),
|
|
|
|
.consumer_supplies = tps65023_ldo1_consumers,
|
|
|
|
},
|
|
|
|
/* ldo2 */
|
|
|
|
{
|
|
|
|
.constraints = {
|
|
|
|
.min_uV = 2500000,
|
|
|
|
.max_uV = 3300000,
|
|
|
|
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
|
|
|
|
REGULATOR_CHANGE_STATUS,
|
|
|
|
.boot_on = 1,
|
|
|
|
},
|
|
|
|
.num_consumer_supplies = ARRAY_SIZE(tps65023_ldo2_consumers),
|
|
|
|
.consumer_supplies = tps65023_ldo2_consumers,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct i2c_board_info __initdata mityomap_tps65023_info[] = {
|
|
|
|
{
|
|
|
|
I2C_BOARD_INFO("tps65023", 0x48),
|
|
|
|
.platform_data = &tps65023_regulator_data[0],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
I2C_BOARD_INFO("24c02", 0x50),
|
2021-03-29 18:50:37 +08:00
|
|
|
.swnode = &mityomapl138_fd_chip_node,
|
2010-09-06 01:29:39 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static int __init pmic_tps65023_init(void)
|
|
|
|
{
|
|
|
|
return i2c_register_board_info(1, mityomap_tps65023_info,
|
|
|
|
ARRAY_SIZE(mityomap_tps65023_info));
|
|
|
|
}
|
|
|
|
|
2011-02-24 12:52:47 +08:00
|
|
|
/*
|
|
|
|
* SPI Devices:
|
|
|
|
* SPI1_CS0: 8M Flash ST-M25P64-VME6G
|
|
|
|
*/
|
|
|
|
static struct mtd_partition spi_flash_partitions[] = {
|
|
|
|
[0] = {
|
|
|
|
.name = "ubl",
|
|
|
|
.offset = 0,
|
|
|
|
.size = SZ_64K,
|
|
|
|
.mask_flags = MTD_WRITEABLE,
|
|
|
|
},
|
|
|
|
[1] = {
|
|
|
|
.name = "u-boot",
|
|
|
|
.offset = MTDPART_OFS_APPEND,
|
|
|
|
.size = SZ_512K,
|
|
|
|
.mask_flags = MTD_WRITEABLE,
|
|
|
|
},
|
|
|
|
[2] = {
|
|
|
|
.name = "u-boot-env",
|
|
|
|
.offset = MTDPART_OFS_APPEND,
|
|
|
|
.size = SZ_64K,
|
|
|
|
.mask_flags = MTD_WRITEABLE,
|
|
|
|
},
|
|
|
|
[3] = {
|
|
|
|
.name = "periph-config",
|
|
|
|
.offset = MTDPART_OFS_APPEND,
|
|
|
|
.size = SZ_64K,
|
|
|
|
.mask_flags = MTD_WRITEABLE,
|
|
|
|
},
|
|
|
|
[4] = {
|
|
|
|
.name = "reserved",
|
|
|
|
.offset = MTDPART_OFS_APPEND,
|
|
|
|
.size = SZ_256K + SZ_64K,
|
|
|
|
},
|
|
|
|
[5] = {
|
|
|
|
.name = "kernel",
|
|
|
|
.offset = MTDPART_OFS_APPEND,
|
|
|
|
.size = SZ_2M + SZ_1M,
|
|
|
|
},
|
|
|
|
[6] = {
|
|
|
|
.name = "fpga",
|
|
|
|
.offset = MTDPART_OFS_APPEND,
|
|
|
|
.size = SZ_2M,
|
|
|
|
},
|
|
|
|
[7] = {
|
|
|
|
.name = "spare",
|
|
|
|
.offset = MTDPART_OFS_APPEND,
|
|
|
|
.size = MTDPART_SIZ_FULL,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct flash_platform_data mityomapl138_spi_flash_data = {
|
|
|
|
.name = "m25p80",
|
|
|
|
.parts = spi_flash_partitions,
|
|
|
|
.nr_parts = ARRAY_SIZE(spi_flash_partitions),
|
|
|
|
.type = "m24p64",
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct davinci_spi_config spi_eprom_config = {
|
|
|
|
.io_type = SPI_IO_TYPE_DMA,
|
|
|
|
.c2tdelay = 8,
|
|
|
|
.t2cdelay = 8,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct spi_board_info mityomapl138_spi_flash_info[] = {
|
|
|
|
{
|
|
|
|
.modalias = "m25p80",
|
|
|
|
.platform_data = &mityomapl138_spi_flash_data,
|
|
|
|
.controller_data = &spi_eprom_config,
|
|
|
|
.mode = SPI_MODE_0,
|
|
|
|
.max_speed_hz = 30000000,
|
|
|
|
.bus_num = 1,
|
|
|
|
.chip_select = 0,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2010-09-03 01:58:07 +08:00
|
|
|
/*
|
|
|
|
* MityDSP-L138 includes a 256 MByte large-page NAND flash
|
|
|
|
* (128K blocks).
|
|
|
|
*/
|
2010-10-12 12:55:22 +08:00
|
|
|
static struct mtd_partition mityomapl138_nandflash_partition[] = {
|
2010-09-03 01:58:07 +08:00
|
|
|
{
|
|
|
|
.name = "rootfs",
|
|
|
|
.offset = 0,
|
|
|
|
.size = SZ_128M,
|
|
|
|
.mask_flags = 0, /* MTD_WRITEABLE, */
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "homefs",
|
|
|
|
.offset = MTDPART_OFS_APPEND,
|
|
|
|
.size = MTDPART_SIZ_FULL,
|
|
|
|
.mask_flags = 0,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct davinci_nand_pdata mityomapl138_nandflash_data = {
|
2018-04-30 16:24:49 +08:00
|
|
|
.core_chipsel = 1,
|
2010-09-03 01:58:07 +08:00
|
|
|
.parts = mityomapl138_nandflash_partition,
|
|
|
|
.nr_parts = ARRAY_SIZE(mityomapl138_nandflash_partition),
|
2020-08-27 16:51:58 +08:00
|
|
|
.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST,
|
2011-06-01 07:31:23 +08:00
|
|
|
.bbt_options = NAND_BBT_USE_FLASH,
|
2011-06-01 07:31:22 +08:00
|
|
|
.options = NAND_BUSWIDTH_16,
|
2010-09-03 01:58:07 +08:00
|
|
|
.ecc_bits = 1, /* 4 bit mode is not supported with 16 bit NAND */
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct resource mityomapl138_nandflash_resource[] = {
|
|
|
|
{
|
|
|
|
.start = DA8XX_AEMIF_CS3_BASE,
|
|
|
|
.end = DA8XX_AEMIF_CS3_BASE + SZ_512K + 2 * SZ_1K - 1,
|
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.start = DA8XX_AEMIF_CTL_BASE,
|
|
|
|
.end = DA8XX_AEMIF_CTL_BASE + SZ_32K - 1,
|
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2018-06-28 17:57:47 +08:00
|
|
|
static struct platform_device mityomapl138_aemif_devices[] = {
|
|
|
|
{
|
|
|
|
.name = "davinci_nand",
|
|
|
|
.id = 1,
|
|
|
|
.dev = {
|
|
|
|
.platform_data = &mityomapl138_nandflash_data,
|
|
|
|
},
|
|
|
|
.num_resources = ARRAY_SIZE(mityomapl138_nandflash_resource),
|
|
|
|
.resource = mityomapl138_nandflash_resource,
|
2010-09-03 01:58:07 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2018-06-28 17:57:47 +08:00
|
|
|
static struct resource mityomapl138_aemif_resources[] = {
|
|
|
|
{
|
|
|
|
.start = DA8XX_AEMIF_CTL_BASE,
|
|
|
|
.end = DA8XX_AEMIF_CTL_BASE + SZ_32K - 1,
|
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct aemif_abus_data mityomapl138_aemif_abus_data[] = {
|
|
|
|
{
|
|
|
|
.cs = 1,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct aemif_platform_data mityomapl138_aemif_pdata = {
|
|
|
|
.abus_data = mityomapl138_aemif_abus_data,
|
|
|
|
.num_abus_data = ARRAY_SIZE(mityomapl138_aemif_abus_data),
|
|
|
|
.sub_devices = mityomapl138_aemif_devices,
|
|
|
|
.num_sub_devices = ARRAY_SIZE(mityomapl138_aemif_devices),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device mityomapl138_aemif_device = {
|
|
|
|
.name = "ti-aemif",
|
|
|
|
.id = -1,
|
|
|
|
.dev = {
|
|
|
|
.platform_data = &mityomapl138_aemif_pdata,
|
|
|
|
},
|
|
|
|
.resource = mityomapl138_aemif_resources,
|
|
|
|
.num_resources = ARRAY_SIZE(mityomapl138_aemif_resources),
|
2010-09-03 01:58:07 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static void __init mityomapl138_setup_nand(void)
|
|
|
|
{
|
2018-06-28 17:57:47 +08:00
|
|
|
if (platform_device_register(&mityomapl138_aemif_device))
|
|
|
|
pr_warn("%s: Cannot register AEMIF device\n", __func__);
|
2010-09-03 01:58:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static const short mityomap_mii_pins[] = {
|
|
|
|
DA850_MII_TXEN, DA850_MII_TXCLK, DA850_MII_COL, DA850_MII_TXD_3,
|
|
|
|
DA850_MII_TXD_2, DA850_MII_TXD_1, DA850_MII_TXD_0, DA850_MII_RXER,
|
|
|
|
DA850_MII_CRS, DA850_MII_RXCLK, DA850_MII_RXDV, DA850_MII_RXD_3,
|
|
|
|
DA850_MII_RXD_2, DA850_MII_RXD_1, DA850_MII_RXD_0, DA850_MDIO_CLK,
|
|
|
|
DA850_MDIO_D,
|
|
|
|
-1
|
|
|
|
};
|
|
|
|
|
|
|
|
static const short mityomap_rmii_pins[] = {
|
|
|
|
DA850_RMII_TXD_0, DA850_RMII_TXD_1, DA850_RMII_TXEN,
|
|
|
|
DA850_RMII_CRS_DV, DA850_RMII_RXD_0, DA850_RMII_RXD_1,
|
|
|
|
DA850_RMII_RXER, DA850_RMII_MHZ_50_CLK, DA850_MDIO_CLK,
|
|
|
|
DA850_MDIO_D,
|
|
|
|
-1
|
|
|
|
};
|
|
|
|
|
|
|
|
static void __init mityomapl138_config_emac(void)
|
|
|
|
{
|
|
|
|
void __iomem *cfg_chip3_base;
|
|
|
|
int ret;
|
|
|
|
u32 val;
|
|
|
|
struct davinci_soc_info *soc_info = &davinci_soc_info;
|
|
|
|
|
|
|
|
soc_info->emac_pdata->rmii_en = 0; /* hardcoded for now */
|
|
|
|
|
|
|
|
cfg_chip3_base = DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG);
|
|
|
|
val = __raw_readl(cfg_chip3_base);
|
|
|
|
|
|
|
|
if (soc_info->emac_pdata->rmii_en) {
|
|
|
|
val |= BIT(8);
|
|
|
|
ret = davinci_cfg_reg_list(mityomap_rmii_pins);
|
|
|
|
pr_info("RMII PHY configured\n");
|
|
|
|
} else {
|
|
|
|
val &= ~BIT(8);
|
|
|
|
ret = davinci_cfg_reg_list(mityomap_mii_pins);
|
|
|
|
pr_info("MII PHY configured\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ret) {
|
2014-11-01 08:51:51 +08:00
|
|
|
pr_warn("mii/rmii mux setup failed: %d\n", ret);
|
2010-09-03 01:58:07 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* configure the CFGCHIP3 register for RMII or MII */
|
|
|
|
__raw_writel(val, cfg_chip3_base);
|
|
|
|
|
2010-09-15 22:11:25 +08:00
|
|
|
soc_info->emac_pdata->phy_id = MITYOMAPL138_PHY_ID;
|
2010-09-03 01:58:07 +08:00
|
|
|
|
|
|
|
ret = da8xx_register_emac();
|
|
|
|
if (ret)
|
2014-11-01 08:51:51 +08:00
|
|
|
pr_warn("emac registration failed: %d\n", ret);
|
2010-09-03 01:58:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void __init mityomapl138_init(void)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
2018-05-19 00:48:08 +08:00
|
|
|
da850_register_clocks();
|
|
|
|
|
2010-09-03 01:58:07 +08:00
|
|
|
/* for now, no special EDMA channels are reserved */
|
|
|
|
ret = da850_register_edma(NULL);
|
|
|
|
if (ret)
|
2014-11-01 08:51:51 +08:00
|
|
|
pr_warn("edma registration failed: %d\n", ret);
|
2010-09-03 01:58:07 +08:00
|
|
|
|
|
|
|
ret = da8xx_register_watchdog();
|
|
|
|
if (ret)
|
2014-11-01 08:51:51 +08:00
|
|
|
pr_warn("watchdog registration failed: %d\n", ret);
|
2010-09-03 01:58:07 +08:00
|
|
|
|
2013-06-19 17:15:42 +08:00
|
|
|
davinci_serial_init(da8xx_serial_device);
|
2010-09-03 01:58:07 +08:00
|
|
|
|
2019-01-08 17:15:37 +08:00
|
|
|
nvmem_register_notifier(&mityomapl138_nvmem_notifier);
|
2018-11-13 22:01:15 +08:00
|
|
|
nvmem_add_cell_table(&mityomapl138_nvmem_cell_table);
|
|
|
|
nvmem_add_cell_lookups(&mityomapl138_nvmem_cell_lookup, 1);
|
|
|
|
|
2010-09-06 01:29:39 +08:00
|
|
|
ret = da8xx_register_i2c(0, &mityomap_i2c_0_pdata);
|
|
|
|
if (ret)
|
2014-11-01 08:51:51 +08:00
|
|
|
pr_warn("i2c0 registration failed: %d\n", ret);
|
2010-09-06 01:29:39 +08:00
|
|
|
|
|
|
|
ret = pmic_tps65023_init();
|
|
|
|
if (ret)
|
2014-11-01 08:51:51 +08:00
|
|
|
pr_warn("TPS65023 PMIC init failed: %d\n", ret);
|
2010-09-06 01:29:39 +08:00
|
|
|
|
2010-09-03 01:58:07 +08:00
|
|
|
mityomapl138_setup_nand();
|
|
|
|
|
ARM: davinci: da8xx_register_spi() should not register SPI board info
Without this patch, da8xx_register_spi() registers the SPI board info,
the SPI controller, and sets its number of chipselect to the size of the
static spi_board_info array. This is bad because a SPI board info may
declare devices for different SPI buses, and because other code can also
call spi_register_board_info() (e.g. a daughter board might provide
additional SPI devices).
This patch removes the spi_register_board_info() call from
da8xx_register_spi(), renames this last one to da8xx_register_spi_bus()
to be more explicit, takes the number of chipselect as a function
parameter, and updates the impacted board-da8{3,5}0-evm.c, and
board-mityomapl138.c files accordingly. It also sets the SPI platform
data static, as it doesn't need to be exported.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
[nsekhar@ti.com: fixed conflicts with v3.7-rc7, converted to use pr_warn(),
modified print messages to use __func__]
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
2012-09-11 08:29:13 +08:00
|
|
|
ret = spi_register_board_info(mityomapl138_spi_flash_info,
|
|
|
|
ARRAY_SIZE(mityomapl138_spi_flash_info));
|
|
|
|
if (ret)
|
|
|
|
pr_warn("spi info registration failed: %d\n", ret);
|
|
|
|
|
|
|
|
ret = da8xx_register_spi_bus(1,
|
|
|
|
ARRAY_SIZE(mityomapl138_spi_flash_info));
|
2011-02-24 12:52:47 +08:00
|
|
|
if (ret)
|
2014-11-01 08:51:51 +08:00
|
|
|
pr_warn("spi 1 registration failed: %d\n", ret);
|
2011-02-24 12:52:47 +08:00
|
|
|
|
2010-09-03 01:58:07 +08:00
|
|
|
mityomapl138_config_emac();
|
|
|
|
|
|
|
|
ret = da8xx_register_rtc();
|
|
|
|
if (ret)
|
2014-11-01 08:51:51 +08:00
|
|
|
pr_warn("rtc setup failed: %d\n", ret);
|
2010-09-03 01:58:07 +08:00
|
|
|
|
|
|
|
ret = da8xx_register_cpuidle();
|
|
|
|
if (ret)
|
2014-11-01 08:51:51 +08:00
|
|
|
pr_warn("cpuidle registration failed: %d\n", ret);
|
2010-09-03 01:58:07 +08:00
|
|
|
|
2016-11-16 03:54:19 +08:00
|
|
|
davinci_pm_init();
|
2010-09-03 01:58:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_SERIAL_8250_CONSOLE
|
|
|
|
static int __init mityomapl138_console_init(void)
|
|
|
|
{
|
|
|
|
if (!machine_is_mityomapl138())
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return add_preferred_console("ttyS", 1, "115200");
|
|
|
|
}
|
|
|
|
console_initcall(mityomapl138_console_init);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static void __init mityomapl138_map_io(void)
|
|
|
|
{
|
|
|
|
da850_init();
|
|
|
|
}
|
|
|
|
|
|
|
|
MACHINE_START(MITYOMAPL138, "MityDSP-L138/MityARM-1808")
|
2011-07-06 10:38:11 +08:00
|
|
|
.atag_offset = 0x100,
|
2010-09-03 01:58:07 +08:00
|
|
|
.map_io = mityomapl138_map_io,
|
2019-02-14 22:52:18 +08:00
|
|
|
.init_irq = da850_init_irq,
|
2018-01-20 11:20:22 +08:00
|
|
|
.init_time = da850_init_time,
|
2010-09-03 01:58:07 +08:00
|
|
|
.init_machine = mityomapl138_init,
|
2012-04-26 09:45:39 +08:00
|
|
|
.init_late = davinci_init_late,
|
2011-07-06 10:28:08 +08:00
|
|
|
.dma_zone_size = SZ_128M,
|
2010-09-03 01:58:07 +08:00
|
|
|
MACHINE_END
|