Skip to content

Commit 61423bf

Browse files
committed
Merge branch 'at91-5.4-trunk/tcb' into linux-5.4-at91
Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
2 parents 89d00e5 + f823310 commit 61423bf

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

drivers/clocksource/timer-atmel-tcb.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ static const u8 atmel_tcb_divisors[5] = { 2, 8, 32, 128, 0, };
351351
static const struct of_device_id atmel_tcb_of_match[] = {
352352
{ .compatible = "atmel,at91rm9200-tcb", .data = (void *)16, },
353353
{ .compatible = "atmel,at91sam9x5-tcb", .data = (void *)32, },
354+
{ .compatible = "atmel,sama5d2-tcb", .data = (void *)32, },
354355
{ /* sentinel */ }
355356
};
356357

drivers/misc/atmel_tclib.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,21 @@ static struct atmel_tcb_config tcb_sam9x5_config = {
8989
.counter_width = 32,
9090
};
9191

92+
static struct atmel_tcb_config tcb_sama5d2_config = {
93+
.counter_width = 32,
94+
.has_gclk = 1,
95+
};
96+
9297
static const struct of_device_id atmel_tcb_dt_ids[] = {
9398
{
9499
.compatible = "atmel,at91rm9200-tcb",
95100
.data = &tcb_rm9200_config,
96101
}, {
97102
.compatible = "atmel,at91sam9x5-tcb",
98103
.data = &tcb_sam9x5_config,
104+
}, {
105+
.compatible = "atmel,sama5d2-tcb",
106+
.data = &tcb_sama5d2_config,
99107
}, {
100108
/* sentinel */
101109
}

drivers/pwm/pwm-atmel-tcb.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ static int atmel_tcb_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
289289
unsigned index = pwm->hwpwm % 2;
290290
struct atmel_tcb_pwm_device *atcbpwm = NULL;
291291
struct atmel_tc *tc = tcbpwmc->tc;
292-
int i;
292+
int i = 0;
293293
int slowclk = 0;
294294
unsigned period;
295295
unsigned duty;
@@ -301,7 +301,9 @@ static int atmel_tcb_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
301301
* Find best clk divisor:
302302
* the smallest divisor which can fulfill the period_ns requirements.
303303
*/
304-
for (i = 0; i < 5; ++i) {
304+
if (tc->tcb_config->has_gclk)
305+
i = 1;
306+
for ( ; i < 5; ++i) {
305307
if (atmel_tc_divisors[i] == 0) {
306308
slowclk = i;
307309
continue;

0 commit comments

Comments
 (0)