Linux Audio

Check our new training course

Loading...
v4.6
 
  1/*
  2 * arch/sh/boards/landisk/setup.c
  3 *
  4 * I-O DATA Device, Inc. LANDISK Support.
  5 *
  6 * Copyright (C) 2000 Kazumoto Kojima
  7 * Copyright (C) 2002 Paul Mundt
  8 * Copylight (C) 2002 Atom Create Engineering Co., Ltd.
  9 * Copyright (C) 2005-2007 kogiidena
 10 *
 11 * This file is subject to the terms and conditions of the GNU General Public
 12 * License.  See the file "COPYING" in the main directory of this archive
 13 * for more details.
 14 */
 15#include <linux/init.h>
 16#include <linux/platform_device.h>
 17#include <linux/ata_platform.h>
 18#include <linux/pm.h>
 19#include <linux/mm.h>
 20#include <asm/machvec.h>
 21#include <mach-landisk/mach/iodata_landisk.h>
 22#include <asm/io.h>
 23
 24static void landisk_power_off(void)
 25{
 26	__raw_writeb(0x01, PA_SHUTDOWN);
 27}
 28
 29static struct resource cf_ide_resources[3];
 30
 31static struct pata_platform_info pata_info = {
 32	.ioport_shift	= 1,
 33};
 34
 35static struct platform_device cf_ide_device = {
 36	.name		= "pata_platform",
 37	.id		= -1,
 38	.num_resources	= ARRAY_SIZE(cf_ide_resources),
 39	.resource	= cf_ide_resources,
 40	.dev		= {
 41		.platform_data = &pata_info,
 42	},
 43};
 44
 45static struct platform_device rtc_device = {
 46	.name		= "rs5c313",
 47	.id		= -1,
 48};
 49
 50static struct platform_device *landisk_devices[] __initdata = {
 51	&cf_ide_device,
 52	&rtc_device,
 53};
 54
 55static int __init landisk_devices_setup(void)
 56{
 57	pgprot_t prot;
 58	unsigned long paddrbase;
 59	void *cf_ide_base;
 60
 61	/* open I/O area window */
 62	paddrbase = virt_to_phys((void *)PA_AREA5_IO);
 63	prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16);
 64	cf_ide_base = ioremap_prot(paddrbase, PAGE_SIZE, pgprot_val(prot));
 65	if (!cf_ide_base) {
 66		printk("allocate_cf_area : can't open CF I/O window!\n");
 67		return -ENOMEM;
 68	}
 69
 70	/* IDE cmd address : 0x1f0-0x1f7 and 0x3f6 */
 71	cf_ide_resources[0].start = (unsigned long)cf_ide_base + 0x40;
 72	cf_ide_resources[0].end   = (unsigned long)cf_ide_base + 0x40 + 0x0f;
 73	cf_ide_resources[0].flags = IORESOURCE_IO;
 74	cf_ide_resources[1].start = (unsigned long)cf_ide_base + 0x2c;
 75	cf_ide_resources[1].end   = (unsigned long)cf_ide_base + 0x2c + 0x03;
 76	cf_ide_resources[1].flags = IORESOURCE_IO;
 77	cf_ide_resources[2].start = IRQ_FATA;
 78	cf_ide_resources[2].flags = IORESOURCE_IRQ;
 79
 80	return platform_add_devices(landisk_devices,
 81				    ARRAY_SIZE(landisk_devices));
 82}
 83
 84device_initcall(landisk_devices_setup);
 85
 86static void __init landisk_setup(char **cmdline_p)
 87{
 
 
 
 88	/* LED ON */
 89	__raw_writeb(__raw_readb(PA_LED) | 0x03, PA_LED);
 90
 91	printk(KERN_INFO "I-O DATA DEVICE, INC. \"LANDISK Series\" support.\n");
 92	pm_power_off = landisk_power_off;
 93}
 94
 95/*
 96 * The Machine Vector
 97 */
 98static struct sh_machine_vector mv_landisk __initmv = {
 99	.mv_name = "LANDISK",
100	.mv_setup = landisk_setup,
101	.mv_init_irq = init_landisk_IRQ,
102};
v6.13.7
  1// SPDX-License-Identifier: GPL-2.0
  2/*
  3 * arch/sh/boards/landisk/setup.c
  4 *
  5 * I-O DATA Device, Inc. LANDISK Support.
  6 *
  7 * Copyright (C) 2000 Kazumoto Kojima
  8 * Copyright (C) 2002 Paul Mundt
  9 * Copylight (C) 2002 Atom Create Engineering Co., Ltd.
 10 * Copyright (C) 2005-2007 kogiidena
 
 
 
 
 11 */
 12#include <linux/init.h>
 13#include <linux/platform_device.h>
 14#include <linux/ata_platform.h>
 15#include <linux/pm.h>
 16#include <linux/mm.h>
 17#include <asm/machvec.h>
 18#include <mach-landisk/mach/iodata_landisk.h>
 19#include <asm/io.h>
 20
 21static void landisk_power_off(void)
 22{
 23	__raw_writeb(0x01, PA_SHUTDOWN);
 24}
 25
 26static struct resource cf_ide_resources[3];
 27
 28static struct pata_platform_info pata_info = {
 29	.ioport_shift	= 1,
 30};
 31
 32static struct platform_device cf_ide_device = {
 33	.name		= "pata_platform",
 34	.id		= -1,
 35	.num_resources	= ARRAY_SIZE(cf_ide_resources),
 36	.resource	= cf_ide_resources,
 37	.dev		= {
 38		.platform_data = &pata_info,
 39	},
 40};
 41
 42static struct platform_device rtc_device = {
 43	.name		= "rs5c313",
 44	.id		= -1,
 45};
 46
 47static struct platform_device *landisk_devices[] __initdata = {
 48	&cf_ide_device,
 49	&rtc_device,
 50};
 51
 52static int __init landisk_devices_setup(void)
 53{
 54	pgprot_t prot;
 55	unsigned long paddrbase;
 56	void *cf_ide_base;
 57
 58	/* open I/O area window */
 59	paddrbase = virt_to_phys((void *)PA_AREA5_IO);
 60	prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16);
 61	cf_ide_base = ioremap_prot(paddrbase, PAGE_SIZE, pgprot_val(prot));
 62	if (!cf_ide_base) {
 63		printk("allocate_cf_area : can't open CF I/O window!\n");
 64		return -ENOMEM;
 65	}
 66
 67	/* IDE cmd address : 0x1f0-0x1f7 and 0x3f6 */
 68	cf_ide_resources[0].start = (unsigned long)cf_ide_base + 0x40;
 69	cf_ide_resources[0].end   = (unsigned long)cf_ide_base + 0x40 + 0x0f;
 70	cf_ide_resources[0].flags = IORESOURCE_IO;
 71	cf_ide_resources[1].start = (unsigned long)cf_ide_base + 0x2c;
 72	cf_ide_resources[1].end   = (unsigned long)cf_ide_base + 0x2c + 0x03;
 73	cf_ide_resources[1].flags = IORESOURCE_IO;
 74	cf_ide_resources[2].start = IRQ_FATA;
 75	cf_ide_resources[2].flags = IORESOURCE_IRQ;
 76
 77	return platform_add_devices(landisk_devices,
 78				    ARRAY_SIZE(landisk_devices));
 79}
 80
 81device_initcall(landisk_devices_setup);
 82
 83static void __init landisk_setup(char **cmdline_p)
 84{
 85	/* I/O port identity mapping */
 86	__set_io_port_base(0);
 87
 88	/* LED ON */
 89	__raw_writeb(__raw_readb(PA_LED) | 0x03, PA_LED);
 90
 91	printk(KERN_INFO "I-O DATA DEVICE, INC. \"LANDISK Series\" support.\n");
 92	pm_power_off = landisk_power_off;
 93}
 94
 95/*
 96 * The Machine Vector
 97 */
 98static struct sh_machine_vector mv_landisk __initmv = {
 99	.mv_name = "LANDISK",
100	.mv_setup = landisk_setup,
101	.mv_init_irq = init_landisk_IRQ,
102};