2020-04-07 12:30:21

by Cristian Birsan

[permalink] [raw]
Subject: [PATCH 0/7] usb: gadget: udc: atmel: add usb device support for SAM9x60 SoC

From: Cristian Birsan <[email protected]>

This patch set adds usb device support for SAM9x60 SoC.
The DPRAM memory for the USB High Speed Device Port (UDPHS) hardware
block was increased and the allocation method is changed. This patch
series simplifies the endpoint allocation scheme to acomodate this SoC
and the old ones.

Claudiu Beznea (2):
usb: gadget: udc: atmel: use of_find_matching_node_and_match
usb: gadget: udc: atmel: add compatible for SAM9X60's PMC

Cristian Birsan (5):
usb: gadget: at91_udc: Update DT binding documentation
usb: gadget: udc: atmel: simplify endpoint allocation
usb: gadget: udc: atmel: use 1 bank endpoints for control transfers
usb: gadget: udc: atmel: rename errata into caps
usb: gadget: udc: atmel: update endpoint allocation for sam9x60

.../devicetree/bindings/usb/atmel-usb.txt | 1 +
drivers/usb/gadget/udc/atmel_usba_udc.c | 87 ++++++++++++-------
drivers/usb/gadget/udc/atmel_usba_udc.h | 6 +-
3 files changed, 58 insertions(+), 36 deletions(-)

--
2.17.1


2020-04-07 12:30:25

by Cristian Birsan

[permalink] [raw]
Subject: [PATCH 1/7] usb: gadget: udc: atmel: use of_find_matching_node_and_match

From: Claudiu Beznea <[email protected]>

Instead of trying to match every possible compatible use
of_find_matching_node_and_match() and pass the compatible array.

Signed-off-by: Claudiu Beznea <[email protected]>
---
drivers/usb/gadget/udc/atmel_usba_udc.c | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 6e0432141c40..32e5b44d9fbd 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -2052,6 +2052,12 @@ static const struct of_device_id atmel_udc_dt_ids[] = {

MODULE_DEVICE_TABLE(of, atmel_udc_dt_ids);

+static const struct of_device_id atmel_pmc_dt_ids[] = {
+ { .compatible = "atmel,at91sam9g45-pmc" },
+ { .compatible = "atmel,at91sam9rl-pmc" },
+ { .compatible = "atmel,at91sam9x5-pmc" },
+};
+
static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev,
struct usba_udc *udc)
{
@@ -2067,13 +2073,17 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev,
return ERR_PTR(-EINVAL);

udc->errata = match->data;
- udc->pmc = syscon_regmap_lookup_by_compatible("atmel,at91sam9g45-pmc");
- if (IS_ERR(udc->pmc))
- udc->pmc = syscon_regmap_lookup_by_compatible("atmel,at91sam9rl-pmc");
- if (IS_ERR(udc->pmc))
- udc->pmc = syscon_regmap_lookup_by_compatible("atmel,at91sam9x5-pmc");
- if (udc->errata && IS_ERR(udc->pmc))
- return ERR_CAST(udc->pmc);
+ if (udc->errata) {
+ pp = of_find_matching_node_and_match(NULL, atmel_pmc_dt_ids,
+ NULL);
+ if (!pp)
+ return ERR_PTR(-ENODEV);
+
+ udc->pmc = syscon_node_to_regmap(pp);
+ of_node_put(pp);
+ if (IS_ERR(udc->pmc))
+ return ERR_CAST(udc->pmc);
+ }

udc->num_ep = 0;

--
2.17.1

2020-04-07 12:30:29

by Cristian Birsan

[permalink] [raw]
Subject: [PATCH 2/7] usb: gadget: udc: atmel: add compatible for SAM9X60's PMC

From: Claudiu Beznea <[email protected]>

Add compatible for SAM9X60's PMC.

Signed-off-by: Claudiu Beznea <[email protected]>
[[email protected] Add sentinel at the end of the array]
Signed-off-by: Cristian Birsan <[email protected]>
---
drivers/usb/gadget/udc/atmel_usba_udc.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 32e5b44d9fbd..c50902b91a96 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -2056,6 +2056,8 @@ static const struct of_device_id atmel_pmc_dt_ids[] = {
{ .compatible = "atmel,at91sam9g45-pmc" },
{ .compatible = "atmel,at91sam9rl-pmc" },
{ .compatible = "atmel,at91sam9x5-pmc" },
+ { .compatible = "microchip,sam9x60-pmc" },
+ { /* sentinel */ }
};

static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev,
--
2.17.1

2020-04-07 12:31:00

by Cristian Birsan

[permalink] [raw]
Subject: [PATCH 7/7] usb: gadget: udc: atmel: update endpoint allocation for sam9x60

From: Cristian Birsan <[email protected]>

The DPRAM memory from the USB High Speed Device Port (UDPHS) hardware
block was increased. This patch updates the endpoint allocation for sam9x60
to take advantage of this larger memory. At the same time the
constraint to allocate the endpoints in order was lifted. To handle old
and new hardware in the same driver the capabilities (caps) structure
was extended.

Signed-off-by: Cristian Birsan <[email protected]>
---
drivers/usb/gadget/udc/atmel_usba_udc.c | 22 ++++++++++++++++++----
drivers/usb/gadget/udc/atmel_usba_udc.h | 1 +
2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index dfe30913c76b..3eb715d4d786 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -1066,12 +1066,14 @@ static struct usb_ep *atmel_usba_match_ep(struct usb_gadget *gadget,

case USB_ENDPOINT_XFER_ISOC:
ep->fifo_size = 1024;
- ep->nr_banks = 2;
+ if (ep->udc->caps->ep_prealloc)
+ ep->nr_banks = 2;
break;

case USB_ENDPOINT_XFER_BULK:
ep->fifo_size = 512;
- ep->nr_banks = 1;
+ if (ep->udc->caps->ep_prealloc)
+ ep->nr_banks = 1;
break;

case USB_ENDPOINT_XFER_INT:
@@ -1081,7 +1083,8 @@ static struct usb_ep *atmel_usba_match_ep(struct usb_gadget *gadget,
else
ep->fifo_size =
roundup_pow_of_two(le16_to_cpu(desc->wMaxPacketSize));
- ep->nr_banks = 1;
+ if (ep->udc->caps->ep_prealloc)
+ ep->nr_banks = 1;
break;
}

@@ -2034,16 +2037,27 @@ static void at91sam9g45_pulse_bias(struct usba_udc *udc)

static const struct usba_udc_caps at91sam9rl_caps = {
.toggle_bias = at91sam9rl_toggle_bias,
+ .ep_prealloc = true,
};

static const struct usba_udc_caps at91sam9g45_caps = {
.pulse_bias = at91sam9g45_pulse_bias,
+ .ep_prealloc = true,
+};
+
+static const struct usba_udc_caps sama5d3_caps = {
+ .ep_prealloc = true,
+};
+
+static const struct usba_udc_caps at91sam9x60_caps = {
+ .ep_prealloc = false,
};

static const struct of_device_id atmel_udc_dt_ids[] = {
{ .compatible = "atmel,at91sam9rl-udc", .data = &at91sam9rl_caps },
{ .compatible = "atmel,at91sam9g45-udc", .data = &at91sam9g45_caps },
- { .compatible = "atmel,sama5d3-udc" },
+ { .compatible = "atmel,sama5d3-udc", .data = &sama5d3_caps },
+ { .compatible = "microchip,sam9x60-udc", .data = &at91sam9x60_caps },
{ /* sentinel */ }
};

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.h b/drivers/usb/gadget/udc/atmel_usba_udc.h
index 1a0f77bf8d4f..f9239e200e7a 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.h
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.h
@@ -305,6 +305,7 @@ struct usba_request {
struct usba_udc_caps {
void (*toggle_bias)(struct usba_udc *udc, int is_on);
void (*pulse_bias)(struct usba_udc *udc);
+ bool ep_prealloc;
};

struct usba_udc {
--
2.17.1

2020-04-07 12:31:02

by Cristian Birsan

[permalink] [raw]
Subject: [PATCH 3/7] usb: gadget: at91_udc: Update DT binding documentation

From: Cristian Birsan <[email protected]>

Add sam9x60 binding.

Signed-off-by: Cristian Birsan <[email protected]>
---
Documentation/devicetree/bindings/usb/atmel-usb.txt | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/usb/atmel-usb.txt b/Documentation/devicetree/bindings/usb/atmel-usb.txt
index 44e80153b148..bae2b928a014 100644
--- a/Documentation/devicetree/bindings/usb/atmel-usb.txt
+++ b/Documentation/devicetree/bindings/usb/atmel-usb.txt
@@ -82,6 +82,7 @@ Required properties:
"atmel,at91sam9rl-udc"
"atmel,at91sam9g45-udc"
"atmel,sama5d3-udc"
+ "microchip,sam9x60-udc"
- reg: Address and length of the register set for the device
- interrupts: Should contain usba interrupt
- clocks: Should reference the peripheral and host clocks
--
2.17.1

2020-04-07 12:31:58

by Cristian Birsan

[permalink] [raw]
Subject: [PATCH 6/7] usb: gadget: udc: atmel: rename errata into caps

From: Cristian Birsan <[email protected]>

Rename errata structure into capabilities (caps). It will be used to add
capabilities for new SoCs. Get the pointer to PMC only for the SoCs that
need it to perform toggle_bias or pulse_bias.

Signed-off-by: Cristian Birsan <[email protected]>
---
drivers/usb/gadget/udc/atmel_usba_udc.c | 21 ++++++++++-----------
drivers/usb/gadget/udc/atmel_usba_udc.h | 4 ++--
2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 1e2194fe06cb..dfe30913c76b 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -389,8 +389,8 @@ static int vbus_is_present(struct usba_udc *udc)

static void toggle_bias(struct usba_udc *udc, int is_on)
{
- if (udc->errata && udc->errata->toggle_bias)
- udc->errata->toggle_bias(udc, is_on);
+ if (udc->caps && udc->caps->toggle_bias)
+ udc->caps->toggle_bias(udc, is_on);
}

static void generate_bias_pulse(struct usba_udc *udc)
@@ -398,8 +398,8 @@ static void generate_bias_pulse(struct usba_udc *udc)
if (!udc->bias_pulse_needed)
return;

- if (udc->errata && udc->errata->pulse_bias)
- udc->errata->pulse_bias(udc);
+ if (udc->caps && udc->caps->pulse_bias)
+ udc->caps->pulse_bias(udc);

udc->bias_pulse_needed = false;
}
@@ -2032,17 +2032,17 @@ static void at91sam9g45_pulse_bias(struct usba_udc *udc)
AT91_PMC_BIASEN);
}

-static const struct usba_udc_errata at91sam9rl_errata = {
+static const struct usba_udc_caps at91sam9rl_caps = {
.toggle_bias = at91sam9rl_toggle_bias,
};

-static const struct usba_udc_errata at91sam9g45_errata = {
+static const struct usba_udc_caps at91sam9g45_caps = {
.pulse_bias = at91sam9g45_pulse_bias,
};

static const struct of_device_id atmel_udc_dt_ids[] = {
- { .compatible = "atmel,at91sam9rl-udc", .data = &at91sam9rl_errata },
- { .compatible = "atmel,at91sam9g45-udc", .data = &at91sam9g45_errata },
+ { .compatible = "atmel,at91sam9rl-udc", .data = &at91sam9rl_caps },
+ { .compatible = "atmel,at91sam9g45-udc", .data = &at91sam9g45_caps },
{ .compatible = "atmel,sama5d3-udc" },
{ /* sentinel */ }
};
@@ -2053,7 +2053,6 @@ static const struct of_device_id atmel_pmc_dt_ids[] = {
{ .compatible = "atmel,at91sam9g45-pmc" },
{ .compatible = "atmel,at91sam9rl-pmc" },
{ .compatible = "atmel,at91sam9x5-pmc" },
- { .compatible = "microchip,sam9x60-pmc" },
{ /* sentinel */ }
};

@@ -2071,8 +2070,8 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev,
if (!match)
return ERR_PTR(-EINVAL);

- udc->errata = match->data;
- if (udc->errata) {
+ udc->caps = match->data;
+ if (udc->caps && (udc->caps->pulse_bias || udc->caps->toggle_bias)) {
pp = of_find_matching_node_and_match(NULL, atmel_pmc_dt_ids,
NULL);
if (!pp)
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.h b/drivers/usb/gadget/udc/atmel_usba_udc.h
index 8de79356d31d..1a0f77bf8d4f 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.h
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.h
@@ -302,7 +302,7 @@ struct usba_request {
unsigned int mapped:1;
};

-struct usba_udc_errata {
+struct usba_udc_caps {
void (*toggle_bias)(struct usba_udc *udc, int is_on);
void (*pulse_bias)(struct usba_udc *udc);
};
@@ -320,7 +320,7 @@ struct usba_udc {
struct usb_gadget gadget;
struct usb_gadget_driver *driver;
struct platform_device *pdev;
- const struct usba_udc_errata *errata;
+ const struct usba_udc_caps *caps;
int irq;
struct gpio_desc *vbus_pin;
int num_ep;
--
2.17.1

2020-04-07 12:32:10

by Cristian Birsan

[permalink] [raw]
Subject: [PATCH 4/7] usb: gadget: udc: atmel: simplify endpoint allocation

From: Cristian Birsan <[email protected]>

Simplify the endpoint allocation and cleanup the code.

Signed-off-by: Cristian Birsan <[email protected]>
---
drivers/usb/gadget/udc/atmel_usba_udc.c | 21 ++++++++-------------
drivers/usb/gadget/udc/atmel_usba_udc.h | 1 -
2 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index c50902b91a96..7011438f91d6 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -1097,7 +1097,6 @@ static struct usb_ep *atmel_usba_match_ep(struct usb_gadget *gadget,

ep->ept_cfg |= USBA_BF(BK_NUMBER, ep->nr_banks);

- ep->udc->configured_ep++;
}

return _ep;
@@ -1790,7 +1789,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)

if (status & USBA_END_OF_RESET) {
struct usba_ep *ep0, *ep;
- int i, n;
+ int i;

usba_writel(udc, INT_CLR,
USBA_END_OF_RESET|USBA_END_OF_RESUME
@@ -1838,13 +1837,14 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
"ODD: EP0 configuration is invalid!\n");

/* Preallocate other endpoints */
- n = fifo_mode ? udc->num_ep : udc->configured_ep;
- for (i = 1; i < n; i++) {
+ for (i = 1; i < udc->num_ep; i++) {
ep = &udc->usba_ep[i];
- usba_ep_writel(ep, CFG, ep->ept_cfg);
- if (!(usba_ep_readl(ep, CFG) & USBA_EPT_MAPPED))
- dev_err(&udc->pdev->dev,
- "ODD: EP%d configuration is invalid!\n", i);
+ if (ep->ep.claimed) {
+ usba_ep_writel(ep, CFG, ep->ept_cfg);
+ if (!(usba_ep_readl(ep, CFG) & USBA_EPT_MAPPED))
+ dev_err(&udc->pdev->dev,
+ "ODD: EP%d configuration is invalid!\n", i);
+ }
}
}

@@ -2011,10 +2011,6 @@ static int atmel_usba_stop(struct usb_gadget *gadget)
if (udc->vbus_pin)
disable_irq(gpiod_to_irq(udc->vbus_pin));

- if (fifo_mode == 0)
- udc->configured_ep = 1;
-
- udc->suspended = false;
usba_stop(udc);

udc->driver = NULL;
@@ -2096,7 +2092,6 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev,
pp = NULL;
while ((pp = of_get_next_child(np, pp)))
udc->num_ep++;
- udc->configured_ep = 1;
} else {
udc->num_ep = usba_config_fifo_table(udc);
}
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.h b/drivers/usb/gadget/udc/atmel_usba_udc.h
index a0225e4543d4..8de79356d31d 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.h
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.h
@@ -324,7 +324,6 @@ struct usba_udc {
int irq;
struct gpio_desc *vbus_pin;
int num_ep;
- int configured_ep;
struct usba_fifo_cfg *fifo_cfg;
struct clk *pclk;
struct clk *hclk;
--
2.17.1

2020-04-07 12:32:27

by Cristian Birsan

[permalink] [raw]
Subject: [PATCH 5/7] usb: gadget: udc: atmel: use 1 bank endpoints for control transfers

From: Cristian Birsan <[email protected]>

Use 1 bank endpoints for control transfers

Signed-off-by: Cristian Birsan <[email protected]>
---
drivers/usb/gadget/udc/atmel_usba_udc.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 7011438f91d6..1e2194fe06cb 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -1061,6 +1061,7 @@ static struct usb_ep *atmel_usba_match_ep(struct usb_gadget *gadget,

switch (usb_endpoint_type(desc)) {
case USB_ENDPOINT_XFER_CONTROL:
+ ep->nr_banks = 1;
break;

case USB_ENDPOINT_XFER_ISOC:
--
2.17.1

2020-04-07 13:43:01

by Alexandre Belloni

[permalink] [raw]
Subject: Re: [PATCH 2/7] usb: gadget: udc: atmel: add compatible for SAM9X60's PMC

Hi,

On 07/04/2020 15:28:47+0300, [email protected] wrote:
> From: Claudiu Beznea <[email protected]>
>
> Add compatible for SAM9X60's PMC.
>
> Signed-off-by: Claudiu Beznea <[email protected]>
> [[email protected] Add sentinel at the end of the array]
> Signed-off-by: Cristian Birsan <[email protected]>
> ---
> drivers/usb/gadget/udc/atmel_usba_udc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
> index 32e5b44d9fbd..c50902b91a96 100644
> --- a/drivers/usb/gadget/udc/atmel_usba_udc.c
> +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
> @@ -2056,6 +2056,8 @@ static const struct of_device_id atmel_pmc_dt_ids[] = {
> { .compatible = "atmel,at91sam9g45-pmc" },
> { .compatible = "atmel,at91sam9rl-pmc" },
> { .compatible = "atmel,at91sam9x5-pmc" },
> + { .compatible = "microchip,sam9x60-pmc" },
> + { /* sentinel */ }

This patch can be squashed in the previous one.

--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

2020-04-07 13:46:45

by Alexandre Belloni

[permalink] [raw]
Subject: Re: [PATCH 3/7] usb: gadget: at91_udc: Update DT binding documentation

Hi,

The prefix for this patch should be dt-bindings: usb:

On 07/04/2020 15:28:48+0300, [email protected] wrote:
> From: Cristian Birsan <[email protected]>
>
> Add sam9x60 binding.
>
> Signed-off-by: Cristian Birsan <[email protected]>
> ---
> Documentation/devicetree/bindings/usb/atmel-usb.txt | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/Documentation/devicetree/bindings/usb/atmel-usb.txt b/Documentation/devicetree/bindings/usb/atmel-usb.txt
> index 44e80153b148..bae2b928a014 100644
> --- a/Documentation/devicetree/bindings/usb/atmel-usb.txt
> +++ b/Documentation/devicetree/bindings/usb/atmel-usb.txt
> @@ -82,6 +82,7 @@ Required properties:
> "atmel,at91sam9rl-udc"
> "atmel,at91sam9g45-udc"
> "atmel,sama5d3-udc"
> + "microchip,sam9x60-udc"
> - reg: Address and length of the register set for the device
> - interrupts: Should contain usba interrupt
> - clocks: Should reference the peripheral and host clocks
> --
> 2.17.1
>

--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

2020-04-07 13:49:25

by Alexandre Belloni

[permalink] [raw]
Subject: Re: [PATCH 6/7] usb: gadget: udc: atmel: rename errata into caps

On 07/04/2020 15:28:51+0300, [email protected] wrote:
> From: Cristian Birsan <[email protected]>
>
> Rename errata structure into capabilities (caps). It will be used to add
> capabilities for new SoCs. Get the pointer to PMC only for the SoCs that
> need it to perform toggle_bias or pulse_bias.
>
> Signed-off-by: Cristian Birsan <[email protected]>
> ---
> drivers/usb/gadget/udc/atmel_usba_udc.c | 21 ++++++++++-----------
> drivers/usb/gadget/udc/atmel_usba_udc.h | 4 ++--
> 2 files changed, 12 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
> index 1e2194fe06cb..dfe30913c76b 100644
> --- a/drivers/usb/gadget/udc/atmel_usba_udc.c
> +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
> @@ -389,8 +389,8 @@ static int vbus_is_present(struct usba_udc *udc)
>
> static void toggle_bias(struct usba_udc *udc, int is_on)
> {
> - if (udc->errata && udc->errata->toggle_bias)
> - udc->errata->toggle_bias(udc, is_on);
> + if (udc->caps && udc->caps->toggle_bias)
> + udc->caps->toggle_bias(udc, is_on);
> }
>
> static void generate_bias_pulse(struct usba_udc *udc)
> @@ -398,8 +398,8 @@ static void generate_bias_pulse(struct usba_udc *udc)
> if (!udc->bias_pulse_needed)
> return;
>
> - if (udc->errata && udc->errata->pulse_bias)
> - udc->errata->pulse_bias(udc);
> + if (udc->caps && udc->caps->pulse_bias)
> + udc->caps->pulse_bias(udc);
>
> udc->bias_pulse_needed = false;
> }
> @@ -2032,17 +2032,17 @@ static void at91sam9g45_pulse_bias(struct usba_udc *udc)
> AT91_PMC_BIASEN);
> }
>
> -static const struct usba_udc_errata at91sam9rl_errata = {
> +static const struct usba_udc_caps at91sam9rl_caps = {
> .toggle_bias = at91sam9rl_toggle_bias,
> };
>
> -static const struct usba_udc_errata at91sam9g45_errata = {
> +static const struct usba_udc_caps at91sam9g45_caps = {
> .pulse_bias = at91sam9g45_pulse_bias,
> };
>
> static const struct of_device_id atmel_udc_dt_ids[] = {
> - { .compatible = "atmel,at91sam9rl-udc", .data = &at91sam9rl_errata },
> - { .compatible = "atmel,at91sam9g45-udc", .data = &at91sam9g45_errata },
> + { .compatible = "atmel,at91sam9rl-udc", .data = &at91sam9rl_caps },
> + { .compatible = "atmel,at91sam9g45-udc", .data = &at91sam9g45_caps },
> { .compatible = "atmel,sama5d3-udc" },
> { /* sentinel */ }
> };
> @@ -2053,7 +2053,6 @@ static const struct of_device_id atmel_pmc_dt_ids[] = {
> { .compatible = "atmel,at91sam9g45-pmc" },
> { .compatible = "atmel,at91sam9rl-pmc" },
> { .compatible = "atmel,at91sam9x5-pmc" },
> - { .compatible = "microchip,sam9x60-pmc" },

This was added in 2/7 and is removed now. I believe the series needs a
bit of rework.

--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

2020-04-07 14:00:51

by Cristian Birsan

[permalink] [raw]
Subject: Re: [PATCH 3/7] usb: gadget: at91_udc: Update DT binding documentation

On 4/7/20 4:45 PM, Alexandre Belloni wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> Hi,
>
> The prefix for this patch should be dt-bindings: usb:
>

Yes, thanks. I'll send this patch together with the device tree node separately.

> On 07/04/2020 15:28:48+0300, [email protected] wrote:
>> From: Cristian Birsan <[email protected]>
>>
>> Add sam9x60 binding.
>>
>> Signed-off-by: Cristian Birsan <[email protected]>
>> ---
>> Documentation/devicetree/bindings/usb/atmel-usb.txt | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/Documentation/devicetree/bindings/usb/atmel-usb.txt b/Documentation/devicetree/bindings/usb/atmel-usb.txt
>> index 44e80153b148..bae2b928a014 100644
>> --- a/Documentation/devicetree/bindings/usb/atmel-usb.txt
>> +++ b/Documentation/devicetree/bindings/usb/atmel-usb.txt
>> @@ -82,6 +82,7 @@ Required properties:
>> "atmel,at91sam9rl-udc"
>> "atmel,at91sam9g45-udc"
>> "atmel,sama5d3-udc"
>> + "microchip,sam9x60-udc"
>> - reg: Address and length of the register set for the device
>> - interrupts: Should contain usba interrupt
>> - clocks: Should reference the peripheral and host clocks
>> --
>> 2.17.1
>>
>
> --
> Alexandre Belloni, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>

2020-04-07 14:06:09

by Cristian Birsan

[permalink] [raw]
Subject: Re: [PATCH 2/7] usb: gadget: udc: atmel: add compatible for SAM9X60's PMC

On 4/7/20 4:41 PM, Alexandre Belloni wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> Hi,
>
> On 07/04/2020 15:28:47+0300, [email protected] wrote:
>> From: Claudiu Beznea <[email protected]>
>>
>> Add compatible for SAM9X60's PMC.
>>
>> Signed-off-by: Claudiu Beznea <[email protected]>
>> [[email protected] Add sentinel at the end of the array]
>> Signed-off-by: Cristian Birsan <[email protected]>
>> ---
>> drivers/usb/gadget/udc/atmel_usba_udc.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
>> index 32e5b44d9fbd..c50902b91a96 100644
>> --- a/drivers/usb/gadget/udc/atmel_usba_udc.c
>> +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
>> @@ -2056,6 +2056,8 @@ static const struct of_device_id atmel_pmc_dt_ids[] = {
>> { .compatible = "atmel,at91sam9g45-pmc" },
>> { .compatible = "atmel,at91sam9rl-pmc" },
>> { .compatible = "atmel,at91sam9x5-pmc" },
>> + { .compatible = "microchip,sam9x60-pmc" },
>> + { /* sentinel */ }
>
> This patch can be squashed in the previous one.

I'll squash it in v2.

>
> --
> Alexandre Belloni, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>

2020-04-07 14:06:09

by Alexandre Belloni

[permalink] [raw]
Subject: Re: [PATCH 3/7] usb: gadget: at91_udc: Update DT binding documentation

On 07/04/2020 13:59:52+0000, [email protected] wrote:
> On 4/7/20 4:45 PM, Alexandre Belloni wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> >
> > Hi,
> >
> > The prefix for this patch should be dt-bindings: usb:
> >
>
> Yes, thanks. I'll send this patch together with the device tree node separately.
>

No, it has to be in the same series that adds the compatible to the
driver.

> > On 07/04/2020 15:28:48+0300, [email protected] wrote:
> >> From: Cristian Birsan <[email protected]>
> >>
> >> Add sam9x60 binding.
> >>
> >> Signed-off-by: Cristian Birsan <[email protected]>
> >> ---
> >> Documentation/devicetree/bindings/usb/atmel-usb.txt | 1 +
> >> 1 file changed, 1 insertion(+)
> >>
> >> diff --git a/Documentation/devicetree/bindings/usb/atmel-usb.txt b/Documentation/devicetree/bindings/usb/atmel-usb.txt
> >> index 44e80153b148..bae2b928a014 100644
> >> --- a/Documentation/devicetree/bindings/usb/atmel-usb.txt
> >> +++ b/Documentation/devicetree/bindings/usb/atmel-usb.txt
> >> @@ -82,6 +82,7 @@ Required properties:
> >> "atmel,at91sam9rl-udc"
> >> "atmel,at91sam9g45-udc"
> >> "atmel,sama5d3-udc"
> >> + "microchip,sam9x60-udc"
> >> - reg: Address and length of the register set for the device
> >> - interrupts: Should contain usba interrupt
> >> - clocks: Should reference the peripheral and host clocks
> >> --
> >> 2.17.1
> >>
> >
> > --
> > Alexandre Belloni, Bootlin
> > Embedded Linux and Kernel engineering
> > https://bootlin.com
> >
>

--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com