Linux Audio

Check our new training course

Loading...
v5.4
  1// SPDX-License-Identifier: GPL-2.0
  2/*
  3 * SH5-101/SH5-103 CPU Setup
  4 *
  5 *  Copyright (C) 2009  Paul Mundt
 
 
 
 
  6 */
  7#include <linux/platform_device.h>
  8#include <linux/init.h>
  9#include <linux/serial.h>
 10#include <linux/serial_sci.h>
 11#include <linux/io.h>
 12#include <linux/mm.h>
 13#include <linux/sh_timer.h>
 14#include <asm/addrspace.h>
 15
 16static struct plat_sci_port scif0_platform_data = {
 17	.flags		= UPF_IOREMAP,
 18	.scscr		= SCSCR_REIE,
 19	.type		= PORT_SCIF,
 20};
 21
 22static struct resource scif0_resources[] = {
 23	DEFINE_RES_MEM(PHYS_PERIPHERAL_BLOCK + 0x01030000, 0x100),
 24	DEFINE_RES_IRQ(39),
 25	DEFINE_RES_IRQ(40),
 26	DEFINE_RES_IRQ(42),
 27};
 28
 29static struct platform_device scif0_device = {
 30	.name		= "sh-sci",
 31	.id		= 0,
 32	.resource	= scif0_resources,
 33	.num_resources	= ARRAY_SIZE(scif0_resources),
 34	.dev		= {
 35		.platform_data	= &scif0_platform_data,
 36	},
 37};
 38
 39static struct resource rtc_resources[] = {
 40	[0] = {
 41		.start	= PHYS_PERIPHERAL_BLOCK + 0x01040000,
 42		.end	= PHYS_PERIPHERAL_BLOCK + 0x01040000 + 0x58 - 1,
 43		.flags	= IORESOURCE_IO,
 44	},
 45	[1] = {
 46		/* Period IRQ */
 47		.start	= IRQ_PRI,
 48		.flags	= IORESOURCE_IRQ,
 49	},
 50	[2] = {
 51		/* Carry IRQ */
 52		.start	= IRQ_CUI,
 53		.flags	= IORESOURCE_IRQ,
 54	},
 55	[3] = {
 56		/* Alarm IRQ */
 57		.start	= IRQ_ATI,
 58		.flags	= IORESOURCE_IRQ,
 59	},
 60};
 61
 62static struct platform_device rtc_device = {
 63	.name		= "sh-rtc",
 64	.id		= -1,
 65	.num_resources	= ARRAY_SIZE(rtc_resources),
 66	.resource	= rtc_resources,
 67};
 68
 69#define	TMU_BLOCK_OFF	0x01020000
 70#define TMU_BASE	PHYS_PERIPHERAL_BLOCK + TMU_BLOCK_OFF
 71
 72static struct sh_timer_config tmu0_platform_data = {
 73	.channels_mask = 7,
 74};
 75
 76static struct resource tmu0_resources[] = {
 77	DEFINE_RES_MEM(TMU_BASE, 0x30),
 78	DEFINE_RES_IRQ(IRQ_TUNI0),
 79	DEFINE_RES_IRQ(IRQ_TUNI1),
 80	DEFINE_RES_IRQ(IRQ_TUNI2),
 81};
 82
 83static struct platform_device tmu0_device = {
 84	.name		= "sh-tmu",
 85	.id		= 0,
 86	.dev = {
 87		.platform_data	= &tmu0_platform_data,
 88	},
 89	.resource	= tmu0_resources,
 90	.num_resources	= ARRAY_SIZE(tmu0_resources),
 91};
 92
 93static struct platform_device *sh5_early_devices[] __initdata = {
 94	&scif0_device,
 95	&tmu0_device,
 96};
 97
 98static struct platform_device *sh5_devices[] __initdata = {
 99	&rtc_device,
100};
101
102static int __init sh5_devices_setup(void)
103{
104	int ret;
105
106	ret = platform_add_devices(sh5_early_devices,
107				   ARRAY_SIZE(sh5_early_devices));
108	if (unlikely(ret != 0))
109		return ret;
110
111	return platform_add_devices(sh5_devices,
112				    ARRAY_SIZE(sh5_devices));
113}
114arch_initcall(sh5_devices_setup);
115
116void __init plat_early_device_setup(void)
117{
118	early_platform_add_devices(sh5_early_devices,
119				   ARRAY_SIZE(sh5_early_devices));
120}
v4.17
 
  1/*
  2 * SH5-101/SH5-103 CPU Setup
  3 *
  4 *  Copyright (C) 2009  Paul Mundt
  5 *
  6 * This file is subject to the terms and conditions of the GNU General Public
  7 * License.  See the file "COPYING" in the main directory of this archive
  8 * for more details.
  9 */
 10#include <linux/platform_device.h>
 11#include <linux/init.h>
 12#include <linux/serial.h>
 13#include <linux/serial_sci.h>
 14#include <linux/io.h>
 15#include <linux/mm.h>
 16#include <linux/sh_timer.h>
 17#include <asm/addrspace.h>
 18
 19static struct plat_sci_port scif0_platform_data = {
 20	.flags		= UPF_IOREMAP,
 21	.scscr		= SCSCR_REIE,
 22	.type		= PORT_SCIF,
 23};
 24
 25static struct resource scif0_resources[] = {
 26	DEFINE_RES_MEM(PHYS_PERIPHERAL_BLOCK + 0x01030000, 0x100),
 27	DEFINE_RES_IRQ(39),
 28	DEFINE_RES_IRQ(40),
 29	DEFINE_RES_IRQ(42),
 30};
 31
 32static struct platform_device scif0_device = {
 33	.name		= "sh-sci",
 34	.id		= 0,
 35	.resource	= scif0_resources,
 36	.num_resources	= ARRAY_SIZE(scif0_resources),
 37	.dev		= {
 38		.platform_data	= &scif0_platform_data,
 39	},
 40};
 41
 42static struct resource rtc_resources[] = {
 43	[0] = {
 44		.start	= PHYS_PERIPHERAL_BLOCK + 0x01040000,
 45		.end	= PHYS_PERIPHERAL_BLOCK + 0x01040000 + 0x58 - 1,
 46		.flags	= IORESOURCE_IO,
 47	},
 48	[1] = {
 49		/* Period IRQ */
 50		.start	= IRQ_PRI,
 51		.flags	= IORESOURCE_IRQ,
 52	},
 53	[2] = {
 54		/* Carry IRQ */
 55		.start	= IRQ_CUI,
 56		.flags	= IORESOURCE_IRQ,
 57	},
 58	[3] = {
 59		/* Alarm IRQ */
 60		.start	= IRQ_ATI,
 61		.flags	= IORESOURCE_IRQ,
 62	},
 63};
 64
 65static struct platform_device rtc_device = {
 66	.name		= "sh-rtc",
 67	.id		= -1,
 68	.num_resources	= ARRAY_SIZE(rtc_resources),
 69	.resource	= rtc_resources,
 70};
 71
 72#define	TMU_BLOCK_OFF	0x01020000
 73#define TMU_BASE	PHYS_PERIPHERAL_BLOCK + TMU_BLOCK_OFF
 74
 75static struct sh_timer_config tmu0_platform_data = {
 76	.channels_mask = 7,
 77};
 78
 79static struct resource tmu0_resources[] = {
 80	DEFINE_RES_MEM(TMU_BASE, 0x30),
 81	DEFINE_RES_IRQ(IRQ_TUNI0),
 82	DEFINE_RES_IRQ(IRQ_TUNI1),
 83	DEFINE_RES_IRQ(IRQ_TUNI2),
 84};
 85
 86static struct platform_device tmu0_device = {
 87	.name		= "sh-tmu",
 88	.id		= 0,
 89	.dev = {
 90		.platform_data	= &tmu0_platform_data,
 91	},
 92	.resource	= tmu0_resources,
 93	.num_resources	= ARRAY_SIZE(tmu0_resources),
 94};
 95
 96static struct platform_device *sh5_early_devices[] __initdata = {
 97	&scif0_device,
 98	&tmu0_device,
 99};
100
101static struct platform_device *sh5_devices[] __initdata = {
102	&rtc_device,
103};
104
105static int __init sh5_devices_setup(void)
106{
107	int ret;
108
109	ret = platform_add_devices(sh5_early_devices,
110				   ARRAY_SIZE(sh5_early_devices));
111	if (unlikely(ret != 0))
112		return ret;
113
114	return platform_add_devices(sh5_devices,
115				    ARRAY_SIZE(sh5_devices));
116}
117arch_initcall(sh5_devices_setup);
118
119void __init plat_early_device_setup(void)
120{
121	early_platform_add_devices(sh5_early_devices,
122				   ARRAY_SIZE(sh5_early_devices));
123}