* [PATCH 1/4] gpio/aspeed: Fix incorrect number of banks
From: Bartosz Golaszewski @ 2019-09-04 6:57 UTC (permalink / raw)
To: linux-aspeed
In-Reply-To: <20190904061245.30770-1-rashmica.g@gmail.com>
?r., 4 wrz 2019 o 08:13 Rashmica Gupta <rashmica.g@gmail.com> napisa?(a):
>
> Fixes: 361b79119a4b7 ('gpio: Add Aspeed driver')
>
Please, add a proper commit description. Checkpatch should have warned
you about it.
Bart
> Signed-off-by: Rashmica Gupta <rashmica.g@gmail.com>
> ---
> drivers/gpio/gpio-aspeed.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
> index 9defe25d4721..77752b2624e8 100644
> --- a/drivers/gpio/gpio-aspeed.c
> +++ b/drivers/gpio/gpio-aspeed.c
> @@ -1165,7 +1165,7 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev)
> gpio->chip.base = -1;
>
> /* Allocate a cache of the output registers */
> - banks = gpio->config->nr_gpios >> 5;
> + banks = (gpio->config->nr_gpios >> 5) + 1;
> gpio->dcache = devm_kcalloc(&pdev->dev,
> banks, sizeof(u32), GFP_KERNEL);
> if (!gpio->dcache)
> --
> 2.20.1
>
^ permalink raw reply
* [PATCH v3] mmc: sdhci-of-aspeed: Depend on CONFIG_OF_ADDRESS
From: Ulf Hansson @ 2019-09-04 6:32 UTC (permalink / raw)
To: linux-aspeed
In-Reply-To: <20190904022120.4174-1-andrew@aj.id.au>
On Wed, 4 Sep 2019 at 04:20, Andrew Jeffery <andrew@aj.id.au> wrote:
>
> Resolves the following build error reported by the 0-day bot:
>
> ERROR: "of_platform_device_create" [drivers/mmc/host/sdhci-of-aspeed.ko] undefined!
>
> SPARC does not set CONFIG_OF_ADDRESS so the symbol is missing. Depend on
> CONFIG_OF_ADDRESS to ensure the driver is only built for supported
> configurations.
>
> Fixes: 2d28dbe042f4 ("mmc: sdhci-of-aspeed: Add support for the ASPEED SD controller")
> Reported-by: kbuild test robot <lkp@intel.com>
> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Applied for next, thanks!
Kind regards
Uffe
> ---
> v2 was a series of 4 patches, three of which were applied leaving this build
> fix to be reworked. The v2 series can be found here:
>
> https://patchwork.ozlabs.org/cover/1156457/
>
> drivers/mmc/host/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
> index 0f8a230de2f3..3a52f5703286 100644
> --- a/drivers/mmc/host/Kconfig
> +++ b/drivers/mmc/host/Kconfig
> @@ -157,7 +157,7 @@ config MMC_SDHCI_OF_ARASAN
> config MMC_SDHCI_OF_ASPEED
> tristate "SDHCI OF support for the ASPEED SDHCI controller"
> depends on MMC_SDHCI_PLTFM
> - depends on OF
> + depends on OF && OF_ADDRESS
> help
> This selects the ASPEED Secure Digital Host Controller Interface.
>
> --
> 2.20.1
>
^ permalink raw reply
* [PATCH 4/4] gpio: Update documentation with ast2600 controllers
From: Rashmica Gupta @ 2019-09-04 6:12 UTC (permalink / raw)
To: linux-aspeed
In-Reply-To: <20190904061245.30770-1-rashmica.g@gmail.com>
Signed-off-by: Rashmica Gupta <rashmica.g@gmail.com>
---
Documentation/devicetree/bindings/gpio/gpio-aspeed.txt | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/gpio/gpio-aspeed.txt b/Documentation/devicetree/bindings/gpio/gpio-aspeed.txt
index 7e9b586770b0..cd388797e07c 100644
--- a/Documentation/devicetree/bindings/gpio/gpio-aspeed.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio-aspeed.txt
@@ -2,7 +2,8 @@ Aspeed GPIO controller Device Tree Bindings
-------------------------------------------
Required properties:
-- compatible : Either "aspeed,ast2400-gpio" or "aspeed,ast2500-gpio"
+- compatible : Either "aspeed,ast2400-gpio", "aspeed,ast2500-gpio",
+ "aspeed,ast2600-gpio", or "aspeed,ast2600-1-8v-gpio"
- #gpio-cells : Should be two
- First cell is the GPIO line number
--
2.20.1
^ permalink raw reply related
* [PATCH 3/4] gpio: Add in ast2600 details to Aspeed driver
From: Rashmica Gupta @ 2019-09-04 6:12 UTC (permalink / raw)
To: linux-aspeed
In-Reply-To: <20190904061245.30770-1-rashmica.g@gmail.com>
The ast2600 has two gpio controllers, one for 3.6V GPIOS and one for 1.8V GPIOS.
Signed-off-by: Rashmica Gupta <rashmica.g@gmail.com>
---
drivers/gpio/gpio-aspeed.c | 29 +++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
index 60ab042c9129..98881c99d0b9 100644
--- a/drivers/gpio/gpio-aspeed.c
+++ b/drivers/gpio/gpio-aspeed.c
@@ -662,12 +662,14 @@ static void aspeed_gpio_irq_handler(struct irq_desc *desc)
struct gpio_chip *gc = irq_desc_get_handler_data(desc);
struct irq_chip *ic = irq_desc_get_chip(desc);
struct aspeed_gpio *data = gpiochip_get_data(gc);
- unsigned int i, p, girq;
+ unsigned int i, p, girq, banks;
unsigned long reg;
+ struct aspeed_gpio *gpio = gpiochip_get_data(gc);
chained_irq_enter(ic, desc);
- for (i = 0; i < ARRAY_SIZE(aspeed_gpio_banks); i++) {
+ banks = (gpio->config->nr_gpios >> 5) + 1;
+ for (i = 0; i < banks; i++) {
const struct aspeed_gpio_bank *bank = &aspeed_gpio_banks[i];
reg = ioread32(bank_reg(data, bank, reg_irq_status));
@@ -1108,9 +1110,32 @@ static const struct aspeed_gpio_config ast2500_config =
/* 232 for simplicity, actual number is 228 (4-GPIO hole in GPIOAB) */
{ .nr_gpios = 232, .props = ast2500_bank_props, };
+static const struct aspeed_bank_props ast2600_bank_props[] = {
+ /* input output */
+ {5, 0xffffffff, 0x0000ffff}, /* U/V/W/X */
+ {6, 0xffff0000, 0x0fff0000}, /* Y/Z */
+ { },
+};
+
+static const struct aspeed_gpio_config ast2600_config =
+ /* 208 3.6V GPIOs */
+ { .nr_gpios = 208, .props = ast2600_bank_props, };
+
+static const struct aspeed_bank_props ast2600_1_8v_bank_props[] = {
+ /* input output */
+ {1, 0x0000000f, 0x0000000f}, /* E */
+ { },
+};
+
+static const struct aspeed_gpio_config ast2600_1_8v_config =
+ /* 36 1.8V GPIOs */
+ { .nr_gpios = 36, .props = ast2600_1_8v_bank_props, };
+
static const struct of_device_id aspeed_gpio_of_table[] = {
{ .compatible = "aspeed,ast2400-gpio", .data = &ast2400_config, },
{ .compatible = "aspeed,ast2500-gpio", .data = &ast2500_config, },
+ { .compatible = "aspeed,ast2600-gpio", .data = &ast2600_config, },
+ { .compatible = "aspeed,ast2600-1-8v-gpio", .data = &ast2600_1_8v_config,},
{}
};
MODULE_DEVICE_TABLE(of, aspeed_gpio_of_table);
--
2.20.1
^ permalink raw reply related
* [PATCH 2/4] gpio/aspeed: Setup irqchip dynamically
From: Rashmica Gupta @ 2019-09-04 6:12 UTC (permalink / raw)
To: linux-aspeed
In-Reply-To: <20190904061245.30770-1-rashmica.g@gmail.com>
This is in preparation for ast2600 as we will have two gpio drivers
which need their own irqchip.
Signed-off-by: Rashmica Gupta <rashmica.g@gmail.com>
---
drivers/gpio/gpio-aspeed.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
index 77752b2624e8..60ab042c9129 100644
--- a/drivers/gpio/gpio-aspeed.c
+++ b/drivers/gpio/gpio-aspeed.c
@@ -52,6 +52,7 @@ struct aspeed_gpio_config {
*/
struct aspeed_gpio {
struct gpio_chip chip;
+ struct irq_chip irqc;
spinlock_t lock;
void __iomem *base;
int irq;
@@ -681,14 +682,6 @@ static void aspeed_gpio_irq_handler(struct irq_desc *desc)
chained_irq_exit(ic, desc);
}
-static struct irq_chip aspeed_gpio_irqchip = {
- .name = "aspeed-gpio",
- .irq_ack = aspeed_gpio_irq_ack,
- .irq_mask = aspeed_gpio_irq_mask,
- .irq_unmask = aspeed_gpio_irq_unmask,
- .irq_set_type = aspeed_gpio_set_type,
-};
-
static void set_irq_valid_mask(struct aspeed_gpio *gpio)
{
const struct aspeed_bank_props *props = gpio->config->props;
@@ -1192,7 +1185,12 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev)
gpio->irq = rc;
girq = &gpio->chip.irq;
- girq->chip = &aspeed_gpio_irqchip;
+ girq->chip = &gpio->irqc;
+ girq->chip->name = dev_name(&pdev->dev);
+ girq->chip->irq_ack = aspeed_gpio_irq_ack;
+ girq->chip->irq_mask = aspeed_gpio_irq_mask;
+ girq->chip->irq_unmask = aspeed_gpio_irq_unmask;
+ girq->chip->irq_set_type = aspeed_gpio_set_type;
girq->parent_handler = aspeed_gpio_irq_handler;
girq->num_parents = 1;
girq->parents = devm_kcalloc(&pdev->dev, 1,
--
2.20.1
^ permalink raw reply related
* [PATCH 1/4] gpio/aspeed: Fix incorrect number of banks
From: Rashmica Gupta @ 2019-09-04 6:12 UTC (permalink / raw)
To: linux-aspeed
Fixes: 361b79119a4b7 ('gpio: Add Aspeed driver')
Signed-off-by: Rashmica Gupta <rashmica.g@gmail.com>
---
drivers/gpio/gpio-aspeed.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
index 9defe25d4721..77752b2624e8 100644
--- a/drivers/gpio/gpio-aspeed.c
+++ b/drivers/gpio/gpio-aspeed.c
@@ -1165,7 +1165,7 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev)
gpio->chip.base = -1;
/* Allocate a cache of the output registers */
- banks = gpio->config->nr_gpios >> 5;
+ banks = (gpio->config->nr_gpios >> 5) + 1;
gpio->dcache = devm_kcalloc(&pdev->dev,
banks, sizeof(u32), GFP_KERNEL);
if (!gpio->dcache)
--
2.20.1
^ permalink raw reply related
* [PATCH v3] mmc: sdhci-of-aspeed: Depend on CONFIG_OF_ADDRESS
From: Andrew Jeffery @ 2019-09-04 2:21 UTC (permalink / raw)
To: linux-aspeed
Resolves the following build error reported by the 0-day bot:
ERROR: "of_platform_device_create" [drivers/mmc/host/sdhci-of-aspeed.ko] undefined!
SPARC does not set CONFIG_OF_ADDRESS so the symbol is missing. Depend on
CONFIG_OF_ADDRESS to ensure the driver is only built for supported
configurations.
Fixes: 2d28dbe042f4 ("mmc: sdhci-of-aspeed: Add support for the ASPEED SD controller")
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
v2 was a series of 4 patches, three of which were applied leaving this build
fix to be reworked. The v2 series can be found here:
https://patchwork.ozlabs.org/cover/1156457/
drivers/mmc/host/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 0f8a230de2f3..3a52f5703286 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -157,7 +157,7 @@ config MMC_SDHCI_OF_ARASAN
config MMC_SDHCI_OF_ASPEED
tristate "SDHCI OF support for the ASPEED SDHCI controller"
depends on MMC_SDHCI_PLTFM
- depends on OF
+ depends on OF && OF_ADDRESS
help
This selects the ASPEED Secure Digital Host Controller Interface.
--
2.20.1
^ permalink raw reply related
* [PATCH v2 1/4] mmc: sdhci-of-aspeed: Fix link failure for SPARC
From: Andrew Jeffery @ 2019-09-04 0:02 UTC (permalink / raw)
To: linux-aspeed
In-Reply-To: <CAPDyKFpWJu3RH4TWoO_wcJq0LDrM_fAUfsCC==e8O_6A8dLhiA@mail.gmail.com>
On Wed, 4 Sep 2019, at 00:18, Ulf Hansson wrote:
> On Mon, 2 Sep 2019 at 07:26, Andrew Jeffery <andrew@aj.id.au> wrote:
> >
> >
> >
> > On Mon, 2 Sep 2019, at 13:42, Joel Stanley wrote:
> > > On Mon, 2 Sep 2019 at 03:58, Andrew Jeffery <andrew@aj.id.au> wrote:
> > > >
> > > > Resolves the following build error reported by the 0-day bot:
> > > >
> > > > ERROR: "of_platform_device_create" [drivers/mmc/host/sdhci-of-aspeed.ko] undefined!
> > > >
> > > > SPARC does not set CONFIG_OF_ADDRESS so the symbol is missing. Guard the
> > > > callsite to maintain build coverage for the rest of the driver.
> > > >
> > > > Reported-by: kbuild test robot <lkp@intel.com>
> > > > Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
> > > > ---
> > > > drivers/mmc/host/sdhci-of-aspeed.c | 38 ++++++++++++++++++++----------
> > > > 1 file changed, 25 insertions(+), 13 deletions(-)
> > > >
> > > > diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
> > > > index d5acb5afc50f..96ca494752c5 100644
> > > > --- a/drivers/mmc/host/sdhci-of-aspeed.c
> > > > +++ b/drivers/mmc/host/sdhci-of-aspeed.c
> > > > @@ -224,10 +224,30 @@ static struct platform_driver aspeed_sdhci_driver = {
> > > > .remove = aspeed_sdhci_remove,
> > > > };
> > > >
> > > > -static int aspeed_sdc_probe(struct platform_device *pdev)
> > > > -
> > > > +static int aspeed_sdc_create_sdhcis(struct platform_device *pdev)
> > > > {
> > > > +#if defined(CONFIG_OF_ADDRESS)
> > >
> > > This is going to be untested code forever, as no one will be running
> > > on a chip with this hardware present but OF_ADDRESS disabled.
> > >
> > > How about we make the driver depend on OF_ADDRESS instead?
> >
> > Testing is split into two pieces here: compile-time and run-time.
> > Clearly the run-time behaviour is going to be broken on configurations
> > without CONFIG_OF_ADDRESS (SPARC as mentioned), but I don't think
> > that means we shouldn't allow it to be compiled in that case
> > (e.g. CONFIG_COMPILE_TEST performs a similar role).
> >
> > With respect to compile-time it's possible to compile either path as
> > demonstrated by the build failure report.
> >
> > Having said that there's no reason we couldn't do what you suggest,
> > just it wasn't the existing solution pattern for the problem (there are
> > several other drivers that suffered the same bug that were fixed in the
> > style of this patch). Either way works, it's all somewhat academic.
> > Your suggestion is more obvious in terms of correctness, but this
> > patch is basically just code motion (the only addition is the `#if`/
> > `#endif` lines over what was already there if we disregard the
> > function declaration/invocation). I'll change it if there are further
> > complaints and a reason to do a v3.
>
> I am in favor of Joel's suggestion as I don't really like having
> ifdefs bloating around in the driver (unless very good reasons).
> Please re-spin a v3.
>
> Another option is to implement stub function and to deal with error
> codes, but that sounds more like a long term thingy, if even
> applicable here.
No worries then, will post a respin shortly.
Andrew
^ permalink raw reply
* [GIT PULL] ARM: aspeed: defconfig changes for 5.4
From: Arnd Bergmann @ 2019-09-03 16:59 UTC (permalink / raw)
To: linux-aspeed
In-Reply-To: <CACPK8XdyWzghA0QPDzA_MK5FYwhT5afqDJHNdhc8mfD2uk8MfQ@mail.gmail.com>
On Sun, Aug 25, 2019 at 4:10 PM Joel Stanley <joel@jms.id.au> wrote:
> ----------------------------------------------------------------
> ASPEED defconfig updates for 5.4
>
> - Enable the new AST2600 in multi_v7 and the aspeed_g5 configs.
>
> - Regenerate defconfigs to drop old options
>
> - Clean up network options
Pulled into arm/defconfig, thanks!
Arnd
^ permalink raw reply
* [PATCH v2 0/4] mmc: sdhci-of-aspeed: Fixes for AST2600 eMMC support
From: Ulf Hansson @ 2019-09-03 15:10 UTC (permalink / raw)
To: linux-aspeed
In-Reply-To: <20190902035842.2747-1-andrew@aj.id.au>
On Mon, 2 Sep 2019 at 05:58, Andrew Jeffery <andrew@aj.id.au> wrote:
>
> Hello,
>
> I've added a couple of patches since v1 of this series. The horizon has
> broadened slightly with a fix for SPARC builds as well in patch 1/4. Ulf
> suggested a minor cleanup on v1 with respect to handling of the current clock
> value, so that's now patch 2/4. Patches 3/4 and 4/4 are as they were in v1.
Applied patch 2->4 for next, thanks!
Kind regards
Uffe
>
> The v1 series can be found here:
>
> https://patchwork.ozlabs.org/cover/1155757/
>
> Please review!
>
> Andrew
>
> Andrew Jeffery (4):
> mmc: sdhci-of-aspeed: Fix link failure for SPARC
> mmc: sdhci-of-aspeed: Drop redundant assignment to host->clock
> mmc: sdhci-of-aspeed: Uphold clocks-on post-condition of set_clock()
> mmc: sdhci-of-aspeed: Allow max-frequency limitation of SDCLK
>
> drivers/mmc/host/sdhci-of-aspeed.c | 62 ++++++++++++++++++++----------
> 1 file changed, 42 insertions(+), 20 deletions(-)
>
> --
> 2.20.1
>
^ permalink raw reply
* [PATCH v2 1/4] mmc: sdhci-of-aspeed: Fix link failure for SPARC
From: Ulf Hansson @ 2019-09-03 14:48 UTC (permalink / raw)
To: linux-aspeed
In-Reply-To: <83570e25-b20a-4a17-85ea-15a9a53289bf@www.fastmail.com>
On Mon, 2 Sep 2019 at 07:26, Andrew Jeffery <andrew@aj.id.au> wrote:
>
>
>
> On Mon, 2 Sep 2019, at 13:42, Joel Stanley wrote:
> > On Mon, 2 Sep 2019 at 03:58, Andrew Jeffery <andrew@aj.id.au> wrote:
> > >
> > > Resolves the following build error reported by the 0-day bot:
> > >
> > > ERROR: "of_platform_device_create" [drivers/mmc/host/sdhci-of-aspeed.ko] undefined!
> > >
> > > SPARC does not set CONFIG_OF_ADDRESS so the symbol is missing. Guard the
> > > callsite to maintain build coverage for the rest of the driver.
> > >
> > > Reported-by: kbuild test robot <lkp@intel.com>
> > > Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
> > > ---
> > > drivers/mmc/host/sdhci-of-aspeed.c | 38 ++++++++++++++++++++----------
> > > 1 file changed, 25 insertions(+), 13 deletions(-)
> > >
> > > diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
> > > index d5acb5afc50f..96ca494752c5 100644
> > > --- a/drivers/mmc/host/sdhci-of-aspeed.c
> > > +++ b/drivers/mmc/host/sdhci-of-aspeed.c
> > > @@ -224,10 +224,30 @@ static struct platform_driver aspeed_sdhci_driver = {
> > > .remove = aspeed_sdhci_remove,
> > > };
> > >
> > > -static int aspeed_sdc_probe(struct platform_device *pdev)
> > > -
> > > +static int aspeed_sdc_create_sdhcis(struct platform_device *pdev)
> > > {
> > > +#if defined(CONFIG_OF_ADDRESS)
> >
> > This is going to be untested code forever, as no one will be running
> > on a chip with this hardware present but OF_ADDRESS disabled.
> >
> > How about we make the driver depend on OF_ADDRESS instead?
>
> Testing is split into two pieces here: compile-time and run-time.
> Clearly the run-time behaviour is going to be broken on configurations
> without CONFIG_OF_ADDRESS (SPARC as mentioned), but I don't think
> that means we shouldn't allow it to be compiled in that case
> (e.g. CONFIG_COMPILE_TEST performs a similar role).
>
> With respect to compile-time it's possible to compile either path as
> demonstrated by the build failure report.
>
> Having said that there's no reason we couldn't do what you suggest,
> just it wasn't the existing solution pattern for the problem (there are
> several other drivers that suffered the same bug that were fixed in the
> style of this patch). Either way works, it's all somewhat academic.
> Your suggestion is more obvious in terms of correctness, but this
> patch is basically just code motion (the only addition is the `#if`/
> `#endif` lines over what was already there if we disregard the
> function declaration/invocation). I'll change it if there are further
> complaints and a reason to do a v3.
I am in favor of Joel's suggestion as I don't really like having
ifdefs bloating around in the driver (unless very good reasons).
Please re-spin a v3.
Another option is to implement stub function and to deal with error
codes, but that sounds more like a long term thingy, if even
applicable here.
Kind regards
Uffe
^ permalink raw reply
* [GIT PULL] ARM: aspeed: devicetree changes for 5.4
From: Arnd Bergmann @ 2019-09-03 14:03 UTC (permalink / raw)
To: linux-aspeed
In-Reply-To: <CACPK8XfKHpNYXNE_VRaLeGUQa7-hkmUS0nsPfaeSLE4sckKFHg@mail.gmail.com>
On Sun, Aug 25, 2019 at 4:10 PM Joel Stanley <joel@jms.id.au> wrote:
> ----------------------------------------------------------------
> ASPEED device tree updates for 5.4
>
> New machines:
>
> - Facebook Wedge100, Wedge40 and Minipack
> - Lenovo Hr855xg2
> - Wistron Mihawk
>
> There's a few other updates, notably some changes to to use the newly
> added SDHCI driver.
Pulled into arm/dt, thanks!
Arnd
^ permalink raw reply
* [GIT PULL] ARM: aspeed: arch changes for 5.4
From: Arnd Bergmann @ 2019-09-03 12:19 UTC (permalink / raw)
To: linux-aspeed
In-Reply-To: <CACPK8Xc1aSp5fXL3cEzC9SJsCXG2JwsSPpQrW3a09dkvhCyHHA@mail.gmail.com>
On Sun, Aug 25, 2019 at 4:10 PM Joel Stanley <joel@jms.id.au> wrote:
>
> Hello ARM Maintainers,
>
> Here's my first mach-aspeed pull request. We finally had to add some
> code here to support SMP on the shiny new ASPEED AST2600.
>
> The following changes since commit 5f9e832c137075045d15cd6899ab0505cfb2ca4b:
>
> Linus 5.3-rc1 (2019-07-21 14:05:38 -0700)
>
> are available in the Git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/joel/aspeed.git \
> tags/aspeed-5.4-arch
>
Pulled into arm/soc branch, after changing Olof's patchwork wrapper script
to ignore the '\' character at the line break.
Thanks
Arnd
^ permalink raw reply
* [PATCH v2 1/3] dt-bindings: hwmon: Document ibm, cffps2 compatible string
From: Rob Herring @ 2019-09-02 13:39 UTC (permalink / raw)
To: linux-aspeed
In-Reply-To: <1567192263-15065-2-git-send-email-eajames@linux.ibm.com>
On Fri, 30 Aug 2019 14:11:01 -0500, Eddie James wrote:
> Document the compatible string for version 2 of the IBM CFFPS PSU.
>
> Signed-off-by: Eddie James <eajames@linux.ibm.com>
> ---
> Documentation/devicetree/bindings/hwmon/ibm,cffps1.txt | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
Reviewed-by: Rob Herring <robh@kernel.org>
^ permalink raw reply
* [PATCH 3/3] pmbus: ibm-cffps: Add support for version 2 of the PSU
From: kbuild test robot @ 2019-09-02 7:49 UTC (permalink / raw)
To: linux-aspeed
In-Reply-To: <1567181385-22129-4-git-send-email-eajames@linux.ibm.com>
Hi Eddie,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[cannot apply to v5.3-rc6 next-20190830]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Eddie-James/pmbus-ibm-cffps-Add-support-for-version-2-of-PSU/20190901-151755
config: x86_64-randconfig-s0-09021304 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-11) 7.4.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
drivers/hwmon/pmbus/ibm-cffps.c: In function 'ibm_cffps_probe':
>> drivers/hwmon/pmbus/ibm-cffps.c:404:8: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
vs = (int)md;
^
vim +404 drivers/hwmon/pmbus/ibm-cffps.c
393
394 static int ibm_cffps_probe(struct i2c_client *client,
395 const struct i2c_device_id *id)
396 {
397 int i, rc, vs;
398 struct dentry *debugfs;
399 struct dentry *ibm_cffps_dir;
400 struct ibm_cffps *psu;
401 const void *md = of_device_get_match_data(&client->dev);
402
403 if (md)
> 404 vs = (int)md;
405 else if (id)
406 vs = (int)id->driver_data;
407 else
408 vs = 1;
409
410 client->dev.platform_data = &ibm_cffps_pdata;
411 rc = pmbus_do_probe(client, id, &ibm_cffps_info[vs - 1]);
412 if (rc)
413 return rc;
414
415 /*
416 * Don't fail the probe if there isn't enough memory for leds and
417 * debugfs.
418 */
419 psu = devm_kzalloc(&client->dev, sizeof(*psu), GFP_KERNEL);
420 if (!psu)
421 return 0;
422
423 psu->version = vs;
424 psu->client = client;
425 mutex_init(&psu->input_history.update_lock);
426 psu->input_history.last_update = jiffies - HZ;
427
428 ibm_cffps_create_led_class(psu);
429
430 /* Don't fail the probe if we can't create debugfs */
431 debugfs = pmbus_get_debugfs_dir(client);
432 if (!debugfs)
433 return 0;
434
435 ibm_cffps_dir = debugfs_create_dir(client->name, debugfs);
436 if (!ibm_cffps_dir)
437 return 0;
438
439 for (i = 0; i < CFFPS_DEBUGFS_NUM_ENTRIES; ++i)
440 psu->debugfs_entries[i] = i;
441
442 debugfs_create_file("input_history", 0444, ibm_cffps_dir,
443 &psu->debugfs_entries[CFFPS_DEBUGFS_INPUT_HISTORY],
444 &ibm_cffps_fops);
445 debugfs_create_file("fru", 0444, ibm_cffps_dir,
446 &psu->debugfs_entries[CFFPS_DEBUGFS_FRU],
447 &ibm_cffps_fops);
448 debugfs_create_file("part_number", 0444, ibm_cffps_dir,
449 &psu->debugfs_entries[CFFPS_DEBUGFS_PN],
450 &ibm_cffps_fops);
451 debugfs_create_file("serial_number", 0444, ibm_cffps_dir,
452 &psu->debugfs_entries[CFFPS_DEBUGFS_SN],
453 &ibm_cffps_fops);
454 debugfs_create_file("ccin", 0444, ibm_cffps_dir,
455 &psu->debugfs_entries[CFFPS_DEBUGFS_CCIN],
456 &ibm_cffps_fops);
457 debugfs_create_file("fw_version", 0444, ibm_cffps_dir,
458 &psu->debugfs_entries[CFFPS_DEBUGFS_FW],
459 &ibm_cffps_fops);
460
461 return 0;
462 }
463
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 30810 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linux-aspeed/attachments/20190902/23d9fa8f/attachment-0001.gz>
^ permalink raw reply
* [PATCH v2 1/4] mmc: sdhci-of-aspeed: Fix link failure for SPARC
From: Andrew Jeffery @ 2019-09-02 5:26 UTC (permalink / raw)
To: linux-aspeed
In-Reply-To: <CACPK8XfYgEUfaK6rtr+FdEq-Vau6d4wE2Rvfp6Q4G2-kjVLT0g@mail.gmail.com>
On Mon, 2 Sep 2019, at 13:42, Joel Stanley wrote:
> On Mon, 2 Sep 2019 at 03:58, Andrew Jeffery <andrew@aj.id.au> wrote:
> >
> > Resolves the following build error reported by the 0-day bot:
> >
> > ERROR: "of_platform_device_create" [drivers/mmc/host/sdhci-of-aspeed.ko] undefined!
> >
> > SPARC does not set CONFIG_OF_ADDRESS so the symbol is missing. Guard the
> > callsite to maintain build coverage for the rest of the driver.
> >
> > Reported-by: kbuild test robot <lkp@intel.com>
> > Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
> > ---
> > drivers/mmc/host/sdhci-of-aspeed.c | 38 ++++++++++++++++++++----------
> > 1 file changed, 25 insertions(+), 13 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
> > index d5acb5afc50f..96ca494752c5 100644
> > --- a/drivers/mmc/host/sdhci-of-aspeed.c
> > +++ b/drivers/mmc/host/sdhci-of-aspeed.c
> > @@ -224,10 +224,30 @@ static struct platform_driver aspeed_sdhci_driver = {
> > .remove = aspeed_sdhci_remove,
> > };
> >
> > -static int aspeed_sdc_probe(struct platform_device *pdev)
> > -
> > +static int aspeed_sdc_create_sdhcis(struct platform_device *pdev)
> > {
> > +#if defined(CONFIG_OF_ADDRESS)
>
> This is going to be untested code forever, as no one will be running
> on a chip with this hardware present but OF_ADDRESS disabled.
>
> How about we make the driver depend on OF_ADDRESS instead?
Testing is split into two pieces here: compile-time and run-time.
Clearly the run-time behaviour is going to be broken on configurations
without CONFIG_OF_ADDRESS (SPARC as mentioned), but I don't think
that means we shouldn't allow it to be compiled in that case
(e.g. CONFIG_COMPILE_TEST performs a similar role).
With respect to compile-time it's possible to compile either path as
demonstrated by the build failure report.
Having said that there's no reason we couldn't do what you suggest,
just it wasn't the existing solution pattern for the problem (there are
several other drivers that suffered the same bug that were fixed in the
style of this patch). Either way works, it's all somewhat academic.
Your suggestion is more obvious in terms of correctness, but this
patch is basically just code motion (the only addition is the `#if`/
`#endif` lines over what was already there if we disregard the
function declaration/invocation). I'll change it if there are further
complaints and a reason to do a v3.
Andrew
^ permalink raw reply
* [PATCH v2 1/4] mmc: sdhci-of-aspeed: Fix link failure for SPARC
From: Joel Stanley @ 2019-09-02 4:12 UTC (permalink / raw)
To: linux-aspeed
In-Reply-To: <20190902035842.2747-2-andrew@aj.id.au>
On Mon, 2 Sep 2019 at 03:58, Andrew Jeffery <andrew@aj.id.au> wrote:
>
> Resolves the following build error reported by the 0-day bot:
>
> ERROR: "of_platform_device_create" [drivers/mmc/host/sdhci-of-aspeed.ko] undefined!
>
> SPARC does not set CONFIG_OF_ADDRESS so the symbol is missing. Guard the
> callsite to maintain build coverage for the rest of the driver.
>
> Reported-by: kbuild test robot <lkp@intel.com>
> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
> ---
> drivers/mmc/host/sdhci-of-aspeed.c | 38 ++++++++++++++++++++----------
> 1 file changed, 25 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
> index d5acb5afc50f..96ca494752c5 100644
> --- a/drivers/mmc/host/sdhci-of-aspeed.c
> +++ b/drivers/mmc/host/sdhci-of-aspeed.c
> @@ -224,10 +224,30 @@ static struct platform_driver aspeed_sdhci_driver = {
> .remove = aspeed_sdhci_remove,
> };
>
> -static int aspeed_sdc_probe(struct platform_device *pdev)
> -
> +static int aspeed_sdc_create_sdhcis(struct platform_device *pdev)
> {
> +#if defined(CONFIG_OF_ADDRESS)
This is going to be untested code forever, as no one will be running
on a chip with this hardware present but OF_ADDRESS disabled.
How about we make the driver depend on OF_ADDRESS instead?
Cheers,
Joel
> struct device_node *parent, *child;
> +
> + parent = pdev->dev.of_node;
> +
> + for_each_available_child_of_node(parent, child) {
> + struct platform_device *cpdev;
> +
> + cpdev = of_platform_device_create(child, NULL, &pdev->dev);
> + if (!cpdev) {
> + of_node_put(child);
> + return -ENODEV;
> + }
> + }
> +#endif
> +
> + return 0;
> +}
> +
> +static int aspeed_sdc_probe(struct platform_device *pdev)
> +
> +{
> struct aspeed_sdc *sdc;
> int ret;
>
> @@ -256,17 +276,9 @@ static int aspeed_sdc_probe(struct platform_device *pdev)
>
> dev_set_drvdata(&pdev->dev, sdc);
>
> - parent = pdev->dev.of_node;
> - for_each_available_child_of_node(parent, child) {
> - struct platform_device *cpdev;
> -
> - cpdev = of_platform_device_create(child, NULL, &pdev->dev);
> - if (!cpdev) {
> - of_node_put(child);
> - ret = -ENODEV;
> - goto err_clk;
> - }
> - }
> + ret = aspeed_sdc_create_sdhcis(pdev);
> + if (ret)
> + goto err_clk;
>
> return 0;
>
> --
> 2.20.1
>
^ permalink raw reply
* [PATCH v2 4/4] mmc: sdhci-of-aspeed: Allow max-frequency limitation of SDCLK
From: Andrew Jeffery @ 2019-09-02 3:58 UTC (permalink / raw)
To: linux-aspeed
In-Reply-To: <20190902035842.2747-1-andrew@aj.id.au>
Add a get_max_clock() handler to sdhci-of-aspeed to report f_max as the
maximum clock rate if it is set. This enables artificial limitation of
the bus speed via max-frequency in the devicetree for e.g. the AST2600
evaluation board where I was seeing errors at 200MHz.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
drivers/mmc/host/sdhci-of-aspeed.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
index c31d74427c49..a8a5341b526c 100644
--- a/drivers/mmc/host/sdhci-of-aspeed.c
+++ b/drivers/mmc/host/sdhci-of-aspeed.c
@@ -52,16 +52,24 @@ static void aspeed_sdc_configure_8bit_mode(struct aspeed_sdc *sdc,
static void aspeed_sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
{
+ struct sdhci_pltfm_host *pltfm_host;
+ unsigned long parent;
int div;
u16 clk;
+ pltfm_host = sdhci_priv(host);
+ parent = clk_get_rate(pltfm_host->clk);
+
sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
if (clock == 0)
return;
+ if (WARN_ON(clock > host->max_clk))
+ clock = host->max_clk;
+
for (div = 1; div < 256; div *= 2) {
- if ((host->max_clk / div) <= clock)
+ if ((parent / div) <= clock)
break;
}
div >>= 1;
@@ -71,6 +79,14 @@ static void aspeed_sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
sdhci_enable_clk(host, clk);
}
+static unsigned int aspeed_sdhci_get_max_clock(struct sdhci_host *host)
+{
+ if (host->mmc->f_max)
+ return host->mmc->f_max;
+
+ return sdhci_pltfm_clk_get_max_clock(host);
+}
+
static void aspeed_sdhci_set_bus_width(struct sdhci_host *host, int width)
{
struct sdhci_pltfm_host *pltfm_priv;
@@ -97,7 +113,7 @@ static void aspeed_sdhci_set_bus_width(struct sdhci_host *host, int width)
static const struct sdhci_ops aspeed_sdhci_ops = {
.set_clock = aspeed_sdhci_set_clock,
- .get_max_clock = sdhci_pltfm_clk_get_max_clock,
+ .get_max_clock = aspeed_sdhci_get_max_clock,
.set_bus_width = aspeed_sdhci_set_bus_width,
.get_timeout_clock = sdhci_pltfm_clk_get_max_clock,
.reset = sdhci_reset,
--
2.20.1
^ permalink raw reply related
* [PATCH v2 3/4] mmc: sdhci-of-aspeed: Uphold clocks-on post-condition of set_clock()
From: Andrew Jeffery @ 2019-09-02 3:58 UTC (permalink / raw)
To: linux-aspeed
In-Reply-To: <20190902035842.2747-1-andrew@aj.id.au>
The early-exit didn't seem to matter on the AST2500, but on the AST2600
the SD clock genuinely may not be running on entry to
aspeed_sdhci_set_clock(). Remove the early exit to ensure we always run
sdhci_enable_clk().
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
drivers/mmc/host/sdhci-of-aspeed.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
index 213b3dbd49ef..c31d74427c49 100644
--- a/drivers/mmc/host/sdhci-of-aspeed.c
+++ b/drivers/mmc/host/sdhci-of-aspeed.c
@@ -55,9 +55,6 @@ static void aspeed_sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
int div;
u16 clk;
- if (clock == host->clock)
- return;
-
sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
if (clock == 0)
--
2.20.1
^ permalink raw reply related
* [PATCH v2 2/4] mmc: sdhci-of-aspeed: Drop redundant assignment to host->clock
From: Andrew Jeffery @ 2019-09-02 3:58 UTC (permalink / raw)
To: linux-aspeed
In-Reply-To: <20190902035842.2747-1-andrew@aj.id.au>
host->clock is already managed by sdhci_set_ios().
Suggested-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
drivers/mmc/host/sdhci-of-aspeed.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
index 96ca494752c5..213b3dbd49ef 100644
--- a/drivers/mmc/host/sdhci-of-aspeed.c
+++ b/drivers/mmc/host/sdhci-of-aspeed.c
@@ -61,7 +61,7 @@ static void aspeed_sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
if (clock == 0)
- goto out;
+ return;
for (div = 1; div < 256; div *= 2) {
if ((host->max_clk / div) <= clock)
@@ -72,9 +72,6 @@ static void aspeed_sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
clk = div << SDHCI_DIVIDER_SHIFT;
sdhci_enable_clk(host, clk);
-
-out:
- host->clock = clock;
}
static void aspeed_sdhci_set_bus_width(struct sdhci_host *host, int width)
--
2.20.1
^ permalink raw reply related
* [PATCH v2 1/4] mmc: sdhci-of-aspeed: Fix link failure for SPARC
From: Andrew Jeffery @ 2019-09-02 3:58 UTC (permalink / raw)
To: linux-aspeed
In-Reply-To: <20190902035842.2747-1-andrew@aj.id.au>
Resolves the following build error reported by the 0-day bot:
ERROR: "of_platform_device_create" [drivers/mmc/host/sdhci-of-aspeed.ko] undefined!
SPARC does not set CONFIG_OF_ADDRESS so the symbol is missing. Guard the
callsite to maintain build coverage for the rest of the driver.
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
drivers/mmc/host/sdhci-of-aspeed.c | 38 ++++++++++++++++++++----------
1 file changed, 25 insertions(+), 13 deletions(-)
diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
index d5acb5afc50f..96ca494752c5 100644
--- a/drivers/mmc/host/sdhci-of-aspeed.c
+++ b/drivers/mmc/host/sdhci-of-aspeed.c
@@ -224,10 +224,30 @@ static struct platform_driver aspeed_sdhci_driver = {
.remove = aspeed_sdhci_remove,
};
-static int aspeed_sdc_probe(struct platform_device *pdev)
-
+static int aspeed_sdc_create_sdhcis(struct platform_device *pdev)
{
+#if defined(CONFIG_OF_ADDRESS)
struct device_node *parent, *child;
+
+ parent = pdev->dev.of_node;
+
+ for_each_available_child_of_node(parent, child) {
+ struct platform_device *cpdev;
+
+ cpdev = of_platform_device_create(child, NULL, &pdev->dev);
+ if (!cpdev) {
+ of_node_put(child);
+ return -ENODEV;
+ }
+ }
+#endif
+
+ return 0;
+}
+
+static int aspeed_sdc_probe(struct platform_device *pdev)
+
+{
struct aspeed_sdc *sdc;
int ret;
@@ -256,17 +276,9 @@ static int aspeed_sdc_probe(struct platform_device *pdev)
dev_set_drvdata(&pdev->dev, sdc);
- parent = pdev->dev.of_node;
- for_each_available_child_of_node(parent, child) {
- struct platform_device *cpdev;
-
- cpdev = of_platform_device_create(child, NULL, &pdev->dev);
- if (!cpdev) {
- of_node_put(child);
- ret = -ENODEV;
- goto err_clk;
- }
- }
+ ret = aspeed_sdc_create_sdhcis(pdev);
+ if (ret)
+ goto err_clk;
return 0;
--
2.20.1
^ permalink raw reply related
* [PATCH v2 0/4] mmc: sdhci-of-aspeed: Fixes for AST2600 eMMC support
From: Andrew Jeffery @ 2019-09-02 3:58 UTC (permalink / raw)
To: linux-aspeed
Hello,
I've added a couple of patches since v1 of this series. The horizon has
broadened slightly with a fix for SPARC builds as well in patch 1/4. Ulf
suggested a minor cleanup on v1 with respect to handling of the current clock
value, so that's now patch 2/4. Patches 3/4 and 4/4 are as they were in v1.
The v1 series can be found here:
https://patchwork.ozlabs.org/cover/1155757/
Please review!
Andrew
Andrew Jeffery (4):
mmc: sdhci-of-aspeed: Fix link failure for SPARC
mmc: sdhci-of-aspeed: Drop redundant assignment to host->clock
mmc: sdhci-of-aspeed: Uphold clocks-on post-condition of set_clock()
mmc: sdhci-of-aspeed: Allow max-frequency limitation of SDCLK
drivers/mmc/host/sdhci-of-aspeed.c | 62 ++++++++++++++++++++----------
1 file changed, 42 insertions(+), 20 deletions(-)
--
2.20.1
^ permalink raw reply
* [PATCH v2 3/3] pmbus: ibm-cffps: Add support for version 2 of the PSU
From: Guenter Roeck @ 2019-08-31 15:28 UTC (permalink / raw)
To: linux-aspeed
In-Reply-To: <1567192263-15065-4-git-send-email-eajames@linux.ibm.com>
On Fri, Aug 30, 2019 at 02:11:03PM -0500, Eddie James wrote:
> Version 2 of the PSU supports a second page of data and changes the
> format of the FW version. Use the devicetree binding to differentiate
> between the version the driver should use.
>
> Signed-off-by: Eddie James <eajames@linux.ibm.com>
Applied to hwmon-next.
Thanks,
Guenter
> ---
> Changes since v1:
> - use an enum for the version instead of integers 1, 2, etc
>
> drivers/hwmon/pmbus/ibm-cffps.c | 110 ++++++++++++++++++++++++++++++++--------
> 1 file changed, 88 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/hwmon/pmbus/ibm-cffps.c b/drivers/hwmon/pmbus/ibm-cffps.c
> index ee2ee9e..d44745e 100644
> --- a/drivers/hwmon/pmbus/ibm-cffps.c
> +++ b/drivers/hwmon/pmbus/ibm-cffps.c
> @@ -12,6 +12,7 @@
> #include <linux/leds.h>
> #include <linux/module.h>
> #include <linux/mutex.h>
> +#include <linux/of_device.h>
> #include <linux/pmbus.h>
>
> #include "pmbus.h"
> @@ -20,8 +21,9 @@
> #define CFFPS_PN_CMD 0x9B
> #define CFFPS_SN_CMD 0x9E
> #define CFFPS_CCIN_CMD 0xBD
> -#define CFFPS_FW_CMD_START 0xFA
> -#define CFFPS_FW_NUM_BYTES 4
> +#define CFFPS_FW_CMD 0xFA
> +#define CFFPS1_FW_NUM_BYTES 4
> +#define CFFPS2_FW_NUM_WORDS 3
> #define CFFPS_SYS_CONFIG_CMD 0xDA
>
> #define CFFPS_INPUT_HISTORY_CMD 0xD6
> @@ -52,6 +54,8 @@ enum {
> CFFPS_DEBUGFS_NUM_ENTRIES
> };
>
> +enum versions { cffps1, cffps2 };
> +
> struct ibm_cffps_input_history {
> struct mutex update_lock;
> unsigned long last_update;
> @@ -61,6 +65,7 @@ struct ibm_cffps_input_history {
> };
>
> struct ibm_cffps {
> + enum versions version;
> struct i2c_client *client;
>
> struct ibm_cffps_input_history input_history;
> @@ -132,6 +137,8 @@ static ssize_t ibm_cffps_debugfs_op(struct file *file, char __user *buf,
> struct ibm_cffps *psu = to_psu(idxp, idx);
> char data[I2C_SMBUS_BLOCK_MAX] = { 0 };
>
> + pmbus_set_page(psu->client, 0);
> +
> switch (idx) {
> case CFFPS_DEBUGFS_INPUT_HISTORY:
> return ibm_cffps_read_input_history(psu, buf, count, ppos);
> @@ -152,16 +159,36 @@ static ssize_t ibm_cffps_debugfs_op(struct file *file, char __user *buf,
> rc = snprintf(data, 5, "%04X", rc);
> goto done;
> case CFFPS_DEBUGFS_FW:
> - for (i = 0; i < CFFPS_FW_NUM_BYTES; ++i) {
> - rc = i2c_smbus_read_byte_data(psu->client,
> - CFFPS_FW_CMD_START + i);
> - if (rc < 0)
> - return rc;
> + switch (psu->version) {
> + case cffps1:
> + for (i = 0; i < CFFPS1_FW_NUM_BYTES; ++i) {
> + rc = i2c_smbus_read_byte_data(psu->client,
> + CFFPS_FW_CMD +
> + i);
> + if (rc < 0)
> + return rc;
> +
> + snprintf(&data[i * 2], 3, "%02X", rc);
> + }
>
> - snprintf(&data[i * 2], 3, "%02X", rc);
> - }
> + rc = i * 2;
> + break;
> + case cffps2:
> + for (i = 0; i < CFFPS2_FW_NUM_WORDS; ++i) {
> + rc = i2c_smbus_read_word_data(psu->client,
> + CFFPS_FW_CMD +
> + i);
> + if (rc < 0)
> + return rc;
> +
> + snprintf(&data[i * 4], 5, "%04X", rc);
> + }
>
> - rc = i * 2;
> + rc = i * 4;
> + break;
> + default:
> + return -EOPNOTSUPP;
> + }
> goto done;
> default:
> return -EINVAL;
> @@ -279,6 +306,8 @@ static void ibm_cffps_led_brightness_set(struct led_classdev *led_cdev,
> psu->led_state = CFFPS_LED_ON;
> }
>
> + pmbus_set_page(psu->client, 0);
> +
> rc = i2c_smbus_write_byte_data(psu->client, CFFPS_SYS_CONFIG_CMD,
> psu->led_state);
> if (rc < 0)
> @@ -299,6 +328,8 @@ static int ibm_cffps_led_blink_set(struct led_classdev *led_cdev,
> if (led_cdev->brightness == LED_OFF)
> return 0;
>
> + pmbus_set_page(psu->client, 0);
> +
> rc = i2c_smbus_write_byte_data(psu->client, CFFPS_SYS_CONFIG_CMD,
> CFFPS_LED_BLINK);
> if (rc < 0)
> @@ -328,15 +359,32 @@ static void ibm_cffps_create_led_class(struct ibm_cffps *psu)
> dev_warn(dev, "failed to register led class: %d\n", rc);
> }
>
> -static struct pmbus_driver_info ibm_cffps_info = {
> - .pages = 1,
> - .func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_VOUT | PMBUS_HAVE_IOUT |
> - PMBUS_HAVE_PIN | PMBUS_HAVE_FAN12 | PMBUS_HAVE_TEMP |
> - PMBUS_HAVE_TEMP2 | PMBUS_HAVE_TEMP3 | PMBUS_HAVE_STATUS_VOUT |
> - PMBUS_HAVE_STATUS_IOUT | PMBUS_HAVE_STATUS_INPUT |
> - PMBUS_HAVE_STATUS_TEMP | PMBUS_HAVE_STATUS_FAN12,
> - .read_byte_data = ibm_cffps_read_byte_data,
> - .read_word_data = ibm_cffps_read_word_data,
> +static struct pmbus_driver_info ibm_cffps_info[] = {
> + [cffps1] = {
> + .pages = 1,
> + .func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_VOUT | PMBUS_HAVE_IOUT |
> + PMBUS_HAVE_PIN | PMBUS_HAVE_FAN12 | PMBUS_HAVE_TEMP |
> + PMBUS_HAVE_TEMP2 | PMBUS_HAVE_TEMP3 |
> + PMBUS_HAVE_STATUS_VOUT | PMBUS_HAVE_STATUS_IOUT |
> + PMBUS_HAVE_STATUS_INPUT | PMBUS_HAVE_STATUS_TEMP |
> + PMBUS_HAVE_STATUS_FAN12,
> + .read_byte_data = ibm_cffps_read_byte_data,
> + .read_word_data = ibm_cffps_read_word_data,
> + },
> + [cffps2] = {
> + .pages = 2,
> + .func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_VOUT | PMBUS_HAVE_IOUT |
> + PMBUS_HAVE_PIN | PMBUS_HAVE_FAN12 | PMBUS_HAVE_TEMP |
> + PMBUS_HAVE_TEMP2 | PMBUS_HAVE_TEMP3 |
> + PMBUS_HAVE_STATUS_VOUT | PMBUS_HAVE_STATUS_IOUT |
> + PMBUS_HAVE_STATUS_INPUT | PMBUS_HAVE_STATUS_TEMP |
> + PMBUS_HAVE_STATUS_FAN12,
> + .func[1] = PMBUS_HAVE_VOUT | PMBUS_HAVE_IOUT |
> + PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2 | PMBUS_HAVE_TEMP3 |
> + PMBUS_HAVE_STATUS_VOUT | PMBUS_HAVE_STATUS_IOUT,
> + .read_byte_data = ibm_cffps_read_byte_data,
> + .read_word_data = ibm_cffps_read_word_data,
> + },
> };
>
> static struct pmbus_platform_data ibm_cffps_pdata = {
> @@ -347,12 +395,21 @@ static int ibm_cffps_probe(struct i2c_client *client,
> const struct i2c_device_id *id)
> {
> int i, rc;
> + enum versions vs;
> struct dentry *debugfs;
> struct dentry *ibm_cffps_dir;
> struct ibm_cffps *psu;
> + const void *md = of_device_get_match_data(&client->dev);
> +
> + if (md)
> + vs = (enum versions)md;
> + else if (id)
> + vs = (enum versions)id->driver_data;
> + else
> + vs = cffps1;
>
> client->dev.platform_data = &ibm_cffps_pdata;
> - rc = pmbus_do_probe(client, id, &ibm_cffps_info);
> + rc = pmbus_do_probe(client, id, &ibm_cffps_info[vs]);
> if (rc)
> return rc;
>
> @@ -364,6 +421,7 @@ static int ibm_cffps_probe(struct i2c_client *client,
> if (!psu)
> return 0;
>
> + psu->version = vs;
> psu->client = client;
> mutex_init(&psu->input_history.update_lock);
> psu->input_history.last_update = jiffies - HZ;
> @@ -405,13 +463,21 @@ static int ibm_cffps_probe(struct i2c_client *client,
> }
>
> static const struct i2c_device_id ibm_cffps_id[] = {
> - { "ibm_cffps1", 1 },
> + { "ibm_cffps1", cffps1 },
> + { "ibm_cffps2", cffps2 },
> {}
> };
> MODULE_DEVICE_TABLE(i2c, ibm_cffps_id);
>
> static const struct of_device_id ibm_cffps_of_match[] = {
> - { .compatible = "ibm,cffps1" },
> + {
> + .compatible = "ibm,cffps1",
> + .data = (void *)cffps1
> + },
> + {
> + .compatible = "ibm,cffps2",
> + .data = (void *)cffps2
> + },
> {}
> };
> MODULE_DEVICE_TABLE(of, ibm_cffps_of_match);
^ permalink raw reply
* [PATCH v2 1/3] dt-bindings: hwmon: Document ibm,cffps2 compatible string
From: Guenter Roeck @ 2019-08-31 15:26 UTC (permalink / raw)
To: linux-aspeed
In-Reply-To: <1567192263-15065-2-git-send-email-eajames@linux.ibm.com>
On Fri, Aug 30, 2019 at 02:11:01PM -0500, Eddie James wrote:
> Document the compatible string for version 2 of the IBM CFFPS PSU.
>
> Signed-off-by: Eddie James <eajames@linux.ibm.com>
Applied to hwmon-next. Note that we'll still need review from a DT maintainer.
I don't see any problems, but then who knows.
Thanks,
Guenter
> ---
> Documentation/devicetree/bindings/hwmon/ibm,cffps1.txt | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/hwmon/ibm,cffps1.txt b/Documentation/devicetree/bindings/hwmon/ibm,cffps1.txt
> index f68a0a6..1036f65 100644
> --- a/Documentation/devicetree/bindings/hwmon/ibm,cffps1.txt
> +++ b/Documentation/devicetree/bindings/hwmon/ibm,cffps1.txt
> @@ -1,8 +1,10 @@
> -Device-tree bindings for IBM Common Form Factor Power Supply Version 1
> -----------------------------------------------------------------------
> +Device-tree bindings for IBM Common Form Factor Power Supply Versions 1 and 2
> +-----------------------------------------------------------------------------
>
> Required properties:
> - - compatible = "ibm,cffps1";
> + - compatible : Must be one of the following:
> + "ibm,cffps1"
> + "ibm,cffps2"
> - reg = < I2C bus address >; : Address of the power supply on the
> I2C bus.
>
^ permalink raw reply
* [PATCH v4 4/4] aspeed/watchdog: Add access_cs0 option for alt-boot
From: Guenter Roeck @ 2019-08-31 15:01 UTC (permalink / raw)
To: linux-aspeed
In-Reply-To: <20190828102402.13155-5-i.mikhaylov@yadro.com>
On Wed, Aug 28, 2019 at 01:24:02PM +0300, Ivan Mikhaylov wrote:
> The option for the ast2400/2500 to get access to CS0 at runtime.
>
> Signed-off-by: Ivan Mikhaylov <i.mikhaylov@yadro.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> .../ABI/testing/sysfs-class-watchdog | 34 +++++++++++++++++++
> 1 file changed, 34 insertions(+)
>
> diff --git a/Documentation/ABI/testing/sysfs-class-watchdog b/Documentation/ABI/testing/sysfs-class-watchdog
> index 6317ade5ad19..675f9b537661 100644
> --- a/Documentation/ABI/testing/sysfs-class-watchdog
> +++ b/Documentation/ABI/testing/sysfs-class-watchdog
> @@ -72,3 +72,37 @@ Description:
> It is a read/write file. When read, the currently assigned
> pretimeout governor is returned. When written, it sets
> the pretimeout governor.
> +
> +What: /sys/class/watchdog/watchdog1/access_cs0
> +Date: August 2019
> +Contact: Ivan Mikhaylov <i.mikhaylov@yadro.com>,
> + Alexander Amelkin <a.amelkin@yadro.com>
> +Description:
> + It is a read/write file. This attribute exists only if the
> + system has booted from the alternate flash chip due to
> + expiration of a watchdog timer of AST2400/AST2500 when
> + alternate boot function was enabled with 'aspeed,alt-boot'
> + devicetree option for that watchdog or with an appropriate
> + h/w strapping (for WDT2 only).
> +
> + At alternate flash the 'access_cs0' sysfs node provides:
> + ast2400: a way to get access to the primary SPI flash
> + chip at CS0 after booting from the alternate
> + chip at CS1.
> + ast2500: a way to restore the normal address mapping
> + from (CS0->CS1, CS1->CS0) to (CS0->CS0,
> + CS1->CS1).
> +
> + Clearing the boot code selection and timeout counter also
> + resets to the initial state the chip select line mapping. When
> + the SoC is in normal mapping state (i.e. booted from CS0),
> + clearing those bits does nothing for both versions of the SoC.
> + For alternate boot mode (booted from CS1 due to wdt2
> + expiration) the behavior differs as described above.
> +
> + This option can be used with wdt2 (watchdog1) only.
> +
> + When read, the current status of the boot code selection is
> + shown. When written with any non-zero value, it clears
> + the boot code selection and the timeout counter, which results
> + in chipselect reset for AST2400/AST2500.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox