Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e402af6c authored by Ludovic Desroches's avatar Ludovic Desroches Committed by Nicolas Ferre
Browse files

ARM: at91: fix rtc-at91sam9 irq issue due to sparse irq support



AT91_ID_SYS as virq is incorrect because of spare irq support which
introduces NR_IRQS_LEGACY offset. It modifies rtc-at91sam9 driver in
order to get irq from resources.

Signed-off-by: default avatarLudovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
parent 85ebea12
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -726,6 +726,8 @@ static struct resource rtt_resources[] = {
		.flags	= IORESOURCE_MEM,
	}, {
		.flags	= IORESOURCE_MEM,
	}, {
		.flags  = IORESOURCE_IRQ,
	},
};

@@ -744,10 +746,12 @@ static void __init at91_add_device_rtt_rtc(void)
	 * The second resource is needed:
	 * GPBR will serve as the storage for RTC time offset
	 */
	at91sam9260_rtt_device.num_resources = 2;
	at91sam9260_rtt_device.num_resources = 3;
	rtt_resources[1].start = AT91SAM9260_BASE_GPBR +
				 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;
	rtt_resources[1].end = rtt_resources[1].start + 3;
	rtt_resources[2].start = NR_IRQS_LEGACY + AT91_ID_SYS;
	rtt_resources[2].end = NR_IRQS_LEGACY + AT91_ID_SYS;
}
#else
static void __init at91_add_device_rtt_rtc(void)
+5 −1
Original line number Diff line number Diff line
@@ -609,6 +609,8 @@ static struct resource rtt_resources[] = {
		.flags	= IORESOURCE_MEM,
	}, {
		.flags	= IORESOURCE_MEM,
	}, {
		.flags  = IORESOURCE_IRQ,
	}
};

@@ -626,10 +628,12 @@ static void __init at91_add_device_rtt_rtc(void)
	 * The second resource is needed:
	 * GPBR will serve as the storage for RTC time offset
	 */
	at91sam9261_rtt_device.num_resources = 2;
	at91sam9261_rtt_device.num_resources = 3;
	rtt_resources[1].start = AT91SAM9261_BASE_GPBR +
				 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;
	rtt_resources[1].end = rtt_resources[1].start + 3;
	rtt_resources[2].start = NR_IRQS_LEGACY + AT91_ID_SYS;
	rtt_resources[2].end = NR_IRQS_LEGACY + AT91_ID_SYS;
}
#else
static void __init at91_add_device_rtt_rtc(void)
+8 −2
Original line number Diff line number Diff line
@@ -990,6 +990,8 @@ static struct resource rtt0_resources[] = {
		.flags	= IORESOURCE_MEM,
	}, {
		.flags	= IORESOURCE_MEM,
	}, {
		.flags  = IORESOURCE_IRQ,
	}
};

@@ -1006,6 +1008,8 @@ static struct resource rtt1_resources[] = {
		.flags	= IORESOURCE_MEM,
	}, {
		.flags	= IORESOURCE_MEM,
	}, {
		.flags  = IORESOURCE_IRQ,
	}
};

@@ -1027,14 +1031,14 @@ static void __init at91_add_device_rtt_rtc(void)
		 * The second resource is needed only for the chosen RTT:
		 * GPBR will serve as the storage for RTC time offset
		 */
		at91sam9263_rtt0_device.num_resources = 2;
		at91sam9263_rtt0_device.num_resources = 3;
		at91sam9263_rtt1_device.num_resources = 1;
		pdev = &at91sam9263_rtt0_device;
		r = rtt0_resources;
		break;
	case 1:
		at91sam9263_rtt0_device.num_resources = 1;
		at91sam9263_rtt1_device.num_resources = 2;
		at91sam9263_rtt1_device.num_resources = 3;
		pdev = &at91sam9263_rtt1_device;
		r = rtt1_resources;
		break;
@@ -1047,6 +1051,8 @@ static void __init at91_add_device_rtt_rtc(void)
	pdev->name = "rtc-at91sam9";
	r[1].start = AT91SAM9263_BASE_GPBR + 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;
	r[1].end = r[1].start + 3;
	r[2].start = NR_IRQS_LEGACY + AT91_ID_SYS;
	r[2].end = NR_IRQS_LEGACY + AT91_ID_SYS;
}
#else
static void __init at91_add_device_rtt_rtc(void)
+5 −1
Original line number Diff line number Diff line
@@ -1293,6 +1293,8 @@ static struct resource rtt_resources[] = {
		.flags	= IORESOURCE_MEM,
	}, {
		.flags	= IORESOURCE_MEM,
	}, {
		.flags  = IORESOURCE_IRQ,
	}
};

@@ -1310,10 +1312,12 @@ static void __init at91_add_device_rtt_rtc(void)
	 * The second resource is needed:
	 * GPBR will serve as the storage for RTC time offset
	 */
	at91sam9g45_rtt_device.num_resources = 2;
	at91sam9g45_rtt_device.num_resources = 3;
	rtt_resources[1].start = AT91SAM9G45_BASE_GPBR +
				 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;
	rtt_resources[1].end = rtt_resources[1].start + 3;
	rtt_resources[2].start = NR_IRQS_LEGACY + AT91_ID_SYS;
	rtt_resources[2].end = NR_IRQS_LEGACY + AT91_ID_SYS;
}
#else
static void __init at91_add_device_rtt_rtc(void)
+5 −1
Original line number Diff line number Diff line
@@ -688,6 +688,8 @@ static struct resource rtt_resources[] = {
		.flags	= IORESOURCE_MEM,
	}, {
		.flags	= IORESOURCE_MEM,
	}, {
		.flags  = IORESOURCE_IRQ,
	}
};

@@ -705,10 +707,12 @@ static void __init at91_add_device_rtt_rtc(void)
	 * The second resource is needed:
	 * GPBR will serve as the storage for RTC time offset
	 */
	at91sam9rl_rtt_device.num_resources = 2;
	at91sam9rl_rtt_device.num_resources = 3;
	rtt_resources[1].start = AT91SAM9RL_BASE_GPBR +
				 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;
	rtt_resources[1].end = rtt_resources[1].start + 3;
	rtt_resources[2].start = NR_IRQS_LEGACY + AT91_ID_SYS;
	rtt_resources[2].end = NR_IRQS_LEGACY + AT91_ID_SYS;
}
#else
static void __init at91_add_device_rtt_rtc(void)
Loading