diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/aiodev/Kconfig | 8 | ||||
-rw-r--r-- | drivers/aiodev/Makefile | 1 | ||||
-rw-r--r-- | drivers/aiodev/imx7d_adc.c | 431 | ||||
-rw-r--r-- | drivers/clk/clk-stm32mp1.c | 2 | ||||
-rw-r--r-- | drivers/mfd/da9053.c | 2 | ||||
-rw-r--r-- | drivers/mfd/da9063.c | 2 | ||||
-rw-r--r-- | drivers/mfd/rn5t568.c | 2 | ||||
-rw-r--r-- | drivers/power/reset/stm32-reboot.c | 7 | ||||
-rw-r--r-- | drivers/power/reset/syscon-reboot.c | 1 | ||||
-rw-r--r-- | drivers/spi/imx_spi.c | 4 | ||||
-rw-r--r-- | drivers/usb/gadget/fsl_udc_pbl.c | 11 | ||||
-rw-r--r-- | drivers/watchdog/imxwd.c | 31 |
12 files changed, 489 insertions, 13 deletions
diff --git a/drivers/aiodev/Kconfig b/drivers/aiodev/Kconfig index 6bd697702e..5c8706ffef 100644 --- a/drivers/aiodev/Kconfig +++ b/drivers/aiodev/Kconfig @@ -65,4 +65,12 @@ config ROCKCHIP_SARADC help Support for Successive Approximation Register (SAR) ADC in Rockchip SoCs. + +config IMX7D_ADC + tristate "Freescale IMX7D ADC driver" + depends on ARCH_IMX7 || COMPILE_TEST + depends on OFDEVICE + help + Say yes here to build support for IMX7D ADC. + endif diff --git a/drivers/aiodev/Makefile b/drivers/aiodev/Makefile index 06a63b0d2d..9cb11605ed 100644 --- a/drivers/aiodev/Makefile +++ b/drivers/aiodev/Makefile @@ -9,3 +9,4 @@ obj-$(CONFIG_QORIQ_THERMAL) += qoriq_thermal.o obj-$(CONFIG_AM335X_ADC) += am335x_adc.o obj-$(CONFIG_STM32_ADC) += stm32-adc.o stm32-adc-core.o obj-$(CONFIG_ROCKCHIP_SARADC) += rockchip_saradc.o +obj-$(CONFIG_IMX7D_ADC) += imx7d_adc.o diff --git a/drivers/aiodev/imx7d_adc.c b/drivers/aiodev/imx7d_adc.c new file mode 100644 index 0000000000..21cb063686 --- /dev/null +++ b/drivers/aiodev/imx7d_adc.c @@ -0,0 +1,431 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Freescale i.MX7D ADC driver + * + * Copyright (C) 2015 Freescale Semiconductor, Inc. + */ + +#include <linux/clk.h> +#include <linux/err.h> +#include <io.h> +#include <linux/printk.h> +#include <driver.h> +#include <init.h> +#include <linux/kernel.h> +#include <linux/bitops.h> +#include <regulator.h> +#include <linux/barebox-wrapper.h> + +#include <linux/iopoll.h> +#include <aiodev.h> + +/* ADC register */ +#define IMX7D_REG_ADC_TIMER_UNIT 0x90 +#define IMX7D_REG_ADC_INT_STATUS 0xe0 +#define IMX7D_REG_ADC_CHA_B_CNV_RSLT 0xf0 +#define IMX7D_REG_ADC_CHC_D_CNV_RSLT 0x100 +#define IMX7D_REG_ADC_ADC_CFG 0x130 + +#define IMX7D_REG_ADC_CFG1(ch) ((ch) * 0x20) +#define IMX7D_REG_ADC_CFG2(ch) ((ch) * 0x20 + 0x10) + +#define IMX7D_REG_ADC_CH_CFG1_CHANNEL_EN (0x1 << 31) +#define IMX7D_REG_ADC_CH_CFG1_CHANNEL_SINGLE BIT(30) +#define IMX7D_REG_ADC_CH_CFG1_CHANNEL_AVG_EN BIT(29) +#define IMX7D_REG_ADC_CH_CFG1_CHANNEL_SEL(x) ((x) << 24) + +#define IMX7D_REG_ADC_CH_CFG2_AVG_NUM_4 (0x0 << 12) +#define IMX7D_REG_ADC_CH_CFG2_AVG_NUM_8 (0x1 << 12) +#define IMX7D_REG_ADC_CH_CFG2_AVG_NUM_16 (0x2 << 12) +#define IMX7D_REG_ADC_CH_CFG2_AVG_NUM_32 (0x3 << 12) + +#define IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_4 (0x0 << 29) +#define IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_8 (0x1 << 29) +#define IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_16 (0x2 << 29) +#define IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_32 (0x3 << 29) +#define IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_64 (0x4 << 29) +#define IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_128 (0x5 << 29) + +#define IMX7D_REG_ADC_ADC_CFG_ADC_CLK_DOWN BIT(31) +#define IMX7D_REG_ADC_ADC_CFG_ADC_POWER_DOWN BIT(1) +#define IMX7D_REG_ADC_ADC_CFG_ADC_EN BIT(0) + +#define IMX7D_REG_ADC_INT_STATUS_CHANNEL_INT_STATUS 0xf00 +#define IMX7D_REG_ADC_INT_STATUS_CHANNEL_CONV_TIME_OUT 0xf0000 + +#define IMX7D_ADC_TIMEOUT_NSEC (100 * NSEC_PER_MSEC) +#define IMX7D_ADC_INPUT_CLK 24000000 + +enum imx7d_adc_clk_pre_div { + IMX7D_ADC_ANALOG_CLK_PRE_DIV_4, + IMX7D_ADC_ANALOG_CLK_PRE_DIV_8, + IMX7D_ADC_ANALOG_CLK_PRE_DIV_16, + IMX7D_ADC_ANALOG_CLK_PRE_DIV_32, + IMX7D_ADC_ANALOG_CLK_PRE_DIV_64, + IMX7D_ADC_ANALOG_CLK_PRE_DIV_128, +}; + +enum imx7d_adc_average_num { + IMX7D_ADC_AVERAGE_NUM_4, + IMX7D_ADC_AVERAGE_NUM_8, + IMX7D_ADC_AVERAGE_NUM_16, + IMX7D_ADC_AVERAGE_NUM_32, +}; + +struct imx7d_adc_feature { + enum imx7d_adc_clk_pre_div clk_pre_div; + enum imx7d_adc_average_num avg_num; + + u32 core_time_unit; /* impact the sample rate */ +}; + +struct imx7d_adc { + struct device_d *dev; + void __iomem *regs; + struct clk *clk; + struct aiodevice aiodev; + void (*aiodev_info)(struct device_d *); + + u32 vref_uv; + u32 pre_div_num; + + struct regulator *vref; + struct imx7d_adc_feature adc_feature; + + struct aiochannel aiochan[16]; +}; + +struct imx7d_adc_analogue_core_clk { + u32 pre_div; + u32 reg_config; +}; + +#define IMX7D_ADC_ANALOGUE_CLK_CONFIG(_pre_div, _reg_conf) { \ + .pre_div = (_pre_div), \ + .reg_config = (_reg_conf), \ +} + +static const struct imx7d_adc_analogue_core_clk imx7d_adc_analogue_clk[] = { + IMX7D_ADC_ANALOGUE_CLK_CONFIG(4, IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_4), + IMX7D_ADC_ANALOGUE_CLK_CONFIG(8, IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_8), + IMX7D_ADC_ANALOGUE_CLK_CONFIG(16, IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_16), + IMX7D_ADC_ANALOGUE_CLK_CONFIG(32, IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_32), + IMX7D_ADC_ANALOGUE_CLK_CONFIG(64, IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_64), + IMX7D_ADC_ANALOGUE_CLK_CONFIG(128, IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_128), +}; + +static const u32 imx7d_adc_average_num[] = { + IMX7D_REG_ADC_CH_CFG2_AVG_NUM_4, + IMX7D_REG_ADC_CH_CFG2_AVG_NUM_8, + IMX7D_REG_ADC_CH_CFG2_AVG_NUM_16, + IMX7D_REG_ADC_CH_CFG2_AVG_NUM_32, +}; + +static void imx7d_adc_feature_config(struct imx7d_adc *info) +{ + info->adc_feature.clk_pre_div = IMX7D_ADC_ANALOG_CLK_PRE_DIV_4; + info->adc_feature.avg_num = IMX7D_ADC_AVERAGE_NUM_32; + info->adc_feature.core_time_unit = 1; +} + +static void imx7d_adc_sample_rate_set(struct imx7d_adc *info) +{ + struct imx7d_adc_feature *adc_feature = &info->adc_feature; + struct imx7d_adc_analogue_core_clk adc_analogue_clk; + unsigned i; + u32 tmp_cfg1; + u32 sample_rate = 0; + + /* + * Before sample set, disable channel A,B,C,D. Here we + * clear the bit 31 of register REG_ADC_CH_A\B\C\D_CFG1. + */ + for (i = 0; i < 4; i++) { + tmp_cfg1 = readl(info->regs + IMX7D_REG_ADC_CFG1(i)); + tmp_cfg1 &= ~IMX7D_REG_ADC_CH_CFG1_CHANNEL_EN; + writel(tmp_cfg1, info->regs + IMX7D_REG_ADC_CFG1(i)); + } + + adc_analogue_clk = imx7d_adc_analogue_clk[adc_feature->clk_pre_div]; + sample_rate |= adc_analogue_clk.reg_config; + info->pre_div_num = adc_analogue_clk.pre_div; + + sample_rate |= adc_feature->core_time_unit; + writel(sample_rate, info->regs + IMX7D_REG_ADC_TIMER_UNIT); +} + +static void imx7d_adc_hw_init(struct imx7d_adc *info) +{ + u32 cfg; + + /* power up and enable adc analogue core */ + cfg = readl(info->regs + IMX7D_REG_ADC_ADC_CFG); + cfg &= ~(IMX7D_REG_ADC_ADC_CFG_ADC_CLK_DOWN | + IMX7D_REG_ADC_ADC_CFG_ADC_POWER_DOWN); + cfg |= IMX7D_REG_ADC_ADC_CFG_ADC_EN; + writel(cfg, info->regs + IMX7D_REG_ADC_ADC_CFG); + + imx7d_adc_sample_rate_set(info); +} + +static void imx7d_adc_channel_set(struct imx7d_adc *info, u32 channel) +{ + u32 cfg1 = 0; + u32 cfg2; + + /* the channel choose single conversion, and enable average mode */ + cfg1 |= (IMX7D_REG_ADC_CH_CFG1_CHANNEL_EN | + IMX7D_REG_ADC_CH_CFG1_CHANNEL_SINGLE | + IMX7D_REG_ADC_CH_CFG1_CHANNEL_AVG_EN); + + /* + * physical channel 0 chose logical channel A + * physical channel 1 chose logical channel B + * physical channel 2 chose logical channel C + * physical channel 3 chose logical channel D + */ + cfg1 |= IMX7D_REG_ADC_CH_CFG1_CHANNEL_SEL(channel); + + /* + * read register REG_ADC_CH_A\B\C\D_CFG2, according to the + * channel chosen + */ + cfg2 = readl(info->regs + IMX7D_REG_ADC_CFG2(channel)); + + cfg2 |= imx7d_adc_average_num[info->adc_feature.avg_num]; + + /* + * write the register REG_ADC_CH_A\B\C\D_CFG2, according to + * the channel chosen + */ + writel(cfg2, info->regs + IMX7D_REG_ADC_CFG2(channel)); + writel(cfg1, info->regs + IMX7D_REG_ADC_CFG1(channel)); +} + +static u16 __imx7d_adc_read_data(struct imx7d_adc *info, u32 channel) +{ + u32 value; + + /* + * channel A and B conversion result share one register, + * bit[27~16] is the channel B conversion result, + * bit[11~0] is the channel A conversion result. + * channel C and D is the same. + */ + if (channel < 2) + value = readl(info->regs + IMX7D_REG_ADC_CHA_B_CNV_RSLT); + else + value = readl(info->regs + IMX7D_REG_ADC_CHC_D_CNV_RSLT); + if (channel & 0x1) /* channel B or D */ + value = (value >> 16) & 0xFFF; + else /* channel A or C */ + value &= 0xFFF; + + return value; +} + +static int imx7d_adc_read_data(struct imx7d_adc *info, u32 channel) +{ + int ret = -EAGAIN; + int status; + + status = readl(info->regs + IMX7D_REG_ADC_INT_STATUS); + if (status & IMX7D_REG_ADC_INT_STATUS_CHANNEL_INT_STATUS) { + ret = __imx7d_adc_read_data(info, channel); + + /* + * The register IMX7D_REG_ADC_INT_STATUS can't clear + * itself after read operation, need software to write + * 0 to the related bit. Here we clear the channel A/B/C/D + * conversion finished flag. + */ + status &= ~IMX7D_REG_ADC_INT_STATUS_CHANNEL_INT_STATUS; + writel(status, info->regs + IMX7D_REG_ADC_INT_STATUS); + } + + /* + * If the channel A/B/C/D conversion timeout, report it and clear these + * timeout flags. + */ + if (status & IMX7D_REG_ADC_INT_STATUS_CHANNEL_CONV_TIME_OUT) { + dev_err(info->dev, + "ADC got conversion time out interrupt: 0x%08x\n", + status); + status &= ~IMX7D_REG_ADC_INT_STATUS_CHANNEL_CONV_TIME_OUT; + writel(status, info->regs + IMX7D_REG_ADC_INT_STATUS); + ret = -ETIMEDOUT; + } + + return ret; +} + + +static int imx7d_adc_read_raw(struct aiochannel *chan, int *data) +{ + struct imx7d_adc *info = container_of(chan->aiodev, struct imx7d_adc, aiodev); + u64 raw64, start; + u32 channel; + int ret; + + channel = chan->index & 0x03; + imx7d_adc_channel_set(info, channel); + + start = get_time_ns(); + do { + if (is_timeout(start, IMX7D_ADC_TIMEOUT_NSEC)) { + ret = -ETIMEDOUT; + break; + } + + ret = imx7d_adc_read_data(info, channel); + } while (ret == -EAGAIN); + + if (ret < 0) + return ret; + + raw64 = ret; + raw64 *= info->vref_uv; + raw64 = div_u64(raw64, 1000); + *data = div_u64(raw64, (1 << 12)); + + return 0; +} + +static const struct of_device_id imx7d_adc_match[] = { + { .compatible = "fsl,imx7d-adc", }, + { /* sentinel */ } +}; + +static void imx7d_adc_power_down(struct imx7d_adc *info) +{ + u32 adc_cfg; + + adc_cfg = readl(info->regs + IMX7D_REG_ADC_ADC_CFG); + adc_cfg |= IMX7D_REG_ADC_ADC_CFG_ADC_CLK_DOWN | + IMX7D_REG_ADC_ADC_CFG_ADC_POWER_DOWN; + adc_cfg &= ~IMX7D_REG_ADC_ADC_CFG_ADC_EN; + writel(adc_cfg, info->regs + IMX7D_REG_ADC_ADC_CFG); +} + +static int imx7d_adc_enable(struct imx7d_adc *info) +{ + struct device_d *dev = info->dev; + int ret; + + ret = regulator_enable(info->vref); + if (ret) + return dev_err_probe(dev, ret, + "Can't enable adc reference top voltage\n"); + + ret = clk_enable(info->clk); + if (ret) { + regulator_disable(info->vref); + return dev_err_probe(dev, ret, "Could not enable clock.\n"); + } + + imx7d_adc_hw_init(info); + + ret = regulator_get_voltage(info->vref); + if (ret < 0) + return dev_err_probe(dev, ret, "can't get vref-supply value\n"); + + info->vref_uv = ret; + return 0; +} + +static u32 imx7d_adc_get_sample_rate(struct imx7d_adc *info) +{ + u32 analogue_core_clk; + u32 core_time_unit = info->adc_feature.core_time_unit; + u32 tmp; + + analogue_core_clk = IMX7D_ADC_INPUT_CLK / info->pre_div_num; + tmp = (core_time_unit + 1) * 6; + + return analogue_core_clk / tmp; +} + +static void imx7d_adc_devinfo(struct device_d *dev) +{ + struct imx7d_adc *info = dev->parent->priv; + + if (info->aiodev_info) + info->aiodev_info(dev); + + printf("Sample Rate: %u\n", imx7d_adc_get_sample_rate(info)); +} + +static int imx7d_adc_probe(struct device_d *dev) +{ + struct aiodevice *aiodev; + struct imx7d_adc *info; + int ret, i; + + info = xzalloc(sizeof(*info)); + + info->dev = dev; + + info->clk = clk_get(dev, "adc"); + if (IS_ERR(info->clk)) + return dev_err_probe(dev, PTR_ERR(info->clk), "Failed getting clock\n"); + + info->vref = regulator_get(dev, "vref"); + if (IS_ERR(info->vref)) + return dev_err_probe(dev, PTR_ERR(info->vref), + "Failed getting reference voltage\n"); + + info->regs = dev_request_mem_region(dev, 0); + if (IS_ERR(info->regs)) + return dev_err_probe(dev, PTR_ERR(info->regs), + "Failed to get memory region\n"); + + dev->priv = info; + aiodev = &info->aiodev; + + aiodev->num_channels = 4; + aiodev->hwdev = dev; + aiodev->read = imx7d_adc_read_raw; + aiodev->channels = xzalloc(aiodev->num_channels * sizeof(aiodev->channels[0])); + + for (i = 0; i < aiodev->num_channels; i++) { + aiodev->channels[i] = &info->aiochan[i]; + info->aiochan[i].unit = "mV"; + } + + imx7d_adc_feature_config(info); + + ret = imx7d_adc_enable(info); + if (ret) + return ret; + + ret = aiodevice_register(aiodev); + if (ret < 0) + return dev_err_probe(dev, ret, "Failed to register aiodev\n"); + + info->aiodev_info = aiodev->dev.info; + aiodev->dev.info = imx7d_adc_devinfo; + + return 0; +} + +static void imx7d_adc_disable(struct device_d *dev) +{ + struct imx7d_adc *info = dev->priv; + + imx7d_adc_power_down(info); + + clk_disable(info->clk); + regulator_disable(info->vref); +} + +static struct driver_d imx7d_adc_driver = { + .probe = imx7d_adc_probe, + .name = "imx7d_adc", + .of_compatible = imx7d_adc_match, + .remove = imx7d_adc_disable, +}; +device_platform_driver(imx7d_adc_driver); + +MODULE_AUTHOR("Haibo Chen <haibo.chen@freescale.com>"); +MODULE_DESCRIPTION("Freescale IMX7D ADC driver"); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/clk/clk-stm32mp1.c b/drivers/clk/clk-stm32mp1.c index c4b03e9f6d..6753a36890 100644 --- a/drivers/clk/clk-stm32mp1.c +++ b/drivers/clk/clk-stm32mp1.c @@ -2280,7 +2280,7 @@ static int stm32mp1_rcc_init(struct device_d *dev) if (ret) return ret; - stm32mp_system_restart_init(base); + stm32mp_system_restart_init(dev); return 0; } diff --git a/drivers/mfd/da9053.c b/drivers/mfd/da9053.c index 99827c9689..693c0ca606 100644 --- a/drivers/mfd/da9053.c +++ b/drivers/mfd/da9053.c @@ -272,7 +272,7 @@ static int da9053_probe(struct device_d *dev) da9053_detect_reset_source(da9053); - da9053->restart.priority = of_get_restart_priority(dev->device_node); + da9053->restart.of_node = dev->device_node; da9053->restart.name = "da9063"; da9053->restart.restart = &da9053_force_system_reset; diff --git a/drivers/mfd/da9063.c b/drivers/mfd/da9063.c index a4e5226f3c..4627dd1aa5 100644 --- a/drivers/mfd/da9063.c +++ b/drivers/mfd/da9063.c @@ -383,7 +383,7 @@ static int da9063_probe(struct device_d *dev) da9063_detect_reset_source(priv); - priv->restart.priority = of_get_restart_priority(dev->device_node); + priv->restart.of_node = dev->device_node; priv->restart.name = "da9063"; priv->restart.restart = &da9063_restart; diff --git a/drivers/mfd/rn5t568.c b/drivers/mfd/rn5t568.c index c1c792cbec..4bbab54fe4 100644 --- a/drivers/mfd/rn5t568.c +++ b/drivers/mfd/rn5t568.c @@ -138,7 +138,7 @@ static int __init rn5t568_i2c_probe(struct device_d *dev) regmap_write(pmic_instance->regmap, RN5T568_REPCNT, RN5T568_REPCNT_OFF_RESETO_16MS | RN5T568_REPCNT_OFF_REPWRTIM_1000MS | RN5T568_REPCNT_OFF_REPWRON); - pmic_instance->restart.priority = of_get_restart_priority(dev->device_node); + pmic_instance->restart.of_node = dev->device_node; pmic_instance->restart.name = "RN5T568"; pmic_instance->restart.restart = &rn5t568_restart; restart_handler_register(&pmic_instance->restart); diff --git a/drivers/power/reset/stm32-reboot.c b/drivers/power/reset/stm32-reboot.c index 809531e713..6789b52d57 100644 --- a/drivers/power/reset/stm32-reboot.c +++ b/drivers/power/reset/stm32-reboot.c @@ -9,6 +9,7 @@ #include <linux/err.h> #include <restart.h> #include <reset_source.h> +#include <of_address.h> #include <asm/io.h> #include <soc/stm32/reboot.h> @@ -108,17 +109,19 @@ static void stm32_set_reset_reason(struct stm32_reset *priv, reset_source_to_string(type), reg); } -void stm32mp_system_restart_init(void __iomem *base) +void stm32mp_system_restart_init(struct device_d *dev) { struct stm32_reset *priv; + struct device_node *np = dev_of_node(dev); priv = xzalloc(sizeof(*priv)); - priv->base = base; + priv->base = of_iomap(np, 0); priv->restart.name = "stm32-rcc"; priv->restart.restart = stm32mp_rcc_restart_handler; priv->restart.priority = 200; + priv->restart.of_node = np; restart_handler_register(&priv->restart); diff --git a/drivers/power/reset/syscon-reboot.c b/drivers/power/reset/syscon-reboot.c index 2dbb6c1ddc..b6b8db75ca 100644 --- a/drivers/power/reset/syscon-reboot.c +++ b/drivers/power/reset/syscon-reboot.c @@ -71,6 +71,7 @@ static int syscon_reboot_probe(struct device_d *dev) ctx->restart_handler.name = "syscon-reboot"; ctx->restart_handler.restart = syscon_restart_handle; ctx->restart_handler.priority = 192; + ctx->restart_handler.of_node = dev->device_node; err = restart_handler_register(&ctx->restart_handler); if (err) diff --git a/drivers/spi/imx_spi.c b/drivers/spi/imx_spi.c index ad3e79d54c..3e0ad2db00 100644 --- a/drivers/spi/imx_spi.c +++ b/drivers/spi/imx_spi.c @@ -662,6 +662,10 @@ static __maybe_unused struct of_device_id imx_spi_dt_ids[] = { .compatible = "fsl,imx51-ecspi", .data = &spi_imx_devtype_data_2_3, }, + { + .compatible = "fsl,imx6ul-ecspi", + .data = &spi_imx_devtype_data_2_3, + }, #endif { /* sentinel */ diff --git a/drivers/usb/gadget/fsl_udc_pbl.c b/drivers/usb/gadget/fsl_udc_pbl.c index 8b714d4c8b..d2f2b9e195 100644 --- a/drivers/usb/gadget/fsl_udc_pbl.c +++ b/drivers/usb/gadget/fsl_udc_pbl.c @@ -5,6 +5,7 @@ #include <soc/fsl/fsl_udc.h> #include <mach/imx8mm-regs.h> #include <mach/imx6-regs.h> +#include <mach/imx7-regs.h> static void fsl_queue_td(struct usb_dr_device *dr, struct ep_td_struct *dtd, int ep_is_in) @@ -210,6 +211,16 @@ int imx6_barebox_start_usb(void *dest) return imx_barebox_start_usb(IOMEM(MX6_OTG_BASE_ADDR), dest); } +int imx7_barebox_load_usb(void *dest) +{ + return imx_barebox_load_usb(IOMEM(MX7_OTG1_BASE_ADDR), dest); +} + +int imx7_barebox_start_usb(void *dest) +{ + return imx_barebox_start_usb(IOMEM(MX7_OTG1_BASE_ADDR), dest); +} + int imx8mm_barebox_load_usb(void *dest) { return imx_barebox_load_usb(IOMEM(MX8MM_USB1_BASE_ADDR), dest); diff --git a/drivers/watchdog/imxwd.c b/drivers/watchdog/imxwd.c index dba92cb46a..5e9962866f 100644 --- a/drivers/watchdog/imxwd.c +++ b/drivers/watchdog/imxwd.c @@ -213,7 +213,7 @@ static void imx_watchdog_detect_reset_source(struct imx_wd *priv) /* else keep the default 'unknown' state */ } -static int imx21_wd_init(struct imx_wd *priv) +static int imx21_wd_init_no_warm_reset(struct imx_wd *priv) { imx_watchdog_detect_reset_source(priv); @@ -225,6 +225,18 @@ static int imx21_wd_init(struct imx_wd *priv) return 0; } +static int imx21_wd_init(struct imx_wd *priv) +{ + priv->restart_warm.name = "imxwd-warm"; + priv->restart_warm.restart = imxwd_force_soc_reset_internal; + priv->restart_warm.priority = RESTART_DEFAULT_PRIORITY - 10; + priv->restart_warm.flags = RESTART_FLAG_WARM_BOOTROM; + + restart_handler_register(&priv->restart_warm); + + return imx21_wd_init_no_warm_reset(priv); +} + static int imx_wd_probe(struct device_d *dev) { struct resource *iores; @@ -294,12 +306,6 @@ static int imx_wd_probe(struct device_d *dev) restart_handler_register(&priv->restart); - priv->restart_warm.name = "imxwd-warm"; - priv->restart_warm.restart = imxwd_force_soc_reset_internal; - priv->restart_warm.priority = RESTART_DEFAULT_PRIORITY - 10; - - restart_handler_register(&priv->restart_warm); - return 0; error_unregister: @@ -310,6 +316,14 @@ on_error: return ret; } +static const struct imx_wd_ops imx7d_wd_ops = { + .set_timeout = imx21_watchdog_set_timeout, + .soc_reset = imx21_soc_reset, + .init = imx21_wd_init_no_warm_reset, + .is_running = imx21_watchdog_is_running, + .timeout_max = 128, +}; + static const struct imx_wd_ops imx21_wd_ops = { .set_timeout = imx21_watchdog_set_timeout, .soc_reset = imx21_soc_reset, @@ -332,6 +346,9 @@ static __maybe_unused struct of_device_id imx_wdt_dt_ids[] = { .compatible = "fsl,imx21-wdt", .data = &imx21_wd_ops, }, { + .compatible = "fsl,imx7d-wdt", + .data = &imx7d_wd_ops, + }, { /* sentinel */ } }; |