Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
3d97776
Documentation
arch
block
crypto
drivers
accessibility
acpi
amba
ata
atm
auxdisplay
base
block
bluetooth
cdrom
char
clocksource
connector
cpufreq
cpuidle
crypto
dca
dio
dma
edac
eisa
firewire
firmware
gpio
gpu
hid
hwmon
i2c
ide
arm
h8300
legacy
mips
Makefile
au1xxx-ide.c
swarm.c
pci
ppc
Kconfig
Makefile
ide-acpi.c
ide-atapi.c
ide-cd.c
ide-cd.h
ide-cd_ioctl.c
ide-cd_verbose.c
ide-disk.c
ide-dma.c
ide-floppy.c
ide-generic.c
ide-io.c
ide-iops.c
ide-lib.c
ide-pio-blacklist.c
ide-pnp.c
ide-probe.c
ide-proc.c
ide-scan-pci.c
ide-tape.c
ide-taskfile.c
ide-timings.c
ide.c
setup-pci.c
ieee1394
infiniband
input
isdn
leds
lguest
macintosh
mca
md
media
memstick
message
mfd
misc
mmc
mtd
net
nubus
of
oprofile
parisc
parport
pci
pcmcia
pnp
power
ps3
rapidio
regulator
rtc
s390
sbus
scsi
serial
sh
sn
spi
ssb
tc
telephony
thermal
uio
usb
video
virtio
w1
watchdog
xen
zorro
Kconfig
Makefile
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
usr
virt
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
MAINTAINERS
Makefile
README
REPORTING-BUGS
Breadcrumbs
linux
/
drivers
/
ide
/
mips
/
swarm.c
Copy path
Blame
Blame
Latest commit
History
History
197 lines (161 loc) · 5.13 KB
Breadcrumbs
linux
/
drivers
/
ide
/
mips
/
swarm.c
Top
File metadata and controls
Code
Blame
197 lines (161 loc) · 5.13 KB
Raw
/* * Copyright (C) 2001, 2002, 2003 Broadcom Corporation * Copyright (C) 2004 MontaVista Software Inc. * Author: Manish Lachwani, mlachwani@mvista.com * Copyright (C) 2004 MIPS Technologies, Inc. All rights reserved. * Author: Maciej W. Rozycki <macro@mips.com> * Copyright (c) 2006, 2008 Maciej W. Rozycki * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* * Derived loosely from ide-pmac.c, so: * Copyright (C) 1998 Paul Mackerras. * Copyright (C) 1995-1998 Mark Lord */ /* * Boards with SiByte processors so far have supported IDE devices via * the Generic Bus, PCI bus, and built-in PCMCIA interface. In all * cases, byte-swapping must be avoided for these devices (whereas * other PCI devices, for example, will require swapping). Any * SiByte-targetted kernel including IDE support will include this * file. Probing of a Generic Bus for an IDE device is controlled by * the definition of "SIBYTE_HAVE_IDE", which is provided by * <asm/sibyte/board.h> for Broadcom boards. */ #include <linux/ide.h> #include <linux/ioport.h> #include <linux/kernel.h> #include <linux/types.h> #include <linux/platform_device.h> #include <asm/io.h> #include <asm/sibyte/board.h> #include <asm/sibyte/sb1250_genbus.h> #include <asm/sibyte/sb1250_regs.h> #define DRV_NAME "ide-swarm" static char swarm_ide_string[] = DRV_NAME; static struct resource swarm_ide_resource = { .name = "SWARM GenBus IDE", .flags = IORESOURCE_MEM, }; static struct platform_device *swarm_ide_dev; static const struct ide_port_info swarm_port_info = { .name = DRV_NAME, .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA, }; /* * swarm_ide_probe - if the board header indicates the existence of * Generic Bus IDE, allocate a HWIF for it. */ static int __devinit swarm_ide_probe(struct device *dev) { u8 __iomem *base; struct ide_host *host; phys_t offset, size; int i, rc; hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; if (!SIBYTE_HAVE_IDE) return -ENODEV; base = ioremap(A_IO_EXT_BASE, 0x800); offset = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_START_ADDR, IDE_CS)); size = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_MULT_SIZE, IDE_CS)); iounmap(base); offset = G_IO_START_ADDR(offset) << S_IO_ADDRBASE; size = (G_IO_MULT_SIZE(size) + 1) << S_IO_REGSIZE; if (offset < A_PHYS_GENBUS || offset >= A_PHYS_GENBUS_END) { printk(KERN_INFO DRV_NAME ": IDE interface at GenBus disabled\n"); return -EBUSY; } printk(KERN_INFO DRV_NAME ": IDE interface at GenBus slot %i\n", IDE_CS); swarm_ide_resource.start = offset; swarm_ide_resource.end = offset + size - 1; if (request_resource(&iomem_resource, &swarm_ide_resource)) { printk(KERN_ERR DRV_NAME ": can't request I/O memory resource\n"); return -EBUSY; } base = ioremap(offset, size); memset(&hw, 0, sizeof(hw)); for (i = 0; i <= 7; i++) hw.io_ports_array[i] = (unsigned long)(base + ((0x1f0 + i) << 5)); hw.io_ports.ctl_addr = (unsigned long)(base + (0x3f6 << 5)); hw.irq = K_INT_GB_IDE; hw.chipset = ide_generic; rc = ide_host_add(&swarm_port_info, hws, &host); if (rc) goto err; dev_set_drvdata(dev, host); return 0; err: release_resource(&swarm_ide_resource); iounmap(base); return rc; } static struct device_driver swarm_ide_driver = { .name = swarm_ide_string, .bus = &platform_bus_type, .probe = swarm_ide_probe, }; static void swarm_ide_platform_release(struct device *device) { struct platform_device *pldev; /* free device */ pldev = to_platform_device(device); kfree(pldev); } static int __devinit swarm_ide_init_module(void) { struct platform_device *pldev; int err; printk(KERN_INFO "SWARM IDE driver\n"); if (driver_register(&swarm_ide_driver)) { printk(KERN_ERR "Driver registration failed\n"); err = -ENODEV; goto out; } if (!(pldev = kzalloc(sizeof (*pldev), GFP_KERNEL))) { err = -ENOMEM; goto out_unregister_driver; } pldev->name = swarm_ide_string; pldev->id = 0; pldev->dev.release = swarm_ide_platform_release; if (platform_device_register(pldev)) { err = -ENODEV; goto out_free_pldev; } if (!pldev->dev.driver) { /* * The driver was not bound to this device, there was * no hardware at this address. Unregister it, as the * release fuction will take care of freeing the * allocated structure */ platform_device_unregister (pldev); } swarm_ide_dev = pldev; return 0; out_free_pldev: kfree(pldev); out_unregister_driver: driver_unregister(&swarm_ide_driver); out: return err; } module_init(swarm_ide_init_module);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
You can’t perform that action at this time.