diff options
author | Tom Rini <trini@konsulko.com> | 2020-06-18 10:07:49 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-06-18 10:07:49 -0400 |
commit | 83fdb4388253240138e2ce364abe6b070b756d87 (patch) | |
tree | 93767bc8b7fcbbb7f5668f7cb241a5eada644a9d /drivers | |
parent | 7a81989b7b04bd87d1e684f2bafdc92a9c16fecc (diff) | |
parent | c0a8d6e1e67cc7feee5c9e6c7e8c13bb953734f1 (diff) | |
download | u-boot-83fdb4388253240138e2ce364abe6b070b756d87.zip u-boot-83fdb4388253240138e2ce364abe6b070b756d87.tar.gz u-boot-83fdb4388253240138e2ce364abe6b070b756d87.tar.bz2 |
Merge tag 'ti-v2020.10-next' of https://gitlab.denx.de/u-boot/custodians/u-boot-ti into next
- DM conversion for OMAP4, OMAP5 platforms.
- Other minor fixes for Nokia RX51, am33, am57, am654.
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpio/omap_gpio.c | 9 | ||||
-rw-r--r-- | drivers/mmc/davinci_mmc.c | 63 | ||||
-rw-r--r-- | drivers/mmc/omap_hsmmc.c | 3 | ||||
-rw-r--r-- | drivers/net/ti/cpsw.c | 5 | ||||
-rw-r--r-- | drivers/phy/omap-usb2-phy.c | 33 |
5 files changed, 64 insertions, 49 deletions
diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c index 4249850..c986ef0 100644 --- a/drivers/gpio/omap_gpio.c +++ b/drivers/gpio/omap_gpio.c @@ -41,11 +41,6 @@ struct gpio_bank { #endif -static inline int get_gpio_index(int gpio) -{ - return gpio & 0x1f; -} - int gpio_is_valid(int gpio) { return (gpio >= 0) && (gpio < OMAP_MAX_GPIO); @@ -122,6 +117,10 @@ static int _get_gpio_value(const struct gpio_bank *bank, int gpio) } #if !CONFIG_IS_ENABLED(DM_GPIO) +static inline int get_gpio_index(int gpio) +{ + return gpio & 0x1f; +} static inline const struct gpio_bank *get_gpio_bank(int gpio) { diff --git a/drivers/mmc/davinci_mmc.c b/drivers/mmc/davinci_mmc.c index 2408a68..4ef9f7c 100644 --- a/drivers/mmc/davinci_mmc.c +++ b/drivers/mmc/davinci_mmc.c @@ -18,7 +18,6 @@ #include <asm-generic/gpio.h> #include <linux/delay.h> -#define DAVINCI_MAX_BLOCKS (32) #define WATCHDOG_COUNT (100000) #define get_val(addr) REG(addr) @@ -34,12 +33,6 @@ struct davinci_mmc_priv { struct gpio_desc cd_gpio; /* Card Detect GPIO */ struct gpio_desc wp_gpio; /* Write Protect GPIO */ }; - -struct davinci_mmc_plat -{ - struct mmc_config cfg; - struct mmc mmc; -}; #endif /* Set davinci clock prescalar value based on the required clock in HZ */ @@ -487,43 +480,16 @@ static int davinci_mmc_probe(struct udevice *dev) struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); struct davinci_mmc_plat *plat = dev_get_platdata(dev); struct davinci_mmc_priv *priv = dev_get_priv(dev); - struct mmc_config *cfg = &plat->cfg; -#ifdef CONFIG_SPL_BUILD - int ret; -#endif - - cfg->f_min = 200000; - cfg->f_max = 25000000; - cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34, - cfg->host_caps = MMC_MODE_4BIT, /* DA850 supports only 4-bit SD/MMC */ - cfg->b_max = DAVINCI_MAX_BLOCKS; - cfg->name = "da830-mmc"; - priv->reg_base = (struct davinci_mmc_regs *)dev_read_addr(dev); + priv->reg_base = plat->reg_base; priv->input_clk = clk_get(DAVINCI_MMCSD_CLKID); - #if CONFIG_IS_ENABLED(DM_GPIO) /* These GPIOs are optional */ gpio_request_by_name(dev, "cd-gpios", 0, &priv->cd_gpio, GPIOD_IS_IN); gpio_request_by_name(dev, "wp-gpios", 0, &priv->wp_gpio, GPIOD_IS_IN); #endif - upriv->mmc = &plat->mmc; -#ifdef CONFIG_SPL_BUILD - /* - * FIXME This is a temporary workaround to enable the driver model in - * SPL on omapl138-lcdk. For some reason the bind() callback is not - * being called in SPL for MMC which breaks the mmc boot - the hack - * is to call mmc_bind() from probe(). We also don't have full DT - * support in SPL, hence the hard-coded base register address. - */ - priv->reg_base = (struct davinci_mmc_regs *)DAVINCI_MMC_SD0_BASE; - ret = mmc_bind(dev, &plat->mmc, &plat->cfg); - if (ret) - return ret; -#endif - return davinci_dm_mmc_init(dev); } @@ -534,21 +500,44 @@ static int davinci_mmc_bind(struct udevice *dev) return mmc_bind(dev, &plat->mmc, &plat->cfg); } +#if CONFIG_IS_ENABLED(OF_CONTROL) +static int davinci_mmc_ofdata_to_platdata(struct udevice *dev) +{ + struct davinci_mmc_plat *plat = dev_get_platdata(dev); + struct mmc_config *cfg = &plat->cfg; + + plat->reg_base = (struct davinci_mmc_regs *)dev_read_addr(dev); + cfg->f_min = 200000; + cfg->f_max = 25000000; + cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34, + cfg->host_caps = MMC_MODE_4BIT, /* DA850 supports only 4-bit SD/MMC */ + cfg->b_max = DAVINCI_MAX_BLOCKS; + cfg->name = "da830-mmc"; + + return 0; +} + static const struct udevice_id davinci_mmc_ids[] = { { .compatible = "ti,da830-mmc" }, {}, }; - +#endif U_BOOT_DRIVER(davinci_mmc_drv) = { .name = "davinci_mmc", .id = UCLASS_MMC, +#if CONFIG_IS_ENABLED(OF_CONTROL) .of_match = davinci_mmc_ids, + .platdata_auto_alloc_size = sizeof(struct davinci_mmc_plat), + .ofdata_to_platdata = davinci_mmc_ofdata_to_platdata, +#endif #if CONFIG_BLK .bind = davinci_mmc_bind, #endif .probe = davinci_mmc_probe, .ops = &davinci_mmc_ops, - .platdata_auto_alloc_size = sizeof(struct davinci_mmc_plat), .priv_auto_alloc_size = sizeof(struct davinci_mmc_priv), +#if !CONFIG_IS_ENABLED(OF_CONTROL) + .flags = DM_FLAG_PRE_RELOC, +#endif }; #endif diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c index 8636cd7..0e05fe4 100644 --- a/drivers/mmc/omap_hsmmc.c +++ b/drivers/mmc/omap_hsmmc.c @@ -175,6 +175,8 @@ static inline struct omap_hsmmc_data *omap_hsmmc_get_data(struct mmc *mmc) return (struct omap_hsmmc_data *)mmc->priv; #endif } + +#if defined(CONFIG_OMAP34XX) || defined(CONFIG_IODELAY_RECALIBRATION) static inline struct mmc_config *omap_hsmmc_get_cfg(struct mmc *mmc) { #if CONFIG_IS_ENABLED(DM_MMC) @@ -184,6 +186,7 @@ static inline struct mmc_config *omap_hsmmc_get_cfg(struct mmc *mmc) return &((struct omap_hsmmc_data *)mmc->priv)->cfg; #endif } +#endif #if defined(OMAP_HSMMC_USE_GPIO) && !CONFIG_IS_ENABLED(DM_MMC) static int omap_mmc_setup_gpio_in(int gpio, const char *label) diff --git a/drivers/net/ti/cpsw.c b/drivers/net/ti/cpsw.c index 95761ff..9d4332f 100644 --- a/drivers/net/ti/cpsw.c +++ b/drivers/net/ti/cpsw.c @@ -17,6 +17,7 @@ #include <cpsw.h> #include <dm/device_compat.h> #include <linux/bitops.h> +#include <linux/compiler.h> #include <linux/errno.h> #include <asm/gpio.h> #include <asm/io.h> @@ -247,11 +248,11 @@ static inline void cpsw_ale_set_field(u32 *ale_entry, u32 start, u32 bits, } #define DEFINE_ALE_FIELD(name, start, bits) \ -static inline int cpsw_ale_get_##name(u32 *ale_entry) \ +static inline int __maybe_unused cpsw_ale_get_##name(u32 *ale_entry) \ { \ return cpsw_ale_get_field(ale_entry, start, bits); \ } \ -static inline void cpsw_ale_set_##name(u32 *ale_entry, u32 value) \ +static inline void __maybe_unused cpsw_ale_set_##name(u32 *ale_entry, u32 value) \ { \ cpsw_ale_set_field(ale_entry, start, bits, value); \ } diff --git a/drivers/phy/omap-usb2-phy.c b/drivers/phy/omap-usb2-phy.c index 0793b97..adc454d 100644 --- a/drivers/phy/omap-usb2-phy.c +++ b/drivers/phy/omap-usb2-phy.c @@ -17,6 +17,7 @@ #include <linux/err.h> #define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT BIT(0) +#define OMAP_USB2_DISABLE_CHG_DET BIT(1) #define OMAP_DEV_PHY_PD BIT(0) #define OMAP_USB2_PHY_PD BIT(28) @@ -33,6 +34,10 @@ #define AM654_USB2_VBUS_DET_EN BIT(5) #define AM654_USB2_VBUSVALID_DET_EN BIT(4) +#define USB2PHY_CHRG_DET 0x14 +#define USB2PHY_USE_CHG_DET_REG BIT(29) +#define USB2PHY_DIS_CHG_DET BIT(28) + DECLARE_GLOBAL_DATA_PTR; struct omap_usb2_phy { @@ -160,6 +165,12 @@ static int omap_usb2_phy_init(struct phy *usb_phy) writel(val, priv->phy_base + USB2PHY_ANA_CONFIG1); } + if (priv->flags & OMAP_USB2_DISABLE_CHG_DET) { + val = readl(priv->phy_base + USB2PHY_CHRG_DET); + val |= USB2PHY_USE_CHG_DET_REG | USB2PHY_DIS_CHG_DET; + writel(val, priv->phy_base + USB2PHY_CHRG_DET); + } + return 0; } @@ -197,13 +208,25 @@ int omap_usb2_phy_probe(struct udevice *dev) if (!data) return -EINVAL; - if (data->flags & OMAP_USB2_CALIBRATE_FALSE_DISCONNECT) { - priv->phy_base = dev_read_addr_ptr(dev); + priv->phy_base = dev_read_addr_ptr(dev); - if (!priv->phy_base) - return -EINVAL; + if (!priv->phy_base) + return -EINVAL; + + if (data->flags & OMAP_USB2_CALIBRATE_FALSE_DISCONNECT) priv->flags |= OMAP_USB2_CALIBRATE_FALSE_DISCONNECT; - } + + /* + * AM654x PG1.0 has a silicon bug that D+ is pulled high after + * POR, which could cause enumeration failure with some USB hubs. + * Disabling the USB2_PHY Charger Detect function will put D+ + * into the normal state. + * + * Using property "ti,dis-chg-det-quirk" in the DT usb2-phy node + * to enable this workaround for AM654x PG1.0. + */ + if (dev_read_bool(dev, "ti,dis-chg-det-quirk")) + priv->flags |= OMAP_USB2_DISABLE_CHG_DET; regmap = syscon_regmap_lookup_by_phandle(dev, "syscon-phy-power"); if (!IS_ERR(regmap)) { |