Skip to content

Commit d64107f

Browse files
committed
usb: gadget: udc: atmel: rename errata into caps
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 <cristian.birsan@microchip.com>
1 parent cd4f0cf commit d64107f

2 files changed

Lines changed: 12 additions & 13 deletions

File tree

drivers/usb/gadget/udc/atmel_usba_udc.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -388,17 +388,17 @@ static int vbus_is_present(struct usba_udc *udc)
388388

389389
static void toggle_bias(struct usba_udc *udc, int is_on)
390390
{
391-
if (udc->errata && udc->errata->toggle_bias)
392-
udc->errata->toggle_bias(udc, is_on);
391+
if (udc->caps && udc->caps->toggle_bias)
392+
udc->caps->toggle_bias(udc, is_on);
393393
}
394394

395395
static void generate_bias_pulse(struct usba_udc *udc)
396396
{
397397
if (!udc->bias_pulse_needed)
398398
return;
399399

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

403403
udc->bias_pulse_needed = false;
404404
}
@@ -2031,17 +2031,17 @@ static void at91sam9g45_pulse_bias(struct usba_udc *udc)
20312031
AT91_PMC_BIASEN);
20322032
}
20332033

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

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

20422042
static const struct of_device_id atmel_udc_dt_ids[] = {
2043-
{ .compatible = "atmel,at91sam9rl-udc", .data = &at91sam9rl_errata },
2044-
{ .compatible = "atmel,at91sam9g45-udc", .data = &at91sam9g45_errata },
2043+
{ .compatible = "atmel,at91sam9rl-udc", .data = &at91sam9rl_caps },
2044+
{ .compatible = "atmel,at91sam9g45-udc", .data = &at91sam9g45_caps },
20452045
{ .compatible = "atmel,sama5d3-udc" },
20462046
{ /* sentinel */ }
20472047
};
@@ -2052,7 +2052,6 @@ static const struct of_device_id atmel_pmc_dt_ids[] = {
20522052
{ .compatible = "atmel,at91sam9g45-pmc" },
20532053
{ .compatible = "atmel,at91sam9rl-pmc" },
20542054
{ .compatible = "atmel,at91sam9x5-pmc" },
2055-
{ .compatible = "microchip,sam9x60-pmc" },
20562055
{ /* sentinel */ }
20572056
};
20582057

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

2073-
udc->errata = match->data;
2074-
if (udc->errata) {
2072+
udc->caps = match->data;
2073+
if (udc->caps && (udc->caps->pulse_bias || udc->caps->toggle_bias)) {
20752074
pp = of_find_matching_node_and_match(NULL, atmel_pmc_dt_ids,
20762075
NULL);
20772076
if (!pp)

drivers/usb/gadget/udc/atmel_usba_udc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ struct usba_request {
302302
unsigned int mapped:1;
303303
};
304304

305-
struct usba_udc_errata {
305+
struct usba_udc_caps {
306306
void (*toggle_bias)(struct usba_udc *udc, int is_on);
307307
void (*pulse_bias)(struct usba_udc *udc);
308308
};
@@ -320,7 +320,7 @@ struct usba_udc {
320320
struct usb_gadget gadget;
321321
struct usb_gadget_driver *driver;
322322
struct platform_device *pdev;
323-
const struct usba_udc_errata *errata;
323+
const struct usba_udc_caps *caps;
324324
int irq;
325325
struct gpio_desc *vbus_pin;
326326
int num_ep;

0 commit comments

Comments
 (0)