This pull request brings in a build fix for arm64 with bcm2835

enabled, and fixes the driver in the presence of -EPROBE_DEFER.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE/JuuFDWp9/ZkuCBXtdYpNtH8nugFAlyIEPoACgkQtdYpNtH8
 nuiYqg/9H21xnIvbzN2V9SeaZvKp9XYLw9wK+kLlQl0oFxeXanTbKLU8AEDkxCI/
 tnjlNtIWKa09cv1n6hiMKlNRAEXqy7sg2o06twGfXTpHka9Z289HH6CXxXK75GIG
 NqE/u+hNLRZeWQMiiOC+RodGMUH2Dn5+whl8cMb3bUhLvql7WlyCUipiQxhMEW66
 b8TAomUzqeGSWd8SALXtrnO0d6NNpQyQFQIqoJ5Nf/EZylBasDQlAgpHsfYpJALl
 vX1UDPOHs25nunuZNuQY9HLxkWL5yTCYnKHXN/f4HMLXpSdg48+pibLyGULfn9qn
 PYjeLyLWOUYOcC490FpB1oNz7jOaj/Q7TEipuhGuMdgCH5ZR+F6jKKp5q2i8DpPc
 GABWyYdPrZ9riUkQ3uu0eTlted3+V/SpOieJ8gi51vcG1KEG4CHKRHouXzJgzQ7N
 KHGGjq9EviHxLxlGQ+mPK0pFsXXii3tAVyvPjwoUNvr2kWIJ0xNXlTF+Ap4rTKA+
 o6Q5JFKWJdf+lgqlFBRV148T8KldWfsvmPIHhZn5X7fMAZboEarSbuMb9G2IfiL5
 wR3Lny/348E3pbVMa1aSQSWteslz1mrxx6j03fweX1iSGTJUFNdMadCQVeCvMa/e
 ARHAsYW5cX1naNvY+lr21MvA63xHaZ8qO0Mlebmi1enDjj6sXCM=
 =UemV
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEm+Rq3+YGJdiR9yuFh9CWnEQHBwQFAlyP1fcACgkQh9CWnEQH
 BwR4Yw//frUR+z1K5caZyZqjTTS/Pi7fDbVCOENG/P0Ea8EQsVvFTzapnHoiM6Ed
 wtJzop/0KnnMypgMXTSij+yJoI7moP6bEUqBSy2GNidqgbGxdMjXcriFhb2AO4L3
 WSEYkHNH4zoa5nIabyZ+jAWdyfxMU7Fq3dJXkKQAe3bovFw/8iWUpHvmdlfR7M5M
 q6Q0iuP5oZiD/oQBRh/SsynW4qwGb5uxLu+x2szD7M/VEqJgXv3aJHOu36kbdX3Y
 wtdeaofYpH6EMPSY2LyxVSXIMTpsX570o9r5LnJ98V75ZLY8p1vGLIJZdGKS2hXn
 C1DzqRXCdhKvr83iNixvsbC9/xmxpoyiFzcUlckctsh3QR3LRVLg4OHfLf1J3Jid
 3KBL0mwXaSyO224Bgtka6sGEqw6fpcmyI8pvPNSY2mELY/GIUpLw10yniKGgJeC7
 AgKUf0pvCz/M+MaqTxma3p8MmJUIgzvMg42i/N/gmgNw6TYCAQf7YZlSv9hW961M
 HGofMEx1VfjTAD1mucecKfcnzKolCJlOlmZKeKWsMqt2+DbpJq7NX9Fg6Q6x40jB
 pjdHU0hXixMVb5T0d0GBHTS6aA2G+zxm3zUCQYG89kmI+rgL7unE70OhHqEbENRv
 hk1SUMYo8cezv//1eAz584TUs2jF3b90Ev6HdcCDCscf94VW9tM=
 =2uY0
 -----END PGP SIGNATURE-----

Merge tag 'tags/bcm2835-drivers-next-2019-03-12' into soc/fixes

This pull request brings in a build fix for arm64 with bcm2835
enabled, and fixes the driver in the presence of -EPROBE_DEFER.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
This commit is contained in:
Florian Fainelli 2019-03-18 10:31:24 -07:00
commit 4823a031f0
2 changed files with 43 additions and 7 deletions

View File

@ -27,6 +27,7 @@ config ARCH_BCM2835
bool "Broadcom BCM2835 family" bool "Broadcom BCM2835 family"
select TIMER_OF select TIMER_OF
select GPIOLIB select GPIOLIB
select MFD_CORE
select PINCTRL select PINCTRL
select PINCTRL_BCM2835 select PINCTRL_BCM2835
select ARM_AMBA select ARM_AMBA

View File

@ -150,7 +150,12 @@ struct bcm2835_power {
static int bcm2835_asb_enable(struct bcm2835_power *power, u32 reg) static int bcm2835_asb_enable(struct bcm2835_power *power, u32 reg)
{ {
u64 start = ktime_get_ns(); u64 start;
if (!reg)
return 0;
start = ktime_get_ns();
/* Enable the module's async AXI bridges. */ /* Enable the module's async AXI bridges. */
ASB_WRITE(reg, ASB_READ(reg) & ~ASB_REQ_STOP); ASB_WRITE(reg, ASB_READ(reg) & ~ASB_REQ_STOP);
@ -165,7 +170,12 @@ static int bcm2835_asb_enable(struct bcm2835_power *power, u32 reg)
static int bcm2835_asb_disable(struct bcm2835_power *power, u32 reg) static int bcm2835_asb_disable(struct bcm2835_power *power, u32 reg)
{ {
u64 start = ktime_get_ns(); u64 start;
if (!reg)
return 0;
start = ktime_get_ns();
/* Enable the module's async AXI bridges. */ /* Enable the module's async AXI bridges. */
ASB_WRITE(reg, ASB_READ(reg) | ASB_REQ_STOP); ASB_WRITE(reg, ASB_READ(reg) | ASB_REQ_STOP);
@ -475,7 +485,7 @@ static int bcm2835_power_pd_power_off(struct generic_pm_domain *domain)
} }
} }
static void static int
bcm2835_init_power_domain(struct bcm2835_power *power, bcm2835_init_power_domain(struct bcm2835_power *power,
int pd_xlate_index, const char *name) int pd_xlate_index, const char *name)
{ {
@ -483,6 +493,17 @@ bcm2835_init_power_domain(struct bcm2835_power *power,
struct bcm2835_power_domain *dom = &power->domains[pd_xlate_index]; struct bcm2835_power_domain *dom = &power->domains[pd_xlate_index];
dom->clk = devm_clk_get(dev->parent, name); dom->clk = devm_clk_get(dev->parent, name);
if (IS_ERR(dom->clk)) {
int ret = PTR_ERR(dom->clk);
if (ret == -EPROBE_DEFER)
return ret;
/* Some domains don't have a clk, so make sure that we
* don't deref an error pointer later.
*/
dom->clk = NULL;
}
dom->base.name = name; dom->base.name = name;
dom->base.power_on = bcm2835_power_pd_power_on; dom->base.power_on = bcm2835_power_pd_power_on;
@ -495,6 +516,8 @@ bcm2835_init_power_domain(struct bcm2835_power *power,
pm_genpd_init(&dom->base, NULL, true); pm_genpd_init(&dom->base, NULL, true);
power->pd_xlate.domains[pd_xlate_index] = &dom->base; power->pd_xlate.domains[pd_xlate_index] = &dom->base;
return 0;
} }
/** bcm2835_reset_reset - Resets a block that has a reset line in the /** bcm2835_reset_reset - Resets a block that has a reset line in the
@ -592,7 +615,7 @@ static int bcm2835_power_probe(struct platform_device *pdev)
{ BCM2835_POWER_DOMAIN_IMAGE_PERI, BCM2835_POWER_DOMAIN_CAM0 }, { BCM2835_POWER_DOMAIN_IMAGE_PERI, BCM2835_POWER_DOMAIN_CAM0 },
{ BCM2835_POWER_DOMAIN_IMAGE_PERI, BCM2835_POWER_DOMAIN_CAM1 }, { BCM2835_POWER_DOMAIN_IMAGE_PERI, BCM2835_POWER_DOMAIN_CAM1 },
}; };
int ret, i; int ret = 0, i;
u32 id; u32 id;
power = devm_kzalloc(dev, sizeof(*power), GFP_KERNEL); power = devm_kzalloc(dev, sizeof(*power), GFP_KERNEL);
@ -619,8 +642,11 @@ static int bcm2835_power_probe(struct platform_device *pdev)
power->pd_xlate.num_domains = ARRAY_SIZE(power_domain_names); power->pd_xlate.num_domains = ARRAY_SIZE(power_domain_names);
for (i = 0; i < ARRAY_SIZE(power_domain_names); i++) for (i = 0; i < ARRAY_SIZE(power_domain_names); i++) {
bcm2835_init_power_domain(power, i, power_domain_names[i]); ret = bcm2835_init_power_domain(power, i, power_domain_names[i]);
if (ret)
goto fail;
}
for (i = 0; i < ARRAY_SIZE(domain_deps); i++) { for (i = 0; i < ARRAY_SIZE(domain_deps); i++) {
pm_genpd_add_subdomain(&power->domains[domain_deps[i].parent].base, pm_genpd_add_subdomain(&power->domains[domain_deps[i].parent].base,
@ -634,12 +660,21 @@ static int bcm2835_power_probe(struct platform_device *pdev)
ret = devm_reset_controller_register(dev, &power->reset); ret = devm_reset_controller_register(dev, &power->reset);
if (ret) if (ret)
return ret; goto fail;
of_genpd_add_provider_onecell(dev->parent->of_node, &power->pd_xlate); of_genpd_add_provider_onecell(dev->parent->of_node, &power->pd_xlate);
dev_info(dev, "Broadcom BCM2835 power domains driver"); dev_info(dev, "Broadcom BCM2835 power domains driver");
return 0; return 0;
fail:
for (i = 0; i < ARRAY_SIZE(power_domain_names); i++) {
struct generic_pm_domain *dom = &power->domains[i].base;
if (dom->name)
pm_genpd_remove(dom);
}
return ret;
} }
static int bcm2835_power_remove(struct platform_device *pdev) static int bcm2835_power_remove(struct platform_device *pdev)