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

Commit 5204601c authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Simon Horman
Browse files

sh: Switch to new style MTU2 device



The MTU2 (Multi-Function Timer Pulse Unit 2) driver implements a new
style of platform data that handles the timer as a single device with
multiple channel. Switch from the old-style platform data to the
new-style platform data.

Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: default avatarWolfram Sang <wsa@sang-engineering.com>
Signed-off-by: default avatarSimon Horman <horms+renesas@verge.net.au>
parent e4ae34e2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ int __init __deprecated cpg_clk_init(void)
	clk_add_alias("fck", "sh-tmu.0", "peripheral_clk", NULL);
	clk_add_alias("fck", "sh-tmu.1", "peripheral_clk", NULL);
	clk_add_alias("fck", "sh-tmu.2", "peripheral_clk", NULL);
	clk_add_alias("mtu2_fck", NULL, "peripheral_clk", NULL);
	clk_add_alias("fck", "sh-mtu2", "peripheral_clk", NULL);
	clk_add_alias("fck", "sh-cmt-16.0", "peripheral_clk", NULL);
	clk_add_alias("fck", "sh-cmt-32.0", "peripheral_clk", NULL);
	clk_add_alias("sci_ick", NULL, "peripheral_clk", NULL);
+1 −1
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ static struct clk_lookup lookups[] = {
	CLKDEV_CON_ID("vdc3", &mstp_clks[MSTP74]),
	CLKDEV_ICK_ID("fck", "sh-cmt-16.0", &mstp_clks[MSTP72]),
	CLKDEV_CON_ID("usb0", &mstp_clks[MSTP60]),
	CLKDEV_CON_ID("mtu2_fck", &mstp_clks[MSTP35]),
	CLKDEV_ICK_ID("fck", "sh-mtu2", &mstp_clks[MSTP35]),
	CLKDEV_CON_ID("sdhi0", &mstp_clks[MSTP34]),
	CLKDEV_CON_ID("sdhi1", &mstp_clks[MSTP33]),
	CLKDEV_CON_ID("adc0", &mstp_clks[MSTP32]),
+1 −1
Original line number Diff line number Diff line
@@ -160,7 +160,7 @@ static struct clk_lookup lookups[] = {
	CLKDEV_ICK_ID("sci_fck", "sh-sci.7", &mstp_clks[MSTP40]),
	CLKDEV_ICK_ID("fck", "sh-cmt-16.0", &mstp_clks[MSTP72]),
	CLKDEV_CON_ID("usb0", &mstp_clks[MSTP60]),
	CLKDEV_CON_ID("mtu2_fck", &mstp_clks[MSTP35]),
	CLKDEV_ICK_ID("fck", "sh-mtu2", &mstp_clks[MSTP35]),
	CLKDEV_CON_ID("adc0", &mstp_clks[MSTP32]),
	CLKDEV_CON_ID("rtc0", &mstp_clks[MSTP30]),
};
+12 −86
Original line number Diff line number Diff line
@@ -114,88 +114,18 @@ static struct intc_mask_reg mask_registers[] __initdata = {
static DECLARE_INTC_DESC(intc_desc, "mxg", vectors, groups,
			 mask_registers, prio_registers, NULL);

static struct sh_timer_config mtu2_0_platform_data = {
	.channel_offset = -0x80,
	.timer_bit = 0,
	.clockevent_rating = 200,
static struct resource mtu2_resources[] = {
	DEFINE_RES_MEM(0xff801000, 0x400),
	DEFINE_RES_IRQ_NAMED(228, "tgi0a"),
	DEFINE_RES_IRQ_NAMED(234, "tgi1a"),
	DEFINE_RES_IRQ_NAMED(240, "tgi2a"),
};

static struct resource mtu2_0_resources[] = {
	[0] = {
		.start	= 0xff801300,
		.end	= 0xff801326,
		.flags	= IORESOURCE_MEM,
	},
	[1] = {
		.start	= 228,
		.flags	= IORESOURCE_IRQ,
	},
};

static struct platform_device mtu2_0_device = {
	.name		= "sh_mtu2",
	.id		= 0,
	.dev = {
		.platform_data	= &mtu2_0_platform_data,
	},
	.resource	= mtu2_0_resources,
	.num_resources	= ARRAY_SIZE(mtu2_0_resources),
};

static struct sh_timer_config mtu2_1_platform_data = {
	.channel_offset = -0x100,
	.timer_bit = 1,
	.clockevent_rating = 200,
};

static struct resource mtu2_1_resources[] = {
	[0] = {
		.start	= 0xff801380,
		.end	= 0xff801390,
		.flags	= IORESOURCE_MEM,
	},
	[1] = {
		.start	= 234,
		.flags	= IORESOURCE_IRQ,
	},
};

static struct platform_device mtu2_1_device = {
	.name		= "sh_mtu2",
	.id		= 1,
	.dev = {
		.platform_data	= &mtu2_1_platform_data,
	},
	.resource	= mtu2_1_resources,
	.num_resources	= ARRAY_SIZE(mtu2_1_resources),
};

static struct sh_timer_config mtu2_2_platform_data = {
	.channel_offset = 0x80,
	.timer_bit = 2,
	.clockevent_rating = 200,
};

static struct resource mtu2_2_resources[] = {
	[0] = {
		.start	= 0xff801000,
		.end	= 0xff80100a,
		.flags	= IORESOURCE_MEM,
	},
	[1] = {
		.start	= 240,
		.flags	= IORESOURCE_IRQ,
	},
};

static struct platform_device mtu2_2_device = {
	.name		= "sh_mtu2",
	.id		= 2,
	.dev = {
		.platform_data	= &mtu2_2_platform_data,
	},
	.resource	= mtu2_2_resources,
	.num_resources	= ARRAY_SIZE(mtu2_2_resources),
static struct platform_device mtu2_device = {
	.name		= "sh-mtu2",
	.id		= -1,
	.resource	= mtu2_resources,
	.num_resources	= ARRAY_SIZE(mtu2_resources),
};

static struct plat_sci_port scif0_platform_data = {
@@ -221,9 +151,7 @@ static struct platform_device scif0_device = {

static struct platform_device *mxg_devices[] __initdata = {
	&scif0_device,
	&mtu2_0_device,
	&mtu2_1_device,
	&mtu2_2_device,
	&mtu2_device,
};

static int __init mxg_devices_setup(void)
@@ -240,9 +168,7 @@ void __init plat_irq_setup(void)

static struct platform_device *mxg_early_devices[] __initdata = {
	&scif0_device,
	&mtu2_0_device,
	&mtu2_1_device,
	&mtu2_2_device,
	&mtu2_device,
};

void __init plat_early_device_setup(void)
+12 −86
Original line number Diff line number Diff line
@@ -365,88 +365,18 @@ static struct platform_device rtc_device = {
	.resource	= rtc_resources,
};

static struct sh_timer_config mtu2_0_platform_data = {
	.channel_offset = -0x80,
	.timer_bit = 0,
	.clockevent_rating = 200,
static struct resource mtu2_resources[] = {
	DEFINE_RES_MEM(0xfffe4000, 0x400),
	DEFINE_RES_IRQ_NAMED(108, "tgi0a"),
	DEFINE_RES_IRQ_NAMED(116, "tgi1a"),
	DEFINE_RES_IRQ_NAMED(124, "tgi1b"),
};

static struct resource mtu2_0_resources[] = {
	[0] = {
		.start	= 0xfffe4300,
		.end	= 0xfffe4326,
		.flags	= IORESOURCE_MEM,
	},
	[1] = {
		.start	= 108,
		.flags	= IORESOURCE_IRQ,
	},
};

static struct platform_device mtu2_0_device = {
	.name		= "sh_mtu2",
	.id		= 0,
	.dev = {
		.platform_data	= &mtu2_0_platform_data,
	},
	.resource	= mtu2_0_resources,
	.num_resources	= ARRAY_SIZE(mtu2_0_resources),
};

static struct sh_timer_config mtu2_1_platform_data = {
	.channel_offset = -0x100,
	.timer_bit = 1,
	.clockevent_rating = 200,
};

static struct resource mtu2_1_resources[] = {
	[0] = {
		.start	= 0xfffe4380,
		.end	= 0xfffe4390,
		.flags	= IORESOURCE_MEM,
	},
	[1] = {
		.start	= 116,
		.flags	= IORESOURCE_IRQ,
	},
};

static struct platform_device mtu2_1_device = {
	.name		= "sh_mtu2",
	.id		= 1,
	.dev = {
		.platform_data	= &mtu2_1_platform_data,
	},
	.resource	= mtu2_1_resources,
	.num_resources	= ARRAY_SIZE(mtu2_1_resources),
};

static struct sh_timer_config mtu2_2_platform_data = {
	.channel_offset = 0x80,
	.timer_bit = 2,
	.clockevent_rating = 200,
};

static struct resource mtu2_2_resources[] = {
	[0] = {
		.start	= 0xfffe4000,
		.end	= 0xfffe400a,
		.flags	= IORESOURCE_MEM,
	},
	[1] = {
		.start	= 124,
		.flags	= IORESOURCE_IRQ,
	},
};

static struct platform_device mtu2_2_device = {
	.name		= "sh_mtu2",
	.id		= 2,
	.dev = {
		.platform_data	= &mtu2_2_platform_data,
	},
	.resource	= mtu2_2_resources,
	.num_resources	= ARRAY_SIZE(mtu2_2_resources),
static struct platform_device mtu2_device = {
	.name		= "sh-mtu2",
	.id		= -1,
	.resource	= mtu2_resources,
	.num_resources	= ARRAY_SIZE(mtu2_resources),
};

static struct platform_device *sh7201_devices[] __initdata = {
@@ -459,9 +389,7 @@ static struct platform_device *sh7201_devices[] __initdata = {
	&scif6_device,
	&scif7_device,
	&rtc_device,
	&mtu2_0_device,
	&mtu2_1_device,
	&mtu2_2_device,
	&mtu2_device,
};

static int __init sh7201_devices_setup(void)
@@ -485,9 +413,7 @@ static struct platform_device *sh7201_early_devices[] __initdata = {
	&scif5_device,
	&scif6_device,
	&scif7_device,
	&mtu2_0_device,
	&mtu2_1_device,
	&mtu2_2_device,
	&mtu2_device,
};

#define STBCR3 0xfffe0408
Loading