Discussion:
[PATCH 0/6] assorted fixes, mainly at91 related
Sam Ravnborg
2017-07-19 21:20:13 UTC
Permalink
While working on enabling DT support for at91sam9263ek
I have stumbled over a fev issues that are
all fixed in the following patches.

Some of the issues may only be relevant when we have more at91
boards supporting DT.
None of the fixes are critical and are thus mainly -next material.

Sam

Sam Ravnborg (6):
arm: at91 bootstrap: declare local function static
macb: fix clock probing with DT
clk: at91: fix clk-main
pinctrl: at91: move initcalls to postcore_initcall
mci: atmel_mci: fix devinfo DEV with OF enabled
atmel_lcdfb: fix so the correct guard_time is used

arch/arm/mach-at91/bootstrap.c | 2 +-
drivers/clk/at91/clk-main.c | 1 +
drivers/mci/atmel_mci.c | 3 +--
drivers/net/macb.c | 4 ++--
drivers/pinctrl/pinctrl-at91.c | 4 ++--
drivers/video/atmel_lcdfb.c | 2 +-
drivers/video/atmel_lcdfb_core.c | 1 +
7 files changed, 9 insertions(+), 8 deletions(-)
Sam Ravnborg
2017-07-19 21:21:00 UTC
Permalink
With DT enabled the following was logged:

macb fffbc000.ethernet: no macb_clk
macb fffbc000.ethernet: probe failed: Invalid argument

The clock probed was with the name used in a non-DT setup.
Fix so we use a proper name ("pclk") with DT, and keep
current fuctionality without DT.

Signed-off-by: Sam Ravnborg <***@ravnborg.org>
Acked-by: Andrey Smirnov <***@gmail.com>
---
drivers/net/macb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 739a3dfbe..7721bcb56 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -666,7 +666,7 @@ static int macb_probe(struct device_d *dev)
macb->miibus.dev.device_node = mdiobus;

macb->phy_addr = -1;
- pclk_name = NULL;
+ pclk_name = "pclk";
} else {
dev_err(dev, "macb: no platform_data\n");
return -ENODEV;
@@ -681,7 +681,7 @@ static int macb_probe(struct device_d *dev)
* Do some basic initialization so that we at least can talk
* to the PHY
*/
- macb->pclk = clk_get(dev, "macb_clk");
+ macb->pclk = clk_get(dev, pclk_name);
if (IS_ERR(macb->pclk)) {
dev_err(dev, "no macb_clk\n");
return PTR_ERR(macb->pclk);
--
2.12.0
Sam Ravnborg
2017-07-19 21:20:59 UTC
Permalink
From: Sam Ravnborg <***@skov.dk>

Function is only used in this file and no prototype exist
in any header.

Signed-off-by: Sam Ravnborg <***@ravnborg.org>
---
arch/arm/mach-at91/bootstrap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-at91/bootstrap.c b/arch/arm/mach-at91/bootstrap.c
index 9dd575b74..5d21b2d02 100644
--- a/arch/arm/mach-at91/bootstrap.c
+++ b/arch/arm/mach-at91/bootstrap.c
@@ -149,7 +149,7 @@ static void boot_reset_action(struct menu *m, struct menu_entry *me)
restart_machine();
}

-void at91_bootstrap_menu(void)
+static void at91_bootstrap_menu(void)
{
struct menu *m;
struct menu_entry *me;
--
2.12.0
Sam Ravnborg
2017-07-19 21:21:03 UTC
Permalink
devinfo DEV resulted in a NULL pointer expection.
As platform_data is only valid in non-DT setup,
fix this so we no longer reference platform_data
outside the probe function

Signed-off-by: Sam Ravnborg <***@ravnborg.org>
---
drivers/mci/atmel_mci.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mci/atmel_mci.c b/drivers/mci/atmel_mci.c
index 317cf4602..0d3b245ce 100644
--- a/drivers/mci/atmel_mci.c
+++ b/drivers/mci/atmel_mci.c
@@ -474,7 +474,6 @@ static int atmci_request(struct mci_host *mci, struct mci_cmd *cmd, struct mci_d
static void atmci_info(struct device_d *mci_dev)
{
struct atmel_mci *host = mci_dev->priv;
- struct atmel_mci_platform_data *pd = host->hw_dev->platform_data;

printf(" Bus data width: %d bit\n", host->mci.bus_width);

@@ -490,7 +489,7 @@ static void atmci_info(struct device_d *mci_dev)
printf("- %u Hz upper limit", host->mci.f_max);

printf("\n Card detection support: %s\n",
- gpio_is_valid(pd->detect_pin) ? "yes" : "no");
+ gpio_is_valid(host->detect_pin) ? "yes" : "no");

}
/*
--
2.12.0
Sam Ravnborg
2017-07-19 21:21:01 UTC
Permalink
Following warning was reported during boot with
at91sam9263ek with DT enabled.

"Main crystal frequency not set, using approximate value"

This occured due to a missing parent in clk_rm9200_main.

Signed-off-by: Sam Ravnborg <***@ravnborg.org>
Cc: Andrey Smirnov <***@gmail.com>
---
drivers/clk/at91/clk-main.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/clk/at91/clk-main.c b/drivers/clk/at91/clk-main.c
index 55bc618a3..77dfdef51 100644
--- a/drivers/clk/at91/clk-main.c
+++ b/drivers/clk/at91/clk-main.c
@@ -391,6 +391,7 @@ at91_clk_register_rm9200_main(struct regmap *regmap,

clkmain = xzalloc(sizeof(*clkmain));

+ clkmain->parent = parent_name;
clkmain->clk.name = name;
clkmain->clk.ops = &rm9200_main_ops;
clkmain->clk.parent_names = &clkmain->parent;
--
2.12.0
Sam Ravnborg
2017-07-19 21:21:02 UTC
Permalink
Move initcalls to postcore_initcall() like all other pinctrl drivers.
This will init this driver earlier right after pinctrl driver.

No know bugs are fixed by this change.

Signed-off-by: Sam Ravnborg <***@ravnborg.org>
---
drivers/pinctrl/pinctrl-at91.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index d52c184e4..030386977 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -538,7 +538,7 @@ static int at91_pinctrl_init(void)
{
return platform_driver_register(&at91_pinctrl_driver);
}
-coredevice_initcall(at91_pinctrl_init);
+postcore_initcall(at91_pinctrl_init);

static int at91_gpio_get(struct gpio_chip *chip, unsigned offset)
{
@@ -718,4 +718,4 @@ static int at91_gpio_init(void)
{
return platform_driver_register(&at91_gpio_driver);
}
-coredevice_initcall(at91_gpio_init);
+postcore_initcall(at91_gpio_init);
--
2.12.0
Sam Ravnborg
2017-07-19 21:21:04 UTC
Permalink
guard_time is set in platform data but was never copied
to atmel_lcdfb_info thus a guard_time of 0 have always been used.

This issue was found during code inspection and no know
bugs is fixed by this.

Signed-off-by: Sam Ravnborg <***@ravnborg.org>
---
drivers/video/atmel_lcdfb.c | 2 +-
drivers/video/atmel_lcdfb_core.c | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index 20204c1dd..a0e41d10c 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -85,7 +85,7 @@ static void atmel_lcdfb_start(struct atmel_lcdfb_info *sinfo)

lcdc_writel(sinfo, ATMEL_LCDC_DMACON, pdata->default_dmacon);
lcdc_writel(sinfo, ATMEL_LCDC_PWRCON,
- (pdata->guard_time << ATMEL_LCDC_GUARDT_OFFSET)
+ (sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET)
| ATMEL_LCDC_PWR);
}

diff --git a/drivers/video/atmel_lcdfb_core.c b/drivers/video/atmel_lcdfb_core.c
index 555799ea4..f6c5d7c05 100644
--- a/drivers/video/atmel_lcdfb_core.c
+++ b/drivers/video/atmel_lcdfb_core.c
@@ -258,6 +258,7 @@ int atmel_lcdc_register(struct device_d *dev, struct atmel_lcdfb_devdata *data)

sinfo = xzalloc(sizeof(*sinfo));
sinfo->pdata = pdata;
+ sinfo->guard_time = pdata->guard_time;
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
--
2.12.0
Lucas Stach
2017-07-20 13:05:43 UTC
Permalink
Post by Sam Ravnborg
While working on enabling DT support for at91sam9263ek
I have stumbled over a fev issues that are
all fixed in the following patches.
Some of the issues may only be relevant when we have more at91
boards supporting DT.
None of the fixes are critical and are thus mainly -next material.
Sam
arm: at91 bootstrap: declare local function static
macb: fix clock probing with DT
clk: at91: fix clk-main
pinctrl: at91: move initcalls to postcore_initcall
mci: atmel_mci: fix devinfo DEV with OF enabled
atmel_lcdfb: fix so the correct guard_time is used
Thanks, applied on -next.

Regards,
Lucas

Loading...