Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
489e068e
Commit
489e068e
authored
Jun 19, 2003
by
Russell King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ARM] Add AMBA bus type for ARM PrimeCells on Integrator.
parent
f0e8fffb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
293 additions
and
0 deletions
+293
-0
arch/arm/Kconfig
arch/arm/Kconfig
+5
-0
arch/arm/common/Makefile
arch/arm/common/Makefile
+1
-0
arch/arm/common/amba.c
arch/arm/common/amba.c
+243
-0
include/asm-arm/hardware/amba.h
include/asm-arm/hardware/amba.h
+44
-0
No files found.
arch/arm/Kconfig
View file @
489e068e
...
...
@@ -488,6 +488,11 @@ config ICST525
depends on ARCH_INTEGRATOR
default y
config ARM_AMBA
bool
depends on ARCH_INTEGRATOR
default y
config ISA
bool
depends on FOOTBRIDGE_HOST || ARCH_SHARK || ARCH_CLPS7500 || ARCH_EBSA110 || ARCH_CDB89712 || ARCH_EDB7211 || ARCH_SA1100
...
...
arch/arm/common/Makefile
View file @
489e068e
...
...
@@ -3,6 +3,7 @@
#
obj-y
+=
platform.o
obj-$(CONFIG_ARM_AMBA)
+=
amba.o
obj-$(CONFIG_ICST525)
+=
icst525.o
obj-$(CONFIG_SA1111)
+=
sa1111.o sa1111-pcibuf.o sa1111-pcipool.o
obj-$(CONFIG_PCI_HOST_PLX90X0)
+=
plx90x0.o
...
...
arch/arm/common/amba.c
0 → 100644
View file @
489e068e
/*
* linux/arch/arm/common/amba.c
*
* Copyright (C) 2003 Deep Blue Solutions Ltd, All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/device.h>
#include <asm/io.h>
#include <asm/hardware/amba.h>
#include <asm/sizes.h>
#define to_amba_device(d) container_of(d, struct amba_device, dev)
#define to_amba_driver(d) container_of(d, struct amba_driver, drv)
static
struct
amba_id
*
amba_lookup
(
struct
amba_id
*
table
,
struct
amba_device
*
dev
)
{
int
ret
=
0
;
while
(
table
->
mask
)
{
ret
=
(
dev
->
periphid
&
table
->
mask
)
==
table
->
id
;
if
(
ret
)
break
;
table
++
;
}
return
ret
?
table
:
NULL
;
}
static
int
amba_match
(
struct
device
*
dev
,
struct
device_driver
*
drv
)
{
struct
amba_device
*
pcdev
=
to_amba_device
(
dev
);
struct
amba_driver
*
pcdrv
=
to_amba_driver
(
drv
);
return
amba_lookup
(
pcdrv
->
id_table
,
pcdev
)
!=
NULL
;
}
/*
* Primecells are part of the Advanced Microcontroller Bus Architecture,
* so we call the bus "amba".
*/
struct
bus_type
amba_bustype
=
{
.
name
=
"amba"
,
.
match
=
amba_match
,
};
static
int
__init
amba_init
(
void
)
{
return
bus_register
(
&
amba_bustype
);
}
postcore_initcall
(
amba_init
);
/*
* These are the device model conversion veneers; they convert the
* device model structures to our more specific structures.
*/
static
int
amba_probe
(
struct
device
*
dev
)
{
struct
amba_device
*
pcdev
=
to_amba_device
(
dev
);
struct
amba_driver
*
pcdrv
=
to_amba_driver
(
dev
->
driver
);
struct
amba_id
*
id
;
id
=
amba_lookup
(
pcdrv
->
id_table
,
pcdev
);
return
pcdrv
->
probe
(
pcdev
,
id
);
}
static
int
amba_remove
(
struct
device
*
dev
)
{
struct
amba_driver
*
drv
=
to_amba_driver
(
dev
->
driver
);
return
drv
->
remove
(
to_amba_device
(
dev
));
}
static
void
amba_shutdown
(
struct
device
*
dev
)
{
struct
amba_driver
*
drv
=
to_amba_driver
(
dev
->
driver
);
drv
->
shutdown
(
to_amba_device
(
dev
));
}
static
int
amba_suspend
(
struct
device
*
dev
,
u32
state
,
u32
level
)
{
struct
amba_driver
*
drv
=
to_amba_driver
(
dev
->
driver
);
return
drv
->
suspend
(
to_amba_device
(
dev
),
state
,
level
);
}
static
int
amba_resume
(
struct
device
*
dev
,
u32
level
)
{
struct
amba_driver
*
drv
=
to_amba_driver
(
dev
->
driver
);
return
drv
->
resume
(
to_amba_device
(
dev
),
level
);
}
/**
* amba_driver_register - register an AMBA device driver
* @drv: amba device driver structure
*
* Register an AMBA device driver with the Linux device model
* core. If devices pre-exist, the drivers probe function will
* be called.
*/
int
amba_driver_register
(
struct
amba_driver
*
drv
)
{
drv
->
drv
.
bus
=
&
amba_bustype
;
#define SETFN(fn) if (drv->fn) drv->drv.fn = amba_##fn
SETFN
(
probe
);
SETFN
(
remove
);
SETFN
(
shutdown
);
SETFN
(
suspend
);
SETFN
(
resume
);
return
driver_register
(
&
drv
->
drv
);
}
/**
* amba_driver_unregister - remove an AMBA device driver
* @drv: AMBA device driver structure to remove
*
* Unregister an AMBA device driver from the Linux device
* model. The device model will call the drivers remove function
* for each device the device driver is currently handling.
*/
void
amba_driver_unregister
(
struct
amba_driver
*
drv
)
{
driver_unregister
(
&
drv
->
drv
);
}
static
void
amba_device_release
(
struct
device
*
dev
)
{
struct
amba_device
*
d
=
to_amba_device
(
dev
);
if
(
d
->
res
.
parent
)
release_resource
(
&
d
->
res
);
kfree
(
d
);
}
static
ssize_t
show_id
(
struct
device
*
_dev
,
char
*
buf
)
{
struct
amba_device
*
dev
=
to_amba_device
(
_dev
);
return
sprintf
(
buf
,
"%08x
\n
"
,
dev
->
periphid
);
}
static
DEVICE_ATTR
(
id
,
S_IRUGO
,
show_id
,
NULL
);
static
ssize_t
show_irq
(
struct
device
*
_dev
,
char
*
buf
)
{
struct
amba_device
*
dev
=
to_amba_device
(
_dev
);
return
sprintf
(
buf
,
"%u
\n
"
,
dev
->
irq
);
}
static
DEVICE_ATTR
(
irq
,
S_IRUGO
,
show_irq
,
NULL
);
static
ssize_t
show_res
(
struct
device
*
_dev
,
char
*
buf
)
{
struct
amba_device
*
dev
=
to_amba_device
(
_dev
);
return
sprintf
(
buf
,
"
\t
%08lx
\t
%08lx
\t
%08lx
\n
"
,
dev
->
res
.
start
,
dev
->
res
.
end
,
dev
->
res
.
flags
);
}
static
DEVICE_ATTR
(
resource
,
S_IRUGO
,
show_res
,
NULL
);
/**
* amba_device_register - register an AMBA device
* @dev: AMBA device to register
* @parent: parent memory resource
*
* Setup the AMBA device, reading the cell ID if present.
* Claim the resource, and register the AMBA device with
* the Linux device manager.
*/
int
amba_device_register
(
struct
amba_device
*
dev
,
struct
resource
*
parent
)
{
u32
pid
,
cid
;
void
*
tmp
;
int
i
,
ret
;
dev
->
dev
.
release
=
amba_device_release
;
dev
->
dev
.
bus
=
&
amba_bustype
;
dev
->
res
.
name
=
dev
->
dev
.
name
;
ret
=
request_resource
(
parent
,
&
dev
->
res
);
if
(
ret
==
0
)
{
tmp
=
ioremap
(
dev
->
res
.
start
,
SZ_4K
);
if
(
!
tmp
)
{
ret
=
-
ENOMEM
;
goto
out
;
}
for
(
pid
=
0
,
i
=
0
;
i
<
4
;
i
++
)
pid
|=
(
readl
(
tmp
+
0xfe0
+
4
*
i
)
&
255
)
<<
(
i
*
8
);
for
(
cid
=
0
,
i
=
0
;
i
<
4
;
i
++
)
cid
|=
(
readl
(
tmp
+
0xff0
+
4
*
i
)
&
255
)
<<
(
i
*
8
);
iounmap
(
tmp
);
if
(
cid
==
0xb105f00d
)
dev
->
periphid
=
pid
;
if
(
dev
->
periphid
)
snprintf
(
dev
->
dev
.
name
,
sizeof
(
dev
->
dev
.
name
),
"AMBA PL%03X"
,
dev
->
periphid
&
0xfff
);
else
strlcpy
(
dev
->
dev
.
name
,
"AMBA unknown"
,
sizeof
(
dev
->
dev
.
name
));
ret
=
device_register
(
&
dev
->
dev
);
if
(
ret
==
0
)
{
device_create_file
(
&
dev
->
dev
,
&
dev_attr_id
);
device_create_file
(
&
dev
->
dev
,
&
dev_attr_irq
);
device_create_file
(
&
dev
->
dev
,
&
dev_attr_resource
);
}
else
{
out:
release_resource
(
&
dev
->
res
);
}
}
return
ret
;
}
/**
* amba_device_unregister - unregister an AMBA device
* @dev: AMBA device to remove
*
* Remove the specified AMBA device from the Linux device
* manager. All files associated with this object will be
* destroyed, and device drivers notified that the device has
* been removed. The AMBA device's resources including
* the amba_device structure will be freed once all
* references to it have been dropped.
*/
void
amba_device_unregister
(
struct
amba_device
*
dev
)
{
device_unregister
(
&
dev
->
dev
);
}
EXPORT_SYMBOL
(
amba_driver_register
);
EXPORT_SYMBOL
(
amba_driver_unregister
);
EXPORT_SYMBOL
(
amba_device_register
);
EXPORT_SYMBOL
(
amba_device_unregister
);
include/asm-arm/hardware/amba.h
0 → 100644
View file @
489e068e
/*
* linux/include/asm-arm/hardware/amba.h
*
* Copyright (C) 2003 Deep Blue Solutions Ltd, All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef ASMARM_AMBA_H
#define ASMARM_AMBA_H
struct
amba_device
{
struct
device
dev
;
struct
resource
res
;
unsigned
int
irq
;
unsigned
int
periphid
;
};
struct
amba_id
{
unsigned
int
id
;
unsigned
int
mask
;
void
*
data
;
};
struct
amba_driver
{
struct
device_driver
drv
;
int
(
*
probe
)(
struct
amba_device
*
,
void
*
);
int
(
*
remove
)(
struct
amba_device
*
);
void
(
*
shutdown
)(
struct
amba_device
*
);
int
(
*
suspend
)(
struct
amba_device
*
,
u32
,
u32
);
int
(
*
resume
)(
struct
amba_device
*
,
u32
);
struct
amba_id
*
id_table
;
};
#define amba_get_drvdata(d) dev_get_drvdata(&d->dev)
#define amba_set_drvdata(d,p) dev_set_drvdata(&d->dev, p)
int
amba_driver_register
(
struct
amba_driver
*
);
void
amba_driver_unregister
(
struct
amba_driver
*
);
int
amba_device_register
(
struct
amba_device
*
,
struct
resource
*
);
void
amba_device_unregister
(
struct
amba_device
*
);
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment