Linux Audio

Check our new training course

Loading...
v3.15
 1/*
 2 * Renesas Technology Europe RSK+ Support.
 3 *
 4 * Copyright (C) 2008 Paul Mundt
 5 * Copyright (C) 2008 Peter Griffin <pgriffin@mpc-data.co.uk>
 6 *
 7 * This file is subject to the terms and conditions of the GNU General Public
 8 * License.  See the file "COPYING" in the main directory of this archive
 9 * for more details.
10 */
11#include <linux/init.h>
12#include <linux/types.h>
13#include <linux/platform_device.h>
14#include <linux/interrupt.h>
15#include <linux/mtd/mtd.h>
16#include <linux/mtd/partitions.h>
17#include <linux/mtd/physmap.h>
 
18#include <linux/mtd/map.h>
19#include <linux/regulator/fixed.h>
20#include <linux/regulator/machine.h>
21#include <asm/machvec.h>
22#include <asm/io.h>
23
24/* Dummy supplies, where voltage doesn't matter */
25static struct regulator_consumer_supply dummy_supplies[] = {
26	REGULATOR_SUPPLY("vddvario", "smsc911x"),
27	REGULATOR_SUPPLY("vdd33a", "smsc911x"),
28};
29
30static const char *part_probes[] = { "cmdlinepart", NULL };
31
32static struct mtd_partition rsk_partitions[] = {
33	{
34		.name		= "Bootloader",
35		.offset		= 0x00000000,
36		.size		= 0x00040000,
37		.mask_flags	= MTD_WRITEABLE,
38	}, {
39		.name		= "Kernel",
40		.offset		= MTDPART_OFS_NXTBLK,
41		.size		= 0x001c0000,
42	}, {
43		.name		= "Flash_FS",
44		.offset		= MTDPART_OFS_NXTBLK,
45		.size		= MTDPART_SIZ_FULL,
46	}
47};
48
49static struct physmap_flash_data flash_data = {
50	.parts			= rsk_partitions,
51	.nr_parts		= ARRAY_SIZE(rsk_partitions),
52	.width			= 2,
53	.part_probe_types	= part_probes,
54};
55
56static struct resource flash_resource = {
57	.start		= 0x20000000,
58	.end		= 0x20400000,
59	.flags		= IORESOURCE_MEM,
60};
61
62static struct platform_device flash_device = {
63	.name		= "physmap-flash",
64	.id		= -1,
65	.resource	= &flash_resource,
66	.num_resources	= 1,
67	.dev		= {
68		.platform_data = &flash_data,
69	},
70};
71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72static struct platform_device *rsk_devices[] __initdata = {
73	&flash_device,
74};
75
76static int __init rsk_devices_setup(void)
77{
78	regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
79
80	return platform_add_devices(rsk_devices,
81				    ARRAY_SIZE(rsk_devices));
82}
83device_initcall(rsk_devices_setup);
84
85/*
86 * The Machine Vector
87 */
88static struct sh_machine_vector mv_rsk __initmv = {
89	.mv_name        = "RSK+",
90};
v3.1
  1/*
  2 * Renesas Technology Europe RSK+ Support.
  3 *
  4 * Copyright (C) 2008 Paul Mundt
  5 * Copyright (C) 2008 Peter Griffin <pgriffin@mpc-data.co.uk>
  6 *
  7 * This file is subject to the terms and conditions of the GNU General Public
  8 * License.  See the file "COPYING" in the main directory of this archive
  9 * for more details.
 10 */
 11#include <linux/init.h>
 12#include <linux/types.h>
 13#include <linux/platform_device.h>
 14#include <linux/interrupt.h>
 15#include <linux/mtd/mtd.h>
 16#include <linux/mtd/partitions.h>
 17#include <linux/mtd/physmap.h>
 18#ifdef CONFIG_MTD
 19#include <linux/mtd/map.h>
 20#endif
 
 21#include <asm/machvec.h>
 22#include <asm/io.h>
 23
 
 
 
 
 
 
 
 
 24static struct mtd_partition rsk_partitions[] = {
 25	{
 26		.name		= "Bootloader",
 27		.offset		= 0x00000000,
 28		.size		= 0x00040000,
 29		.mask_flags	= MTD_WRITEABLE,
 30	}, {
 31		.name		= "Kernel",
 32		.offset		= MTDPART_OFS_NXTBLK,
 33		.size		= 0x001c0000,
 34	}, {
 35		.name		= "Flash_FS",
 36		.offset		= MTDPART_OFS_NXTBLK,
 37		.size		= MTDPART_SIZ_FULL,
 38	}
 39};
 40
 41static struct physmap_flash_data flash_data = {
 42	.parts		= rsk_partitions,
 43	.nr_parts	= ARRAY_SIZE(rsk_partitions),
 44	.width		= 2,
 
 45};
 46
 47static struct resource flash_resource = {
 48	.start		= 0x20000000,
 49	.end		= 0x20400000,
 50	.flags		= IORESOURCE_MEM,
 51};
 52
 53static struct platform_device flash_device = {
 54	.name		= "physmap-flash",
 55	.id		= -1,
 56	.resource	= &flash_resource,
 57	.num_resources	= 1,
 58	.dev		= {
 59		.platform_data = &flash_data,
 60	},
 61};
 62
 63#ifdef CONFIG_MTD
 64static const char *probes[] = { "cmdlinepart", NULL };
 65
 66static struct map_info rsk_flash_map = {
 67	.name		= "RSK+ Flash",
 68	.size		= 0x400000,
 69	.bankwidth	= 2,
 70};
 71
 72static struct mtd_info *flash_mtd;
 73
 74static struct mtd_partition *parsed_partitions;
 75
 76static void __init set_mtd_partitions(void)
 77{
 78	int nr_parts = 0;
 79
 80	simple_map_init(&rsk_flash_map);
 81	flash_mtd = do_map_probe("cfi_probe", &rsk_flash_map);
 82	nr_parts = parse_mtd_partitions(flash_mtd, probes,
 83					&parsed_partitions, 0);
 84	/* If there is no partition table, used the hard coded table */
 85	if (nr_parts > 0) {
 86		flash_data.nr_parts = nr_parts;
 87		flash_data.parts = parsed_partitions;
 88	}
 89}
 90#else
 91static inline void set_mtd_partitions(void) {}
 92#endif
 93
 94static struct platform_device *rsk_devices[] __initdata = {
 95	&flash_device,
 96};
 97
 98static int __init rsk_devices_setup(void)
 99{
100	set_mtd_partitions();
 
101	return platform_add_devices(rsk_devices,
102				    ARRAY_SIZE(rsk_devices));
103}
104device_initcall(rsk_devices_setup);
105
106/*
107 * The Machine Vector
108 */
109static struct sh_machine_vector mv_rsk __initmv = {
110	.mv_name        = "RSK+",
111};