* [PATCH v3 01/20] i.MX: esdhc: Enable host->clk during initialization
2017-01-10 15:08 [PATCH v3 00/20] Vybrid related patches Andrey Smirnov
@ 2017-01-10 15:08 ` Andrey Smirnov
2017-01-10 15:08 ` [PATCH v3 02/20] i.MX: ocotp: Move memory reversing into a subroutine Andrey Smirnov
` (19 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: Andrey Smirnov @ 2017-01-10 15:08 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/mci/imx-esdhc.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c
index d72e3f8..40a086b 100644
--- a/drivers/mci/imx-esdhc.c
+++ b/drivers/mci/imx-esdhc.c
@@ -631,6 +631,13 @@ static int fsl_esdhc_probe(struct device_d *dev)
if (IS_ERR(host->clk))
return PTR_ERR(host->clk);
+ ret = clk_enable(host->clk);
+ if (ret) {
+ dev_err(dev, "Failed to enable clock: %s\n",
+ strerror(ret));
+ return ret;
+ }
+
host->dev = dev;
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v3 02/20] i.MX: ocotp: Move memory reversing into a subroutine
2017-01-10 15:08 [PATCH v3 00/20] Vybrid related patches Andrey Smirnov
2017-01-10 15:08 ` [PATCH v3 01/20] i.MX: esdhc: Enable host->clk during initialization Andrey Smirnov
@ 2017-01-10 15:08 ` Andrey Smirnov
2017-01-10 15:08 ` [PATCH v3 03/20] i.MX: ocotp: Add provisions for storing multiple MAC addresses Andrey Smirnov
` (18 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: Andrey Smirnov @ 2017-01-10 15:08 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Move memory reversing, found in imx_ocotp_get_mac and
imx_ocotp_set_mac, into a subroutine to avoid code duplication.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/mach-imx/ocotp.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-imx/ocotp.c b/arch/arm/mach-imx/ocotp.c
index 68ff0ce..7f625d8 100644
--- a/arch/arm/mach-imx/ocotp.c
+++ b/arch/arm/mach-imx/ocotp.c
@@ -397,19 +397,26 @@ static void imx_ocotp_init_dt(struct device_d *dev, void __iomem *base)
}
}
+static void memreverse(void *dest, const void *src, size_t n)
+{
+ char *destp = dest;
+ const char *srcp = src + n - 1;
+
+ while(n--)
+ *destp++ = *srcp--;
+}
+
static int imx_ocotp_get_mac(struct param_d *param, void *priv)
{
struct ocotp_priv *ocotp_priv = priv;
char buf[8];
- int i, ret;
+ int ret;
ret = regmap_bulk_read(ocotp_priv->map, MAC_OFFSET, buf, MAC_BYTES);
if (ret < 0)
return ret;
- for (i = 0; i < 6; i++)
- ocotp_priv->ethaddr[i] = buf[5 - i];
-
+ memreverse(ocotp_priv->ethaddr, buf, 6);
return 0;
}
@@ -417,10 +424,9 @@ static int imx_ocotp_set_mac(struct param_d *param, void *priv)
{
struct ocotp_priv *ocotp_priv = priv;
char buf[8];
- int i, ret;
+ int ret;
- for (i = 0; i < 6; i++)
- buf[5 - i] = ocotp_priv->ethaddr[i];
+ memreverse(buf, ocotp_priv->ethaddr, 6);
buf[6] = 0; buf[7] = 0;
ret = regmap_bulk_write(ocotp_priv->map, MAC_OFFSET, buf, MAC_BYTES);
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v3 03/20] i.MX: ocotp: Add provisions for storing multiple MAC addresses
2017-01-10 15:08 [PATCH v3 00/20] Vybrid related patches Andrey Smirnov
2017-01-10 15:08 ` [PATCH v3 01/20] i.MX: esdhc: Enable host->clk during initialization Andrey Smirnov
2017-01-10 15:08 ` [PATCH v3 02/20] i.MX: ocotp: Move memory reversing into a subroutine Andrey Smirnov
@ 2017-01-10 15:08 ` Andrey Smirnov
2017-01-10 15:08 ` [PATCH v3 04/20] i.MX: ocotp: Initialize OCOTP as early as possible Andrey Smirnov
` (17 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: Andrey Smirnov @ 2017-01-10 15:08 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
i.MX SoC variants like Vybrid have more than one built-in Ethernet
interface and as a consequence support storing more than one MAC address
in OCOTP module. Add code to create multiple 'mac_addr<n>' parameters as
well as 'mac_addr' as an "alias" to 'mac_addr0' for backwards
compatibility.
Acked-by: Stefan Lengfeld <s.lengfeld@phytec.de>
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/mach-imx/ocotp.c | 70 ++++++++++++++++++++++++++++++++++-------------
1 file changed, 51 insertions(+), 19 deletions(-)
diff --git a/arch/arm/mach-imx/ocotp.c b/arch/arm/mach-imx/ocotp.c
index 7f625d8..bd5448d 100644
--- a/arch/arm/mach-imx/ocotp.c
+++ b/arch/arm/mach-imx/ocotp.c
@@ -69,12 +69,22 @@
/* Other definitions */
#define IMX6_OTP_DATA_ERROR_VAL 0xBADABADA
#define DEF_RELAX 20
-#define MAC_OFFSET (0x22 * 4)
+#define MAC_OFFSET_0 (0x22 * 4)
+#define MAC_OFFSET_1 (0x24 * 4)
+#define MAX_MAC_OFFSETS 2
#define MAC_BYTES 8
struct imx_ocotp_data {
int num_regs;
u32 (*addr_to_offset)(u32 addr);
+ u8 mac_offsets[MAX_MAC_OFFSETS];
+ u8 mac_offsets_num;
+};
+
+struct ocotp_priv_ethaddr {
+ char value[MAC_BYTES];
+ struct regmap *map;
+ u8 offset;
};
struct ocotp_priv {
@@ -84,9 +94,10 @@ struct ocotp_priv {
struct device_d dev;
int permanent_write_enable;
int sense_enable;
- char ethaddr[6];
+ struct ocotp_priv_ethaddr ethaddr[MAX_MAC_OFFSETS];
struct regmap_config map_config;
const struct imx_ocotp_data *data;
+ int mac_offset_idx;
};
static struct ocotp_priv *imx_ocotp;
@@ -408,32 +419,28 @@ static void memreverse(void *dest, const void *src, size_t n)
static int imx_ocotp_get_mac(struct param_d *param, void *priv)
{
- struct ocotp_priv *ocotp_priv = priv;
- char buf[8];
+ char buf[MAC_BYTES];
int ret;
+ struct ocotp_priv_ethaddr *ethaddr = priv;
- ret = regmap_bulk_read(ocotp_priv->map, MAC_OFFSET, buf, MAC_BYTES);
+ ret = regmap_bulk_read(ethaddr->map, ethaddr->offset,
+ buf, MAC_BYTES);
if (ret < 0)
return ret;
- memreverse(ocotp_priv->ethaddr, buf, 6);
+ memreverse(ethaddr->value, buf, 6);
return 0;
}
static int imx_ocotp_set_mac(struct param_d *param, void *priv)
{
- struct ocotp_priv *ocotp_priv = priv;
- char buf[8];
- int ret;
+ char buf[MAC_BYTES];
+ struct ocotp_priv_ethaddr *ethaddr = priv;
- memreverse(buf, ocotp_priv->ethaddr, 6);
- buf[6] = 0; buf[7] = 0;
-
- ret = regmap_bulk_write(ocotp_priv->map, MAC_OFFSET, buf, MAC_BYTES);
- if (ret < 0)
- return ret;
+ memreverse(buf, ethaddr->value, 6);
- return 0;
+ return regmap_bulk_write(ethaddr->map, ethaddr->offset,
+ buf, MAC_BYTES);
}
static struct regmap_bus imx_ocotp_regmap_bus = {
@@ -492,9 +499,28 @@ static int imx_ocotp_probe(struct device_d *dev)
NULL, NULL, &priv->permanent_write_enable, NULL);
}
- if (IS_ENABLED(CONFIG_NET))
- dev_add_param_mac(&(priv->dev), "mac_addr", imx_ocotp_set_mac,
- imx_ocotp_get_mac, priv->ethaddr, priv);
+ if (IS_ENABLED(CONFIG_NET)) {
+ int i;
+ struct ocotp_priv_ethaddr *ethaddr;
+
+ for (i = 0; i < priv->data->mac_offsets_num; i++) {
+ ethaddr = &priv->ethaddr[i];
+ ethaddr->map = priv->map;
+ ethaddr->offset = priv->data->mac_offsets[i];
+
+ dev_add_param_mac(&priv->dev, xasprintf("mac_addr%d", i),
+ imx_ocotp_set_mac, imx_ocotp_get_mac,
+ ethaddr->value, ethaddr);
+ }
+
+ /*
+ * Alias to mac_addr0 for backwards compatibility
+ */
+ ethaddr = &priv->ethaddr[0];
+ dev_add_param_mac(&priv->dev, "mac_addr",
+ imx_ocotp_set_mac, imx_ocotp_get_mac,
+ ethaddr->value, ethaddr);
+ }
dev_add_param_bool(&(priv->dev), "sense_enable", NULL, NULL, &priv->sense_enable, priv);
@@ -533,16 +559,22 @@ static u32 vf610_addr_to_offset(u32 addr)
static struct imx_ocotp_data imx6q_ocotp_data = {
.num_regs = 512,
.addr_to_offset = imx6q_addr_to_offset,
+ .mac_offsets_num = 1,
+ .mac_offsets = { MAC_OFFSET_0 },
};
static struct imx_ocotp_data imx6sl_ocotp_data = {
.num_regs = 256,
.addr_to_offset = imx6sl_addr_to_offset,
+ .mac_offsets_num = 1,
+ .mac_offsets = { MAC_OFFSET_0 },
};
static struct imx_ocotp_data vf610_ocotp_data = {
.num_regs = 512,
.addr_to_offset = vf610_addr_to_offset,
+ .mac_offsets_num = 2,
+ .mac_offsets = { MAC_OFFSET_0, MAC_OFFSET_1 },
};
static __maybe_unused struct of_device_id imx_ocotp_dt_ids[] = {
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v3 04/20] i.MX: ocotp: Initialize OCOTP as early as possible
2017-01-10 15:08 [PATCH v3 00/20] Vybrid related patches Andrey Smirnov
` (2 preceding siblings ...)
2017-01-10 15:08 ` [PATCH v3 03/20] i.MX: ocotp: Add provisions for storing multiple MAC addresses Andrey Smirnov
@ 2017-01-10 15:08 ` Andrey Smirnov
2017-01-10 15:08 ` [PATCH v3 05/20] i.MX: clk: Add IMX_PLLV3_SYS_VF610 subtype Andrey Smirnov
` (16 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: Andrey Smirnov @ 2017-01-10 15:08 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
On Vybrid SoC OCOTP module contains speed grading information that is
needed to correctly adjust CPU clock to its maxumum rate, so we need to
have this information handy as early as possible.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/mach-imx/ocotp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-imx/ocotp.c b/arch/arm/mach-imx/ocotp.c
index bd5448d..c67e37a 100644
--- a/arch/arm/mach-imx/ocotp.c
+++ b/arch/arm/mach-imx/ocotp.c
@@ -610,4 +610,4 @@ static int imx_ocotp_init(void)
return 0;
}
-coredevice_initcall(imx_ocotp_init);
+postcore_initcall(imx_ocotp_init);
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v3 05/20] i.MX: clk: Add IMX_PLLV3_SYS_VF610 subtype
2017-01-10 15:08 [PATCH v3 00/20] Vybrid related patches Andrey Smirnov
` (3 preceding siblings ...)
2017-01-10 15:08 ` [PATCH v3 04/20] i.MX: ocotp: Initialize OCOTP as early as possible Andrey Smirnov
@ 2017-01-10 15:08 ` Andrey Smirnov
2017-01-10 15:08 ` [PATCH v3 06/20] i.MX: ocotp: Add imx_ocotp_sense_enable() Andrey Smirnov
` (15 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: Andrey Smirnov @ 2017-01-10 15:08 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Add IMX_PLLV3_SYS_VF610 subtype to pllv3 code to be able to control and
re-clock PLL1 and PLL2 on Vybrid SoC. This commit also introduces
imx_clk_pllv3_locked which allows the user to create PLLv3 and specify
how it should be polled for "locked" status (used in .set_rate callback)
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/clk/imx/clk-pllv3.c | 108 ++++++++++++++++++++++++++++++++++++++++++++
drivers/clk/imx/clk.h | 5 ++
2 files changed, 113 insertions(+)
diff --git a/drivers/clk/imx/clk-pllv3.c b/drivers/clk/imx/clk-pllv3.c
index 29c0f1c..dd924a4 100644
--- a/drivers/clk/imx/clk-pllv3.c
+++ b/drivers/clk/imx/clk-pllv3.c
@@ -26,6 +26,8 @@
#define PLL_NUM_OFFSET 0x10
#define PLL_DENOM_OFFSET 0x20
+#define SYS_VF610_PLL_OFFSET 0x10
+
#define BM_PLL_POWER (0x1 << 12)
#define BM_PLL_ENABLE (0x1 << 13)
#define BM_PLL_BYPASS (0x1 << 16)
@@ -38,6 +40,8 @@ struct clk_pllv3 {
u32 div_mask;
u32 div_shift;
const char *parent;
+ void __iomem *lock_reg;
+ u32 lock_mask;
};
#define to_clk_pllv3(_clk) container_of(_clk, struct clk_pllv3, clk)
@@ -279,6 +283,88 @@ static const struct clk_ops clk_pllv3_mlb_ops = {
.disable = clk_pllv3_disable,
};
+static unsigned long clk_pllv3_sys_vf610_recalc_rate(struct clk *clk,
+ unsigned long parent_rate)
+{
+ struct clk_pllv3 *pll = to_clk_pllv3(clk);
+
+ u32 mfn = readl(pll->base + SYS_VF610_PLL_OFFSET + PLL_NUM_OFFSET);
+ u32 mfd = readl(pll->base + SYS_VF610_PLL_OFFSET + PLL_DENOM_OFFSET);
+ u32 div = (readl(pll->base) & pll->div_mask) ? 22 : 20;
+
+ return (parent_rate * div) + ((parent_rate / mfd) * mfn);
+}
+
+static long clk_pllv3_sys_vf610_round_rate(struct clk *clk, unsigned long rate,
+ unsigned long *prate)
+{
+ unsigned long parent_rate = *prate;
+ unsigned long min_rate = parent_rate * 20;
+ unsigned long max_rate = 528000000;
+ u32 mfn, mfd = 1000000;
+ u64 temp64;
+
+ if (rate >= max_rate)
+ return max_rate;
+ else if (rate < min_rate)
+ rate = min_rate;
+
+ temp64 = (u64) (rate - 20 * parent_rate);
+ temp64 *= mfd;
+ do_div(temp64, parent_rate);
+ mfn = temp64;
+
+ return parent_rate * 20 + parent_rate / mfd * mfn;
+}
+
+static int clk_pllv3_sys_vf610_set_rate(struct clk *clk, unsigned long rate,
+ unsigned long parent_rate)
+{
+ struct clk_pllv3 *pll = to_clk_pllv3(clk);
+ unsigned long min_rate = parent_rate * 20;
+ unsigned long max_rate = 528000000;
+ u32 val;
+ u32 mfn, mfd = 1000000;
+ u64 temp64;
+
+ if (rate < min_rate || rate > max_rate)
+ return -EINVAL;
+
+ val = readl(pll->base);
+
+ if (rate == max_rate) {
+ writel(0, pll->base + SYS_VF610_PLL_OFFSET + PLL_NUM_OFFSET);
+ val |= pll->div_mask;
+ writel(val, pll->base);
+
+ return 0;
+ } else {
+ val &= ~pll->div_mask;
+ }
+
+ temp64 = (u64) (rate - 20 * parent_rate);
+ temp64 *= mfd;
+ do_div(temp64, parent_rate);
+ mfn = temp64;
+
+ writel(val, pll->base);
+ writel(mfn, pll->base + SYS_VF610_PLL_OFFSET + PLL_NUM_OFFSET);
+ writel(mfd, pll->base + SYS_VF610_PLL_OFFSET + PLL_DENOM_OFFSET);
+
+ while (!(readl(pll->lock_reg) & pll->lock_mask))
+ ;
+
+ return 0;
+}
+
+static const struct clk_ops clk_pllv3_sys_vf610_ops = {
+ .enable = clk_pllv3_enable,
+ .disable = clk_pllv3_disable,
+ .recalc_rate = clk_pllv3_sys_vf610_recalc_rate,
+ .round_rate = clk_pllv3_sys_vf610_round_rate,
+ .set_rate = clk_pllv3_sys_vf610_set_rate,
+};
+
struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
const char *parent, void __iomem *base,
u32 div_mask)
@@ -290,6 +376,9 @@ struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
pll = xzalloc(sizeof(*pll));
switch (type) {
+ case IMX_PLLV3_SYS_VF610:
+ ops = &clk_pllv3_sys_vf610_ops;
+ break;
case IMX_PLLV3_SYS:
ops = &clk_pllv3_sys_ops;
break;
@@ -327,3 +416,22 @@ struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
return &pll->clk;
}
+
+struct clk *imx_clk_pllv3_locked(enum imx_pllv3_type type, const char *name,
+ const char *parent, void __iomem *base,
+ u32 div_mask, void __iomem *lock_reg, u32 lock_mask)
+{
+ struct clk *clk;
+ struct clk_pllv3 *pll;
+
+ clk = imx_clk_pllv3(type, name, parent, base, div_mask);
+ if (IS_ERR(clk))
+ return clk;
+
+ pll = to_clk_pllv3(clk);
+
+ pll->lock_reg = lock_reg;
+ pll->lock_mask = lock_mask;
+
+ return clk;
+}
diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h
index 970f65c..0b28fb2 100644
--- a/drivers/clk/imx/clk.h
+++ b/drivers/clk/imx/clk.h
@@ -78,6 +78,7 @@ struct clk *imx_clk_pllv2(const char *name, const char *parent,
enum imx_pllv3_type {
IMX_PLLV3_GENERIC,
IMX_PLLV3_SYS,
+ IMX_PLLV3_SYS_VF610,
IMX_PLLV3_USB,
IMX_PLLV3_USB_VF610,
IMX_PLLV3_AV,
@@ -89,6 +90,10 @@ struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
const char *parent, void __iomem *base,
u32 div_mask);
+struct clk *imx_clk_pllv3_locked(enum imx_pllv3_type type, const char *name,
+ const char *parent, void __iomem *base,
+ u32 div_mask, void __iomem *lock_reg, u32 lock_mask);
+
struct clk *imx_clk_pfd(const char *name, const char *parent,
void __iomem *reg, u8 idx);
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v3 06/20] i.MX: ocotp: Add imx_ocotp_sense_enable()
2017-01-10 15:08 [PATCH v3 00/20] Vybrid related patches Andrey Smirnov
` (4 preceding siblings ...)
2017-01-10 15:08 ` [PATCH v3 05/20] i.MX: clk: Add IMX_PLLV3_SYS_VF610 subtype Andrey Smirnov
@ 2017-01-10 15:08 ` Andrey Smirnov
2017-01-10 15:09 ` [PATCH v3 07/20] i.MX: imx6-fusemap: Fix SJC_RESP_LOCK width Andrey Smirnov
` (14 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: Andrey Smirnov @ 2017-01-10 15:08 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Add imx_ocotp_sense_enable() function to allow changing that aspect of
OCOTP driver behaviour before calling imx_ocotp_read_field()
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/mach-imx/include/mach/ocotp.h | 1 +
arch/arm/mach-imx/ocotp.c | 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/arch/arm/mach-imx/include/mach/ocotp.h b/arch/arm/mach-imx/include/mach/ocotp.h
index 430bc75..5474c27 100644
--- a/arch/arm/mach-imx/include/mach/ocotp.h
+++ b/arch/arm/mach-imx/include/mach/ocotp.h
@@ -16,5 +16,6 @@
int imx_ocotp_read_field(uint32_t field, unsigned *value);
int imx_ocotp_write_field(uint32_t field, unsigned value);
int imx_ocotp_permanent_write(int enable);
+bool imx_ocotp_sense_enable(bool enable);
#endif /* __MACH_IMX_OCOTP_H */
diff --git a/arch/arm/mach-imx/ocotp.c b/arch/arm/mach-imx/ocotp.c
index c67e37a..99b365a 100644
--- a/arch/arm/mach-imx/ocotp.c
+++ b/arch/arm/mach-imx/ocotp.c
@@ -359,6 +359,13 @@ int imx_ocotp_permanent_write(int enable)
return 0;
}
+bool imx_ocotp_sense_enable(bool enable)
+{
+ const bool old_value = imx_ocotp->sense_enable;
+ imx_ocotp->sense_enable = enable;
+ return old_value;
+}
+
static uint32_t inc_offset(uint32_t offset)
{
if ((offset & 0x3) == 0x3)
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v3 07/20] i.MX: imx6-fusemap: Fix SJC_RESP_LOCK width
2017-01-10 15:08 [PATCH v3 00/20] Vybrid related patches Andrey Smirnov
` (5 preceding siblings ...)
2017-01-10 15:08 ` [PATCH v3 06/20] i.MX: ocotp: Add imx_ocotp_sense_enable() Andrey Smirnov
@ 2017-01-10 15:09 ` Andrey Smirnov
2017-01-10 15:09 ` [PATCH v3 08/20] i.MX: Add fusemap for VF610 Andrey Smirnov
` (13 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: Andrey Smirnov @ 2017-01-10 15:09 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
According to the datasheet SJC_RESP_LOCK is one bit wide, adjust the
definition correspondingly.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/mach-imx/include/mach/imx6-fusemap.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-imx/include/mach/imx6-fusemap.h b/arch/arm/mach-imx/include/mach/imx6-fusemap.h
index 5fdd904..efa16fd 100644
--- a/arch/arm/mach-imx/include/mach/imx6-fusemap.h
+++ b/arch/arm/mach-imx/include/mach/imx6-fusemap.h
@@ -6,7 +6,7 @@
#define IMX6_OCOTP_TESTER_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(0) | OCOTP_WIDTH(2))
#define IMX6_OCOTP_BOOT_CFG_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(2) | OCOTP_WIDTH(2))
#define IMX6_OCOTP_MEM_TRIM_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(4) | OCOTP_WIDTH(2))
-#define IMX6_OCOTP_SJC_RESP_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(6) | OCOTP_WIDTH(2))
+#define IMX6_OCOTP_SJC_RESP_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(6) | OCOTP_WIDTH(1))
#define IMX6_OCOTP_MAC_ADDR_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(8) | OCOTP_WIDTH(2))
#define IMX6_OCOTP_GP1_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(10) | OCOTP_WIDTH(2))
#define IMX6_OCOTP_GP2_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(12) | OCOTP_WIDTH(2))
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v3 08/20] i.MX: Add fusemap for VF610
2017-01-10 15:08 [PATCH v3 00/20] Vybrid related patches Andrey Smirnov
` (6 preceding siblings ...)
2017-01-10 15:09 ` [PATCH v3 07/20] i.MX: imx6-fusemap: Fix SJC_RESP_LOCK width Andrey Smirnov
@ 2017-01-10 15:09 ` Andrey Smirnov
2017-01-10 15:09 ` [PATCH v3 09/20] i.MX: vf610: Ramp CPU clock to maximum frequency Andrey Smirnov
` (12 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: Andrey Smirnov @ 2017-01-10 15:09 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Add fusemap header for VF610 and move out fuse definitions that are
shared with i.MX6 familiy into a sperate file (ocotp-fusemap.h).
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/mach-imx/include/mach/imx6-fusemap.h | 42 +---------------------
arch/arm/mach-imx/include/mach/ocotp-fusemap.h | 49 ++++++++++++++++++++++++++
arch/arm/mach-imx/include/mach/vf610-fusemap.h | 15 ++++++++
3 files changed, 65 insertions(+), 41 deletions(-)
create mode 100644 arch/arm/mach-imx/include/mach/ocotp-fusemap.h
create mode 100644 arch/arm/mach-imx/include/mach/vf610-fusemap.h
diff --git a/arch/arm/mach-imx/include/mach/imx6-fusemap.h b/arch/arm/mach-imx/include/mach/imx6-fusemap.h
index efa16fd..e14044e 100644
--- a/arch/arm/mach-imx/include/mach/imx6-fusemap.h
+++ b/arch/arm/mach-imx/include/mach/imx6-fusemap.h
@@ -1,62 +1,22 @@
#ifndef __MACH_IMX_IMX6_OCOTP_H
#define __MACH_IMX_IMX6_OCOTP_H
-#include <mach/ocotp.h>
+#include <mach/ocotp-fusemap.h>
-#define IMX6_OCOTP_TESTER_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(0) | OCOTP_WIDTH(2))
-#define IMX6_OCOTP_BOOT_CFG_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(2) | OCOTP_WIDTH(2))
-#define IMX6_OCOTP_MEM_TRIM_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(4) | OCOTP_WIDTH(2))
-#define IMX6_OCOTP_SJC_RESP_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(6) | OCOTP_WIDTH(1))
-#define IMX6_OCOTP_MAC_ADDR_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(8) | OCOTP_WIDTH(2))
-#define IMX6_OCOTP_GP1_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(10) | OCOTP_WIDTH(2))
-#define IMX6_OCOTP_GP2_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(12) | OCOTP_WIDTH(2))
-#define IMX6_OCOTP_SRK_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(14) | OCOTP_WIDTH(1))
-#define IMX6_OCOTP_ANALOG_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(18) | OCOTP_WIDTH(2))
-#define IMX6_OCOTP_MISC_CONF_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(22) | OCOTP_WIDTH(1))
-
-/* 0 <= n <= 1 */
-#define IMX6_OCOTP_UNIQUE_ID(n) (OCOTP_WORD(0x410 + 0x10 * (n)) | OCOTP_BIT(0) | OCOTP_WIDTH(32))
#define IMX6_OCOTP_SI_REV (OCOTP_WORD(0x430) | OCOTP_BIT(16) | OCOTP_WIDTH(4))
-#define IMX6_OCOTP_NUM_CORES (OCOTP_WORD(0x430) | OCOTP_BIT(20) | OCOTP_WIDTH(2))
#define IMX6_OCOTP_SATA_RST_SRC (OCOTP_WORD(0x430) | OCOTP_BIT(24) | OCOTP_WIDTH(1))
-#define IMX6_OCOTP_MLB_DISABLE (OCOTP_WORD(0x430) | OCOTP_BIT(26) | OCOTP_WIDTH(1))
#define IMX6_OCOTP_VPU_DISABLE (OCOTP_WORD(0x440) | OCOTP_BIT(15) | OCOTP_WIDTH(1))
#define IMX6_OCOTP_SPEED_GRADING (OCOTP_WORD(0x440) | OCOTP_BIT(16) | OCOTP_WIDTH(2))
-#define IMX6_OCOTP_BOOT_CFG1 (OCOTP_WORD(0x450) | OCOTP_BIT(0) | OCOTP_WIDTH(8))
-#define IMX6_OCOTP_BOOT_CFG2 (OCOTP_WORD(0x450) | OCOTP_BIT(8) | OCOTP_WIDTH(8))
-#define IMX6_OCOTP_BOOT_CFG3 (OCOTP_WORD(0x450) | OCOTP_BIT(16) | OCOTP_WIDTH(8))
-#define IMX6_OCOTP_BOOT_CFG4 (OCOTP_WORD(0x450) | OCOTP_BIT(24) | OCOTP_WIDTH(8))
-#define IMX6_OCOTP_SEC_CONFIG (OCOTP_WORD(0x460) | OCOTP_BIT(1) | OCOTP_WIDTH(1))
-#define IMX6_OCOTP_DIR_BT_DIS (OCOTP_WORD(0x460) | OCOTP_BIT(3) | OCOTP_WIDTH(1))
-#define IMX6_OCOTP_BT_FUSE_SEL (OCOTP_WORD(0x460) | OCOTP_BIT(4) | OCOTP_WIDTH(1))
#define IMX6_OCOTP_DDR3_CONFIG (OCOTP_WORD(0x460) | OCOTP_BIT(8) | OCOTP_WIDTH(8))
#define IMX6_OCOTP_HDCP (OCOTP_WORD(0x460) | OCOTP_BIT(16) | OCOTP_WIDTH(1))
-#define IMX6_OCOTP_SJC_DISABLE (OCOTP_WORD(0x460) | OCOTP_BIT(20) | OCOTP_WIDTH(1))
-#define IMX6_OCOTP_WDOG_ENABLE (OCOTP_WORD(0x460) | OCOTP_BIT(21) | OCOTP_WIDTH(1))
-#define IMX6_OCOTP_JTAG_SMODE (OCOTP_WORD(0x460) | OCOTP_BIT(22) | OCOTP_WIDTH(2))
-#define IMX6_OCOTP_KTE (OCOTP_WORD(0x460) | OCOTP_BIT(26) | OCOTP_WIDTH(1))
-#define IMX6_OCOTP_JTAG_HEO (OCOTP_WORD(0x460) | OCOTP_BIT(27) | OCOTP_WIDTH(1))
#define IMX6_OCOTP_TZASC_ENABLE (OCOTP_WORD(0x460) | OCOTP_BIT(28) | OCOTP_WIDTH(1))
#define IMX6_OCOTP_SDMMC_HYS_EN (OCOTP_WORD(0x460) | OCOTP_BIT(29) | OCOTP_WIDTH(1))
#define IMX6_OCOTP_eMMC_RESET_EN (OCOTP_WORD(0x460) | OCOTP_BIT(30) | OCOTP_WIDTH(1))
-#define IMX6_OCOTP_NAND_READ_CMD_CODE1 (OCOTP_WORD(0x470) | OCOTP_BIT(0) | OCOTP_WIDTH(8))
-#define IMX6_OCOTP_NAND_READ_CMD_CODE2 (OCOTP_WORD(0x470) | OCOTP_BIT(8) | OCOTP_WIDTH(8))
#define IMX6_OCOTP_BT_LPB_POLARITY (OCOTP_WORD(0x470) | OCOTP_BIT(20) | OCOTP_WIDTH(1))
#define IMX6_OCOTP_LPB_BOOT (OCOTP_WORD(0x470) | OCOTP_BIT(21) | OCOTP_WIDTH(2))
#define IMX6_OCOTP_MMC_DLL_DLY (OCOTP_WORD(0x470) | OCOTP_BIT(24) | OCOTP_WIDTH(7))
#define IMX6_OCOTP_TEMPERATURE_GRADE (OCOTP_WORD(0x480) | OCOTP_BIT(6) | OCOTP_WIDTH(2))
#define IMX6_OCOTP_POWER_GATE_CORES (OCOTP_WORD(0x4d0) | OCOTP_BIT(31) | OCOTP_WIDTH(1))
-#define IMX6_OCOTP_USB_VID (OCOTP_WORD(0x4f0) | OCOTP_BIT(0) | OCOTP_WIDTH(16))
-#define IMX6_OCOTP_USB_PID (OCOTP_WORD(0x4f0) | OCOTP_BIT(16) | OCOTP_WIDTH(16))
-/* 0 <= n <= 7 */
-#define IMX6_OCOTP_SRK_HASH(n) (OCOTP_WORD(0x580 + 0x10 * (n)) | OCOTP_BIT(0) | OCOTP_WIDTH(32))
-#define IMX6_OCOTP_SJC_RESP_31_0 (OCOTP_WORD(0x600) | OCOTP_BIT(0) | OCOTP_WIDTH(32))
-#define IMX6_OCOTP_SJC_RESP_55_32 (OCOTP_WORD(0x610) | OCOTP_BIT(0) | OCOTP_WIDTH(24))
-#define IMX6_OCOTP_MAC_ADDR_31_0 (OCOTP_WORD(0x620) | OCOTP_BIT(0) | OCOTP_WIDTH(32))
-#define IMX6_OCOTP_MAC_ADDR_47_32 (OCOTP_WORD(0x630) | OCOTP_BIT(0) | OCOTP_WIDTH(16))
-#define IMX6_OCOTP_GP1 (OCOTP_WORD(0x660) | OCOTP_BIT(0) | OCOTP_WIDTH(32))
-#define IMX6_OCOTP_GP2 (OCOTP_WORD(0x670) | OCOTP_BIT(0) | OCOTP_WIDTH(32))
-#define IMX6_OCOTP_PAD_SETTINGS (OCOTP_WORD(0x6d0) | OCOTP_BIT(0) | OCOTP_WIDTH(6))
#define IMX6DQ_OCOTP_TEST_PORT_DISABLE (OCOTP_WORD(0x6e0) | OCOTP_BIT(1) | OCOTP_WIDTH(1))
#define IMX6SDL_OCOTP_FIELD_RETURN (OCOTP_WORD(0x6e0) | OCOTP_BIT(0) | OCOTP_WIDTH(1))
diff --git a/arch/arm/mach-imx/include/mach/ocotp-fusemap.h b/arch/arm/mach-imx/include/mach/ocotp-fusemap.h
new file mode 100644
index 0000000..44b58ca
--- /dev/null
+++ b/arch/arm/mach-imx/include/mach/ocotp-fusemap.h
@@ -0,0 +1,49 @@
+#ifndef __MACH_IMX_OCOTP_FUSEMAP_H
+#define __MACH_IMX_OCOTP_FUSEMAP_H
+
+#include <mach/ocotp.h>
+
+#define OCOTP_TESTER_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(0) | OCOTP_WIDTH(2))
+#define OCOTP_BOOT_CFG_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(2) | OCOTP_WIDTH(2))
+#define OCOTP_MEM_TRIM_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(4) | OCOTP_WIDTH(2))
+#define OCOTP_SJC_RESP_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(6) | OCOTP_WIDTH(1))
+#define OCOTP_MAC_ADDR_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(8) | OCOTP_WIDTH(2))
+#define OCOTP_GP1_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(10) | OCOTP_WIDTH(2))
+#define OCOTP_GP2_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(12) | OCOTP_WIDTH(2))
+#define OCOTP_SRK_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(14) | OCOTP_WIDTH(1))
+#define OCOTP_ANALOG_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(18) | OCOTP_WIDTH(2))
+#define OCOTP_MISC_CONF_LOCK (OCOTP_WORD(0x400) | OCOTP_BIT(22) | OCOTP_WIDTH(1))
+
+/* 0 <= n <= 1 */
+#define OCOTP_UNIQUE_ID(n) (OCOTP_WORD(0x410 + 0x10 * (n)) | OCOTP_BIT(0) | OCOTP_WIDTH(32))
+#define OCOTP_NUM_CORES (OCOTP_WORD(0x430) | OCOTP_BIT(20) | OCOTP_WIDTH(2))
+#define OCOTP_MLB_DISABLE (OCOTP_WORD(0x430) | OCOTP_BIT(26) | OCOTP_WIDTH(1))
+
+#define OCOTP_BOOT_CFG1 (OCOTP_WORD(0x450) | OCOTP_BIT(0) | OCOTP_WIDTH(8))
+#define OCOTP_BOOT_CFG2 (OCOTP_WORD(0x450) | OCOTP_BIT(8) | OCOTP_WIDTH(8))
+#define OCOTP_BOOT_CFG3 (OCOTP_WORD(0x450) | OCOTP_BIT(16) | OCOTP_WIDTH(8))
+#define OCOTP_BOOT_CFG4 (OCOTP_WORD(0x450) | OCOTP_BIT(24) | OCOTP_WIDTH(8))
+#define OCOTP_SEC_CONFIG_1 (OCOTP_WORD(0x460) | OCOTP_BIT(1) | OCOTP_WIDTH(1))
+#define OCOTP_DIR_BT_DIS (OCOTP_WORD(0x460) | OCOTP_BIT(3) | OCOTP_WIDTH(1))
+#define OCOTP_BT_FUSE_SEL (OCOTP_WORD(0x460) | OCOTP_BIT(4) | OCOTP_WIDTH(1))
+#define OCOTP_SJC_DISABLE (OCOTP_WORD(0x460) | OCOTP_BIT(20) | OCOTP_WIDTH(1))
+#define OCOTP_WDOG_ENABLE (OCOTP_WORD(0x460) | OCOTP_BIT(21) | OCOTP_WIDTH(1))
+#define OCOTP_JTAG_SMODE (OCOTP_WORD(0x460) | OCOTP_BIT(22) | OCOTP_WIDTH(2))
+#define OCOTP_KTE (OCOTP_WORD(0x460) | OCOTP_BIT(26) | OCOTP_WIDTH(1))
+#define OCOTP_JTAG_HEO (OCOTP_WORD(0x460) | OCOTP_BIT(27) | OCOTP_WIDTH(1))
+#define OCOTP_NAND_READ_CMD_CODE1 (OCOTP_WORD(0x470) | OCOTP_BIT(0) | OCOTP_WIDTH(8))
+#define OCOTP_NAND_READ_CMD_CODE2 (OCOTP_WORD(0x470) | OCOTP_BIT(8) | OCOTP_WIDTH(8))
+#define OCOTP_TEMP_SENSE (OCOTP_WORD(0x4e0) | OCOTP_BIT(0) | OCOTP_WIDTH(32))
+#define OCOTP_USB_VID (OCOTP_WORD(0x4f0) | OCOTP_BIT(0) | OCOTP_WIDTH(16))
+#define OCOTP_USB_PID (OCOTP_WORD(0x4f0) | OCOTP_BIT(16) | OCOTP_WIDTH(16))
+/* 0 <= n <= 7 */
+#define OCOTP_SRK_HASH(n) (OCOTP_WORD(0x580 + 0x10 * (n)) | OCOTP_BIT(0) | OCOTP_WIDTH(32))
+#define OCOTP_SJC_RESP_31_0 (OCOTP_WORD(0x600) | OCOTP_BIT(0) | OCOTP_WIDTH(32))
+#define OCOTP_SJC_RESP_55_32 (OCOTP_WORD(0x610) | OCOTP_BIT(0) | OCOTP_WIDTH(24))
+#define OCOTP_MAC_ADDR_31_0 (OCOTP_WORD(0x620) | OCOTP_BIT(0) | OCOTP_WIDTH(32))
+#define OCOTP_MAC_ADDR_47_32 (OCOTP_WORD(0x630) | OCOTP_BIT(0) | OCOTP_WIDTH(16))
+#define OCOTP_GP1 (OCOTP_WORD(0x660) | OCOTP_BIT(0) | OCOTP_WIDTH(32))
+#define OCOTP_GP2 (OCOTP_WORD(0x670) | OCOTP_BIT(0) | OCOTP_WIDTH(32))
+#define OCOTP_PAD_SETTINGS (OCOTP_WORD(0x6d0) | OCOTP_BIT(0) | OCOTP_WIDTH(6))
+
+#endif /* __MACH_IMX_OCOTP_FUSEMAP_H */
diff --git a/arch/arm/mach-imx/include/mach/vf610-fusemap.h b/arch/arm/mach-imx/include/mach/vf610-fusemap.h
new file mode 100644
index 0000000..a56faf1
--- /dev/null
+++ b/arch/arm/mach-imx/include/mach/vf610-fusemap.h
@@ -0,0 +1,15 @@
+#ifndef __MACH_VF610_OCOTP_H
+#define __MACH_VF610_OCOTP_H
+
+#include <mach/ocotp-fusemap.h>
+
+#define VF610_OCOTP_CPU_BUS_FRQ OCOTP_WORD(0x430) | OCOTP_BIT(22) | OCOTP_WIDTH(1)
+#define VF610_OCOTP_OVG_DISABLE OCOTP_WORD(0x430) | OCOTP_BIT(30) | OCOTP_WIDTH(1)
+#define VF610_OCOTP_SEC_CONFIG_0 OCOTP_WORD(0x440) | OCOTP_BIT(1) | OCOTP_WIDTH(1)
+#define VF610_OCOTP_SPEED_GRADING OCOTP_WORD(0x440) | OCOTP_BIT(18) | OCOTP_WIDTH(4)
+#define VF610_OCOTP_MAC_ADDR0_31_0 OCOTP_MAC_ADDR_31_0
+#define VF610_OCOTP_MAC_ADDR0_47_32 OCOTP_MAC_ADDR_47_32
+#define VF610_OCOTP_MAC_ADDR1_31_0 (OCOTP_WORD(0x640) | OCOTP_BIT(0) | OCOTP_WIDTH(32))
+#define VF610_OCOTP_MAC_ADDR1_47_32 (OCOTP_WORD(0x650) | OCOTP_BIT(0) | OCOTP_WIDTH(16))
+
+#endif
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v3 09/20] i.MX: vf610: Ramp CPU clock to maximum frequency
2017-01-10 15:08 [PATCH v3 00/20] Vybrid related patches Andrey Smirnov
` (7 preceding siblings ...)
2017-01-10 15:09 ` [PATCH v3 08/20] i.MX: Add fusemap for VF610 Andrey Smirnov
@ 2017-01-10 15:09 ` Andrey Smirnov
2017-01-10 15:09 ` [PATCH v3 10/20] i.MX: iomuxv3: Add low-level pad code to headers Andrey Smirnov
` (11 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: Andrey Smirnov @ 2017-01-10 15:09 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Mask ROM leaves the CPU running at 264Mhz, so configure the clock tree
such that CPU runs at maximum supported frequency. Maximum supported
frequncy is determined from speed grading burned into OCOTP fusebox by
the vendor.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/mach-imx/Kconfig | 1 +
drivers/clk/imx/clk-vf610.c | 163 +++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 162 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index af533ea..074f90f 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -162,6 +162,7 @@ config ARCH_VF610
select OFTREE
select COMMON_CLK
select COMMON_CLK_OF_PROVIDER
+ select IMX_OCOTP # Needed for clock adjustement
config IMX_MULTI_BOARDS
bool "Allow multiple boards to be selected"
diff --git a/drivers/clk/imx/clk-vf610.c b/drivers/clk/imx/clk-vf610.c
index 9b9ac6c..41fa3e9 100644
--- a/drivers/clk/imx/clk-vf610.c
+++ b/drivers/clk/imx/clk-vf610.c
@@ -16,7 +16,10 @@
#include <of_address.h>
#include <linux/clkdev.h>
#include <linux/clk.h>
+#include <notifier.h>
#include <dt-bindings/clock/vf610-clock.h>
+#include <mach/vf610-regs.h>
+#include <mach/vf610-fusemap.h>
#include "clk.h"
@@ -76,6 +79,7 @@
#define PLL6_CTRL (anatop_base + 0xa0)
#define PLL7_CTRL (anatop_base + 0x20)
#define ANA_MISC1 (anatop_base + 0x160)
+#define PLL_LOCK (anatop_base + 0x2c0)
static void __iomem *anatop_base;
static void __iomem *ccm_base;
@@ -188,8 +192,9 @@ static void __init vf610_clocks_init(struct device_node *ccm_node)
clk[VF610_CLK_PLL6_BYPASS_SRC] = imx_clk_mux("pll6_bypass_src", PLL6_CTRL, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
clk[VF610_CLK_PLL7_BYPASS_SRC] = imx_clk_mux("pll7_bypass_src", PLL7_CTRL, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
- clk[VF610_CLK_PLL1] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll1", "pll1_bypass_src", PLL1_CTRL, 0x1);
- clk[VF610_CLK_PLL2] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2", "pll2_bypass_src", PLL2_CTRL, 0x1);
+ clk[VF610_CLK_PLL1] = imx_clk_pllv3_locked(IMX_PLLV3_SYS_VF610, "pll1", "pll1_bypass_src", PLL1_CTRL, 0x1, PLL_LOCK, BIT(6));
+ clk[VF610_CLK_PLL2] = imx_clk_pllv3_locked(IMX_PLLV3_SYS_VF610, "pll2", "pll2_bypass_src", PLL2_CTRL, 0x1, PLL_LOCK, BIT(5));
+
clk[VF610_CLK_PLL3] = imx_clk_pllv3(IMX_PLLV3_USB_VF610, "pll3", "pll3_bypass_src", PLL3_CTRL, 0x2);
clk[VF610_CLK_PLL4] = imx_clk_pllv3(IMX_PLLV3_AV, "pll4", "pll4_bypass_src", PLL4_CTRL, 0x7f);
clk[VF610_CLK_PLL5] = imx_clk_pllv3(IMX_PLLV3_ENET, "pll5", "pll5_bypass_src", PLL5_CTRL, 0x3);
@@ -444,3 +449,157 @@ static void __init vf610_clocks_init(struct device_node *ccm_node)
of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
}
CLK_OF_DECLARE(vf610, "fsl,vf610-ccm", vf610_clocks_init);
+
+enum {
+ VF610_SPEED_500 = 0b1110,
+ VF610_SPEED_400 = 0b1001,
+ VF610_SPEED_266 = 0b0001,
+
+ DDRMC_CR117 = 0x01d4,
+ DDRMC_CR117_AXI0_FITYPEREG_SYNC = 0b01 << 16,
+};
+
+static int vf610_switch_cpu_clock_to_500mhz(void)
+{
+ int ret;
+
+ /*
+ * When switching A5 CPU to 500Mhz we expect DDRC to be
+ * clocked by PLL2_PFD2 and the system to be configured in
+ * asynchronous mode.
+ *
+ * We also can't just use default PFD1 output of PLL1 due to
+ * Errata e6235, so we have to re-clock the PLL itself and use
+ * its output to clock the CPU directly.
+ */
+
+ if (clk_get_parent(clk[VF610_CLK_DDR_SEL]) != clk[VF610_CLK_PLL2_PFD2]) {
+ pr_warn("DDRC is clocked by PLL1, can't switch CPU clock");
+ return -EINVAL;
+ }
+
+ ret = clk_set_parent(clk[VF610_CLK_SYS_SEL], clk[VF610_CLK_PLL2_BUS]);
+ if (ret < 0) {
+ pr_crit("Unable to re-parent '%s'\n",
+ clk[VF610_CLK_SYS_SEL]->name);
+ return ret;
+ }
+
+ ret = clk_set_rate(clk[VF610_CLK_PLL1], 500000000);
+ if (ret < 0) {
+ pr_crit("Unable to set %s to 500Mhz %d\n",
+ clk[VF610_CLK_PLL1]->name, ret);
+ return ret;
+ }
+
+ ret = clk_set_parent(clk[VF610_CLK_PLL1_PFD_SEL], clk[VF610_CLK_PLL1_SYS]);
+ if (ret < 0) {
+ pr_crit("Unable to re-parent '%s'\n",
+ clk[VF610_CLK_PLL1_PFD_SEL]->name);
+ return ret;
+ }
+
+ ret = clk_set_parent(clk[VF610_CLK_SYS_SEL], clk[VF610_CLK_PLL1_PFD_SEL]);
+ if (ret < 0) {
+ pr_crit("Unable to re-parent '%s'\n",
+ clk[VF610_CLK_SYS_SEL]->name);
+ return ret;
+ }
+
+ /*
+ * imx_clk_divider has no error path in its set_rate hook
+ */
+ clk_set_rate(clk[VF610_CLK_SYS_BUS], clk_get_rate(clk[VF610_CLK_SYS_SEL]));
+ clk_set_rate(clk[VF610_CLK_PLATFORM_BUS], clk_get_rate(clk[VF610_CLK_SYS_BUS]) / 3);
+
+ return ret;
+}
+
+static int vf610_switch_cpu_clock_to_400mhz(void)
+{
+ int ret;
+ uint32_t cr117;
+ void * __iomem ddrmc = IOMEM(VF610_DDR_BASE_ADDR);
+
+ if (clk_get_parent(clk[VF610_CLK_DDR_SEL]) != clk[VF610_CLK_PLL2_PFD2]) {
+ pr_warn("DDRC is clocked by PLL1, can't switch CPU clock");
+ return -EINVAL;
+ }
+
+ ret = clk_set_parent(clk[VF610_CLK_PLL2_PFD_SEL], clk[VF610_CLK_PLL2_PFD2]);
+ if (ret < 0) {
+ pr_crit("Unable to re-parent '%s'\n",
+ clk[VF610_CLK_PLL2_PFD_SEL]->name);
+ return ret;
+ }
+
+ ret = clk_set_parent(clk[VF610_CLK_SYS_SEL], clk[VF610_CLK_PLL2_PFD_SEL]);
+ if (ret < 0) {
+ pr_crit("Unable to re-parent '%s'\n",
+ clk[VF610_CLK_SYS_SEL]->name);
+ return ret;
+ }
+
+ /*
+ * imx_clk_divider has no error path in its set_rate hook
+ */
+ clk_set_rate(clk[VF610_CLK_SYS_BUS], clk_get_rate(clk[VF610_CLK_SYS_SEL]));
+ clk_set_rate(clk[VF610_CLK_PLATFORM_BUS], clk_get_rate(clk[VF610_CLK_SYS_BUS]) / 3);
+
+ /*
+ * Now that we are running off of the same clock as DDRMC we
+ * shouldn't need to use clock domain crossing FIFO and
+ * asynchronous mode and instead can swithch to sychronous
+ * mode for AXI0 accesses
+ */
+ cr117 = readl(ddrmc + DDRMC_CR117);
+ cr117 |= DDRMC_CR117_AXI0_FITYPEREG_SYNC;
+ writel(cr117, ddrmc + DDRMC_CR117);
+
+ return 0;
+}
+
+static int vf610_switch_cpu_clock(void)
+{
+ int ret;
+ bool sense_enable;
+ uint32_t speed_grading;
+
+ if (!of_machine_is_compatible("fsl,vf610"))
+ return 0;
+
+ sense_enable = imx_ocotp_sense_enable(true);
+ ret = imx_ocotp_read_field(VF610_OCOTP_SPEED_GRADING, &speed_grading);
+ imx_ocotp_sense_enable(sense_enable);
+ if (ret < 0)
+ return ret;
+
+ switch (speed_grading) {
+ default:
+ pr_err("Unknown CPU speed grading %x\n", speed_grading);
+ return -EINVAL;
+
+ case VF610_SPEED_266:
+ return 0;
+
+ case VF610_SPEED_500:
+ ret = vf610_switch_cpu_clock_to_500mhz();
+ break;
+
+ case VF610_SPEED_400:
+ ret = vf610_switch_cpu_clock_to_400mhz();
+ break;
+ }
+
+ clock_notifier_call_chain();
+ return ret;
+}
+/*
+ * We can probably gain a bit of a boot speed if we switch CPU clock
+ * earlier, but if we do this we'd need to figure out a way how to
+ * re-adjust the baud rate settings of the UART for DEBUG_LL
+ * functionality, or, accept the fact that it will be unavailable
+ * after this hook is executed. Both are far from ideal, so a bit
+ * slower boot it is.
+ */
+postconsole_initcall(vf610_switch_cpu_clock);
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v3 10/20] i.MX: iomuxv3: Add low-level pad code to headers
2017-01-10 15:08 [PATCH v3 00/20] Vybrid related patches Andrey Smirnov
` (8 preceding siblings ...)
2017-01-10 15:09 ` [PATCH v3 09/20] i.MX: vf610: Ramp CPU clock to maximum frequency Andrey Smirnov
@ 2017-01-10 15:09 ` Andrey Smirnov
2017-01-10 15:09 ` [PATCH v3 11/20] i.MX: iomuxv3: Add helper macros to deconstruct iomux_v3_cfg_t values Andrey Smirnov
` (10 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: Andrey Smirnov @ 2017-01-10 15:09 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Add a basic low-level pad configuration function that can be used to
implement early boot pin configuration code as well as shared with
various iomuxv3 and vf610 drivers.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/mach-imx/include/mach/iomux-v3.h | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/arch/arm/mach-imx/include/mach/iomux-v3.h b/arch/arm/mach-imx/include/mach/iomux-v3.h
index b8cc9af..3bf457f 100644
--- a/arch/arm/mach-imx/include/mach/iomux-v3.h
+++ b/arch/arm/mach-imx/include/mach/iomux-v3.h
@@ -16,6 +16,8 @@
#ifndef __MACH_IOMUX_V3_H__
#define __MACH_IOMUX_V3_H__
+#include <io.h>
+
/*
* build IOMUX_PAD structure
*
@@ -104,6 +106,32 @@ typedef u64 iomux_v3_cfg_t;
#define IOMUX_CONFIG_SION (0x1 << 4)
+#define SHARE_MUX_CONF_REG 0x1
+#define ZERO_OFFSET_VALID 0x2
+
+static inline void iomux_v3_setup_pad(void __iomem *iomux, unsigned int flags,
+ u32 mux_reg, u32 conf_reg, u32 input_reg,
+ u32 mux_val, u32 conf_val, u32 input_val)
+{
+ const bool mux_ok = !!mux_reg || (flags & ZERO_OFFSET_VALID);
+ const bool conf_ok = !!conf_reg;
+ const bool input_ok = !!input_reg;
+
+ if (flags & SHARE_MUX_CONF_REG) {
+ mux_val |= conf_val;
+ } else {
+ if (conf_ok)
+ writel(conf_val, iomux + conf_reg);
+ }
+
+ if (mux_ok)
+ writel(mux_val, iomux + mux_reg);
+
+ if (input_ok)
+ writel(input_val, iomux + input_reg);
+}
+
+
/*
* setups a single pad in the iomuxer
*/
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v3 11/20] i.MX: iomuxv3: Add helper macros to deconstruct iomux_v3_cfg_t values
2017-01-10 15:08 [PATCH v3 00/20] Vybrid related patches Andrey Smirnov
` (9 preceding siblings ...)
2017-01-10 15:09 ` [PATCH v3 10/20] i.MX: iomuxv3: Add low-level pad code to headers Andrey Smirnov
@ 2017-01-10 15:09 ` Andrey Smirnov
2017-01-10 15:09 ` [PATCH v3 12/20] i.MX: iomuxv3: Add low-level pad configuration routine Andrey Smirnov
` (9 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: Andrey Smirnov @ 2017-01-10 15:09 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/mach-imx/include/mach/iomux-v3.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/arm/mach-imx/include/mach/iomux-v3.h b/arch/arm/mach-imx/include/mach/iomux-v3.h
index 3bf457f..1ecd11b 100644
--- a/arch/arm/mach-imx/include/mach/iomux-v3.h
+++ b/arch/arm/mach-imx/include/mach/iomux-v3.h
@@ -78,6 +78,14 @@ typedef u64 iomux_v3_cfg_t;
((iomux_v3_cfg_t)(_sel_input_ofs) << MUX_SEL_INPUT_OFS_SHIFT) | \
((iomux_v3_cfg_t)(_sel_input) << MUX_SEL_INPUT_SHIFT))
+#define IOMUX_PAD_FIELD(name, pad) (((pad) & name##_MASK) >> name##_SHIFT)
+#define IOMUX_CTRL_OFS(pad) IOMUX_PAD_FIELD(MUX_CTRL_OFS, pad)
+#define IOMUX_MODE(pad) IOMUX_PAD_FIELD(MUX_MODE, pad)
+#define IOMUX_SEL_INPUT_OFS(pad) IOMUX_PAD_FIELD(MUX_SEL_INPUT_OFS, pad)
+#define IOMUX_SEL_INPUT(pad) IOMUX_PAD_FIELD(MUX_SEL_INPUT, pad)
+#define IOMUX_PAD_CTRL_OFS(pad) IOMUX_PAD_FIELD(MUX_PAD_CTRL_OFS, pad)
+#define IOMUX_PAD_CTRL(pad) IOMUX_PAD_FIELD(MUX_PAD_CTRL, pad)
+
#define NEW_PAD_CTRL(cfg, pad) (((cfg) & ~MUX_PAD_CTRL_MASK) | MUX_PAD_CTRL(pad))
/*
* Use to set PAD control
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v3 12/20] i.MX: iomuxv3: Add low-level pad configuration routine
2017-01-10 15:08 [PATCH v3 00/20] Vybrid related patches Andrey Smirnov
` (10 preceding siblings ...)
2017-01-10 15:09 ` [PATCH v3 11/20] i.MX: iomuxv3: Add helper macros to deconstruct iomux_v3_cfg_t values Andrey Smirnov
@ 2017-01-10 15:09 ` Andrey Smirnov
2017-01-10 15:09 ` [PATCH v3 13/20] i.MX6: sabresd: Remove magic numbers in setup_uart Andrey Smirnov
` (8 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: Andrey Smirnov @ 2017-01-10 15:09 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Add low-level pad configuration routine that can be used by early boot
code as well as leveraged by pinmux driver.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/mach-imx/include/mach/iomux-v3.h | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/arch/arm/mach-imx/include/mach/iomux-v3.h b/arch/arm/mach-imx/include/mach/iomux-v3.h
index 1ecd11b..f877aad 100644
--- a/arch/arm/mach-imx/include/mach/iomux-v3.h
+++ b/arch/arm/mach-imx/include/mach/iomux-v3.h
@@ -139,6 +139,23 @@ static inline void iomux_v3_setup_pad(void __iomem *iomux, unsigned int flags,
writel(input_val, iomux + input_reg);
}
+static inline void imx_setup_pad(void __iomem *iomux, iomux_v3_cfg_t pad)
+{
+ uint32_t pad_ctrl;
+
+ pad_ctrl = IOMUX_PAD_CTRL(pad);
+ pad_ctrl = (pad_ctrl & NO_PAD_CTRL) ? 0 : pad_ctrl,
+
+ iomux_v3_setup_pad(iomux, 0,
+ IOMUX_CTRL_OFS(pad),
+ IOMUX_PAD_CTRL_OFS(pad),
+ IOMUX_SEL_INPUT_OFS(pad),
+ IOMUX_MODE(pad),
+ pad_ctrl,
+ IOMUX_SEL_INPUT(pad));
+}
+
+
/*
* setups a single pad in the iomuxer
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v3 13/20] i.MX6: sabresd: Remove magic numbers in setup_uart
2017-01-10 15:08 [PATCH v3 00/20] Vybrid related patches Andrey Smirnov
` (11 preceding siblings ...)
2017-01-10 15:09 ` [PATCH v3 12/20] i.MX: iomuxv3: Add low-level pad configuration routine Andrey Smirnov
@ 2017-01-10 15:09 ` Andrey Smirnov
2017-01-10 15:09 ` [PATCH v3 14/20] i.MX: iomuxv3: Use helper functions in iomux-v3.h Andrey Smirnov
` (7 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: Andrey Smirnov @ 2017-01-10 15:09 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Remove magic numbers in setup_uart and replace them with calls to
iomuxv3 helper functions.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/boards/freescale-mx6-sabresd/lowlevel.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/arch/arm/boards/freescale-mx6-sabresd/lowlevel.c b/arch/arm/boards/freescale-mx6-sabresd/lowlevel.c
index b329f46..5743dbc 100644
--- a/arch/arm/boards/freescale-mx6-sabresd/lowlevel.c
+++ b/arch/arm/boards/freescale-mx6-sabresd/lowlevel.c
@@ -2,6 +2,7 @@
#include <common.h>
#include <linux/sizes.h>
#include <mach/generic.h>
+#include <mach/iomux-mx6.h>
#include <asm/barebox-arm-head.h>
#include <asm/barebox-arm.h>
@@ -11,12 +12,8 @@ static inline void setup_uart(void)
imx6_ungate_all_peripherals();
- writel(0x1b0b1, iomuxbase + 0x0650);
- writel(3, iomuxbase + 0x0280);
-
- writel(0x1b0b1, iomuxbase + 0x0654);
- writel(3, iomuxbase + 0x0284);
- writel(1, iomuxbase + 0x0920);
+ imx_setup_pad(iomuxbase, MX6Q_PAD_CSI0_DAT10__UART1_TXD);
+ imx_setup_pad(iomuxbase, MX6Q_PAD_CSI0_DAT11__UART1_RXD);
imx6_uart_setup_ll();
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v3 14/20] i.MX: iomuxv3: Use helper functions in iomux-v3.h
2017-01-10 15:08 [PATCH v3 00/20] Vybrid related patches Andrey Smirnov
` (12 preceding siblings ...)
2017-01-10 15:09 ` [PATCH v3 13/20] i.MX6: sabresd: Remove magic numbers in setup_uart Andrey Smirnov
@ 2017-01-10 15:09 ` Andrey Smirnov
2017-01-10 15:09 ` [PATCH v3 15/20] i.MX: vf610: Add low-level pin configuration helper Andrey Smirnov
` (6 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: Andrey Smirnov @ 2017-01-10 15:09 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Avoid code duplication by using helper functions from iomux-v3.h
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/pinctrl/imx-iomux-v3.c | 38 ++++----------------------------------
1 file changed, 4 insertions(+), 34 deletions(-)
diff --git a/drivers/pinctrl/imx-iomux-v3.c b/drivers/pinctrl/imx-iomux-v3.c
index 4b3f033..bc93140 100644
--- a/drivers/pinctrl/imx-iomux-v3.c
+++ b/drivers/pinctrl/imx-iomux-v3.c
@@ -31,46 +31,17 @@ struct imx_iomux_v3 {
};
static void __iomem *iomuxv3_base;
-static struct device_d *iomuxv3_dev;
-static void imx_iomuxv3_setup_single(void __iomem *base, struct device_d *dev,
- u32 mux_reg, u32 conf_reg, u32 input_reg,
- u32 mux_val, u32 conf_val, u32 input_val)
-{
- dev_dbg(dev,
- "mux: 0x%08x -> 0x%04x, conf: 0x%08x -> 0x%04x input: 0x%08x -> 0x%04x\n",
- mux_val, mux_reg, conf_val, conf_reg, input_val, input_reg);
-
- if (mux_reg)
- writel(mux_val, base + mux_reg);
- if (conf_reg)
- writel(conf_val, base + conf_reg);
- if (input_reg)
- writel(input_val, base + input_reg);
-}
/*
* configures a single pad in the iomuxer
*/
int mxc_iomux_v3_setup_pad(iomux_v3_cfg_t pad)
{
- u32 mux_reg = (pad & MUX_CTRL_OFS_MASK) >> MUX_CTRL_OFS_SHIFT;
- u32 mux_val = (pad & MUX_MODE_MASK) >> MUX_MODE_SHIFT;
- u32 input_reg = (pad & MUX_SEL_INPUT_OFS_MASK) >> MUX_SEL_INPUT_OFS_SHIFT;
- u32 input_val = (pad & MUX_SEL_INPUT_MASK) >> MUX_SEL_INPUT_SHIFT;
- u32 conf_reg = (pad & MUX_PAD_CTRL_OFS_MASK) >> MUX_PAD_CTRL_OFS_SHIFT;
- u32 conf_val = (pad & MUX_PAD_CTRL_MASK) >> MUX_PAD_CTRL_SHIFT;
-
if (!iomuxv3_base)
return -EINVAL;
- if (conf_val & NO_PAD_CTRL)
- conf_reg = 0;
-
- imx_iomuxv3_setup_single(iomuxv3_base, iomuxv3_dev,
- mux_reg, conf_reg, input_reg,
- mux_val, conf_val, input_val);
-
+ imx_setup_pad(iomuxv3_base, pad);
return 0;
}
EXPORT_SYMBOL(mxc_iomux_v3_setup_pad);
@@ -140,9 +111,9 @@ static int imx_iomux_v3_set_state(struct pinctrl_device *pdev, struct device_nod
if (conf_val & IMX_DT_NO_PAD_CTL)
conf_reg = 0;
- imx_iomuxv3_setup_single(iomux->base, iomux->pinctrl.dev,
- mux_reg, conf_reg, input_reg,
- mux_val, conf_val, input_val);
+ iomux_v3_setup_pad(iomux->base, 0,
+ mux_reg, conf_reg, input_reg,
+ mux_val, conf_val, input_val);
}
return 0;
@@ -183,7 +154,6 @@ static int imx_iomux_v3_probe(struct device_d *dev)
if (IS_ERR(iores))
return PTR_ERR(iores);
iomuxv3_base = IOMEM(iores->start);
- iomuxv3_dev = dev;
if (IS_ENABLED(CONFIG_PINCTRL) && dev->device_node)
ret = imx_pinctrl_dt(dev, iomuxv3_base);
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v3 15/20] i.MX: vf610: Add low-level pin configuration helper
2017-01-10 15:08 [PATCH v3 00/20] Vybrid related patches Andrey Smirnov
` (13 preceding siblings ...)
2017-01-10 15:09 ` [PATCH v3 14/20] i.MX: iomuxv3: Use helper functions in iomux-v3.h Andrey Smirnov
@ 2017-01-10 15:09 ` Andrey Smirnov
2017-01-10 15:09 ` [PATCH v3 16/20] i.MX: iomux-vf610: Add missing pad definitions Andrey Smirnov
` (5 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: Andrey Smirnov @ 2017-01-10 15:09 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Add low-level pin configuration helper for early boot code, and convert
pinctrl driver to use that code as well.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/mach-imx/include/mach/iomux-vf610.h | 15 +++++++++++++++
drivers/pinctrl/pinctrl-vf610.c | 11 ++++++-----
2 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/arch/arm/mach-imx/include/mach/iomux-vf610.h b/arch/arm/mach-imx/include/mach/iomux-vf610.h
index 1535628..84a1eb5 100644
--- a/arch/arm/mach-imx/include/mach/iomux-vf610.h
+++ b/arch/arm/mach-imx/include/mach/iomux-vf610.h
@@ -223,4 +223,19 @@ enum {
VF610_PAD_DDR_ODT0__DDR_ODT_1 = IOMUX_PAD(0x02d8, 0x02d8, 0, __NA_, 0, VF610_DDR_PAD_CTRL),
};
+#define PINCTRL_VF610_MUX_SHIFT 20
+
+
+static inline void vf610_setup_pad(void __iomem *iomux, iomux_v3_cfg_t pad)
+{
+ iomux_v3_setup_pad(iomux, SHARE_MUX_CONF_REG | ZERO_OFFSET_VALID,
+ IOMUX_CTRL_OFS(pad),
+ IOMUX_PAD_CTRL_OFS(pad),
+ IOMUX_SEL_INPUT_OFS(pad),
+ IOMUX_MODE(pad) << PINCTRL_VF610_MUX_SHIFT,
+ IOMUX_PAD_CTRL(pad),
+ IOMUX_SEL_INPUT(pad));
+}
+
+
#endif /* __IOMUX_VF610_H__ */
diff --git a/drivers/pinctrl/pinctrl-vf610.c b/drivers/pinctrl/pinctrl-vf610.c
index b479bf2..4234263 100644
--- a/drivers/pinctrl/pinctrl-vf610.c
+++ b/drivers/pinctrl/pinctrl-vf610.c
@@ -24,9 +24,10 @@
#include <malloc.h>
#include <gpio.h>
+#include <mach/iomux-vf610.h>
+
enum {
PINCTRL_VF610_MUX_LINE_SIZE = 20,
- PINCTRL_VF610_MUX_SHIFT = 20,
PINCTRL_VF610_IBE = 1 << 0,
PINCTRL_VF610_OBE = 1 << 1,
@@ -60,17 +61,17 @@ static int pinctrl_vf610_set_state(struct pinctrl_device *pdev,
npins = size / PINCTRL_VF610_MUX_LINE_SIZE;
for (i = 0; i < npins; i++) {
+ iomux_v3_cfg_t pad;
u32 mux_reg = be32_to_cpu(*list++);
u32 input_reg = be32_to_cpu(*list++);
u32 mux_val = be32_to_cpu(*list++);
u32 input_val = be32_to_cpu(*list++);
u32 conf_val = be32_to_cpu(*list++);
- writel(mux_val << PINCTRL_VF610_MUX_SHIFT | conf_val,
- iomux->base + mux_reg);
+ pad = IOMUX_PAD(mux_reg, mux_reg, mux_val,
+ input_reg, input_val, conf_val);
- if (input_reg)
- writel(input_val, iomux->base + input_reg);
+ vf610_setup_pad(iomux->base, pad);
}
return 0;
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v3 16/20] i.MX: iomux-vf610: Add missing pad definitions
2017-01-10 15:08 [PATCH v3 00/20] Vybrid related patches Andrey Smirnov
` (14 preceding siblings ...)
2017-01-10 15:09 ` [PATCH v3 15/20] i.MX: vf610: Add low-level pin configuration helper Andrey Smirnov
@ 2017-01-10 15:09 ` Andrey Smirnov
2017-01-10 15:09 ` [PATCH v3 17/20] i.MX: imx-usb-phy: Add VF610 OF compatiblity string Andrey Smirnov
` (4 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: Andrey Smirnov @ 2017-01-10 15:09 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/mach-imx/include/mach/iomux-vf610.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm/mach-imx/include/mach/iomux-vf610.h b/arch/arm/mach-imx/include/mach/iomux-vf610.h
index 84a1eb5..b9e509b 100644
--- a/arch/arm/mach-imx/include/mach/iomux-vf610.h
+++ b/arch/arm/mach-imx/include/mach/iomux-vf610.h
@@ -163,9 +163,13 @@ enum {
VF610_PAD_PTD22__NF_IO6 = IOMUX_PAD(0x0120, 0x0120, 2, __NA_, 0, VF610_NFC_IO_PAD_CTRL),
VF610_PAD_PTD21__NF_IO5 = IOMUX_PAD(0x0124, 0x0124, 2, __NA_, 0, VF610_NFC_IO_PAD_CTRL),
VF610_PAD_PTD20__NF_IO4 = IOMUX_PAD(0x0128, 0x0128, 2, __NA_, 0, VF610_NFC_IO_PAD_CTRL),
+ VF610_PAD_PTD19__GPIO_75 = IOMUX_PAD(0x012C, 0x012C, 0, __NA_, 0, VF610_GPIO_PAD_CTRL),
VF610_PAD_PTD19__NF_IO3 = IOMUX_PAD(0x012c, 0x012c, 2, __NA_, 0, VF610_NFC_IO_PAD_CTRL),
+ VF610_PAD_PTD18__GPIO_76 = IOMUX_PAD(0x0120, 0x0130, 0, __NA_, 0, VF610_GPIO_PAD_CTRL),
VF610_PAD_PTD18__NF_IO2 = IOMUX_PAD(0x0130, 0x0130, 2, __NA_, 0, VF610_NFC_IO_PAD_CTRL),
+ VF610_PAD_PTD17__GPIO_77 = IOMUX_PAD(0x0134, 0x0134, 0, __NA_, 0, VF610_GPIO_PAD_CTRL),
VF610_PAD_PTD17__NF_IO1 = IOMUX_PAD(0x0134, 0x0134, 2, __NA_, 0, VF610_NFC_IO_PAD_CTRL),
+ VF610_PAD_PTD16__GPIO_78 = IOMUX_PAD(0x0138, 0x0138, 0, __NA_, 0, VF610_GPIO_PAD_CTRL),
VF610_PAD_PTD16__NF_IO0 = IOMUX_PAD(0x0138, 0x0138, 2, __NA_, 0, VF610_NFC_IO_PAD_CTRL),
VF610_PAD_PTB24__NF_WE_B = IOMUX_PAD(0x0178, 0x0178, 5, __NA_, 0, VF610_NFC_CN_PAD_CTRL),
VF610_PAD_PTB25__NF_CE0_B = IOMUX_PAD(0x017c, 0x017c, 5, __NA_, 0, VF610_NFC_CN_PAD_CTRL),
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v3 17/20] i.MX: imx-usb-phy: Add VF610 OF compatiblity string
2017-01-10 15:08 [PATCH v3 00/20] Vybrid related patches Andrey Smirnov
` (15 preceding siblings ...)
2017-01-10 15:09 ` [PATCH v3 16/20] i.MX: iomux-vf610: Add missing pad definitions Andrey Smirnov
@ 2017-01-10 15:09 ` Andrey Smirnov
2017-01-10 15:09 ` [PATCH v3 18/20] i.MX: Default CONFIG_USB_IMX_PHY to 'y' on Vybrid Andrey Smirnov
` (3 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: Andrey Smirnov @ 2017-01-10 15:09 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
From looking at analogous Linux driver code it seems that all of the
differences between code "imx23-usbphy" and "vf610-usbphy" pertain to
suspend/resume functionality, which shouldn't affetct Barebox. As a
result this commit just adds a compatiblity string and no other code.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/usb/imx/imx-usb-phy.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/imx/imx-usb-phy.c b/drivers/usb/imx/imx-usb-phy.c
index 9f46f8d..274153b 100644
--- a/drivers/usb/imx/imx-usb-phy.c
+++ b/drivers/usb/imx/imx-usb-phy.c
@@ -168,6 +168,8 @@ static __maybe_unused struct of_device_id imx_usbphy_dt_ids[] = {
{
.compatible = "fsl,imx23-usbphy",
}, {
+ .compatible = "fsl,vf610-usbphy",
+ }, {
/* sentinel */
},
};
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v3 18/20] i.MX: Default CONFIG_USB_IMX_PHY to 'y' on Vybrid
2017-01-10 15:08 [PATCH v3 00/20] Vybrid related patches Andrey Smirnov
` (16 preceding siblings ...)
2017-01-10 15:09 ` [PATCH v3 17/20] i.MX: imx-usb-phy: Add VF610 OF compatiblity string Andrey Smirnov
@ 2017-01-10 15:09 ` Andrey Smirnov
2017-01-10 15:09 ` [PATCH v3 19/20] i.MX: imx-usb-misc: Add Vybrid support Andrey Smirnov
` (2 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: Andrey Smirnov @ 2017-01-10 15:09 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/usb/imx/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/imx/Kconfig b/drivers/usb/imx/Kconfig
index b0c6a41..8e6f315 100644
--- a/drivers/usb/imx/Kconfig
+++ b/drivers/usb/imx/Kconfig
@@ -16,4 +16,4 @@ config USB_IMX_CHIPIDEA
config USB_IMX_PHY
bool
- default y if ARCH_IMX6 && GENERIC_PHY
+ default y if (ARCH_IMX6 || ARCH_VF610) && GENERIC_PHY
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v3 19/20] i.MX: imx-usb-misc: Add Vybrid support
2017-01-10 15:08 [PATCH v3 00/20] Vybrid related patches Andrey Smirnov
` (17 preceding siblings ...)
2017-01-10 15:09 ` [PATCH v3 18/20] i.MX: Default CONFIG_USB_IMX_PHY to 'y' on Vybrid Andrey Smirnov
@ 2017-01-10 15:09 ` Andrey Smirnov
2017-01-10 15:09 ` [PATCH v3 20/20] i.MX: vf610-twr: Remove MSCM setup code Andrey Smirnov
2017-01-12 6:41 ` [PATCH v3 00/20] Vybrid related patches Sascha Hauer
20 siblings, 0 replies; 22+ messages in thread
From: Andrey Smirnov @ 2017-01-10 15:09 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Add code to do usbmisc initialization on VF610 family of SoCs. Based on
analogous code from Linux kernel.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/usb/imx/imx-usb-misc.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/usb/imx/imx-usb-misc.c b/drivers/usb/imx/imx-usb-misc.c
index 7c18ca2..9cae440 100644
--- a/drivers/usb/imx/imx-usb-misc.c
+++ b/drivers/usb/imx/imx-usb-misc.c
@@ -422,6 +422,28 @@ static __maybe_unused struct imx_usb_misc_data mx6_data = {
.post_init = mx6_post_init,
};
+#define VF610_OVER_CUR_DIS BIT(7)
+
+static __maybe_unused int vf610_initialize_usb_hw(void __iomem *base, int port,
+ unsigned int flags)
+{
+ u32 reg;
+
+ if (port >= 1)
+ return -EINVAL;
+
+ if (flags & MXC_EHCI_DISABLE_OVERCURRENT) {
+ reg = readl(base);
+ writel(reg | VF610_OVER_CUR_DIS, base);
+ }
+
+ return 0;
+}
+
+static __maybe_unused struct imx_usb_misc_data vf610_data = {
+ .init = vf610_initialize_usb_hw,
+};
+
static struct platform_device_id imx_usbmisc_ids[] = {
#ifdef CONFIG_ARCH_IMX25
{
@@ -519,6 +541,12 @@ static __maybe_unused struct of_device_id imx_usbmisc_dt_ids[] = {
.data = &mx6_data,
},
#endif
+#ifdef CONFIG_ARCH_VF610
+ {
+ .compatible = "fsl,vf610-usbmisc",
+ .data = &vf610_data,
+ },
+#endif
{
/* sentinel */
},
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v3 20/20] i.MX: vf610-twr: Remove MSCM setup code
2017-01-10 15:08 [PATCH v3 00/20] Vybrid related patches Andrey Smirnov
` (18 preceding siblings ...)
2017-01-10 15:09 ` [PATCH v3 19/20] i.MX: imx-usb-misc: Add Vybrid support Andrey Smirnov
@ 2017-01-10 15:09 ` Andrey Smirnov
2017-01-12 6:41 ` [PATCH v3 00/20] Vybrid related patches Sascha Hauer
20 siblings, 0 replies; 22+ messages in thread
From: Andrey Smirnov @ 2017-01-10 15:09 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Recent kernel versions should have appropriate driver code that sets up
interrupt rounting correctly, so there's no need for that to be done in
the bootloader.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/boards/freescale-vf610-twr/lowlevel.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/arch/arm/boards/freescale-vf610-twr/lowlevel.c b/arch/arm/boards/freescale-vf610-twr/lowlevel.c
index 6504273..109d44e 100644
--- a/arch/arm/boards/freescale-vf610-twr/lowlevel.c
+++ b/arch/arm/boards/freescale-vf610-twr/lowlevel.c
@@ -29,14 +29,9 @@ ENTRY_FUNCTION(start_vf610_twr, r0, r1, r2)
{
int i;
void *fdt;
- void __iomem *mscm = IOMEM(VF610_MSCM_BASE_ADDR);
vf610_cpu_lowlevel_init();
- for (i = 0; i < VF610_MSCM_IRSPRC_NUM; i++)
- writew(VF610_MSCM_IRSPRC_CP0_EN,
- mscm + VF610_MSCM_IRSPRC(i));
-
if (IS_ENABLED(CONFIG_DEBUG_LL))
setup_uart();
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v3 00/20] Vybrid related patches
2017-01-10 15:08 [PATCH v3 00/20] Vybrid related patches Andrey Smirnov
` (19 preceding siblings ...)
2017-01-10 15:09 ` [PATCH v3 20/20] i.MX: vf610-twr: Remove MSCM setup code Andrey Smirnov
@ 2017-01-12 6:41 ` Sascha Hauer
20 siblings, 0 replies; 22+ messages in thread
From: Sascha Hauer @ 2017-01-12 6:41 UTC (permalink / raw)
To: Andrey Smirnov; +Cc: barebox
On Tue, Jan 10, 2017 at 07:08:53AM -0800, Andrey Smirnov wrote:
> Hi everyone,
>
> Here goes third version of the "Vybrid related patches" patchset,
> here's what's new since v2 (for v2 see[3]):
>
> - Dropped incorrect "i.MX: ocotp: Simplify MAC address storing
> logic" patch
>
> - IOMUXv3 header helper functions converted to use macros
> instead of packed struct
>
> - Minor spelling corections
>
> As a reminder here's the list of changes since v1(for v1
> see [1]):
>
> - Converted multi-MAC patch to name the device variables as per
> discussion with Sascha and Stefan [2]. (Stefan, I hope you don't
> mind my taking the liberty to implement this and it is not too
> much inconvenice to rebase your patch on top of this change. Let
> me know if there's a better way for us to sync up on this)
>
> - Dropped configurability from VF610 clock ramping code
>
> - Converted said code to use imx_ocotp_read_field
>
> - Added fusemap for VF610 to accomodate previous change
>
> - Added imx_ocotp_sense_enable() API to accomodate reading speed
> grading information on VF610 (it doesn't seem to be read into
> shadow memory on chip's bootup)
>
> - Add a number of small code cleanups for OCOTP driver
>
>
> [1] http://lists.infradead.org/pipermail/barebox/2016-December/028652.html
> [2] http://lists.infradead.org/pipermail/barebox/2016-December/028669.html
> [3] http://lists.infradead.org/pipermail/barebox/2016-December/028727.html
>
>
> Andrey Smirnov (20):
> i.MX: esdhc: Enable host->clk during initialization
> i.MX: ocotp: Move memory reversing into a subroutine
> i.MX: ocotp: Add provisions for storing multiple MAC addresses
> i.MX: ocotp: Initialize OCOTP as early as possible
> i.MX: clk: Add IMX_PLLV3_SYS_VF610 subtype
> i.MX: ocotp: Add imx_ocotp_sense_enable()
> i.MX: imx6-fusemap: Fix SJC_RESP_LOCK width
> i.MX: Add fusemap for VF610
> i.MX: vf610: Ramp CPU clock to maximum frequency
> i.MX: iomuxv3: Add low-level pad code to headers
> i.MX: iomuxv3: Add helper macros to deconstruct iomux_v3_cfg_t values
> i.MX: iomuxv3: Add low-level pad configuration routine
> i.MX6: sabresd: Remove magic numbers in setup_uart
> i.MX: iomuxv3: Use helper functions in iomux-v3.h
> i.MX: vf610: Add low-level pin configuration helper
> i.MX: iomux-vf610: Add missing pad definitions
> i.MX: imx-usb-phy: Add VF610 OF compatiblity string
> i.MX: Default CONFIG_USB_IMX_PHY to 'y' on Vybrid
> i.MX: imx-usb-misc: Add Vybrid support
> i.MX: vf610-twr: Remove MSCM setup code
Applied, thanks
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 22+ messages in thread