* Re: Couldn't find reference for i2c_smbus functinos
From: Eugene Surovegin @ 2006-09-20 17:14 UTC (permalink / raw)
To: Sachin Rane; +Cc: linuxppc-embedded
In-Reply-To: <8584FDC94AFF7640B17B8A89B23B19B34F6576@sbsserver.AlphionCorp.local>
On Wed, Sep 20, 2006 at 11:07:52AM -0400, Sachin Rane wrote:
> Hi,
>
> Following text is from "/usr/local/linux/Doumentation/dev-interface":
> ----------------------------------------------------------------------------------------------------------------------------------
> You can do SMBus level transactions (see documentation file smbus-protocol
> for details) through the following functions:
> __s32 i2c_smbus_write_quick(int file, __u8 value);
> __s32 i2c_smbus_read_byte(int file);
> __s32 i2c_smbus_write_byte(int file, __u8 value);
> __s32 i2c_smbus_read_byte_data(int file, __u8 command);
> __s32 i2c_smbus_write_byte_data(int file, __u8 command, __u8 value);
> __s32 i2c_smbus_read_word_data(int file, __u8 command);
> __s32 i2c_smbus_write_word_data(int file, __u8 command, __u16 value);
> __s32 i2c_smbus_process_call(int file, __u8 command, __u16 value);
> __s32 i2c_smbus_read_block_data(int file, __u8 command, __u8 *values);
> __s32 i2c_smbus_write_block_data(int file, __u8 command, __u8 length,
> __u8 *values);
> ---------------------------------------------------------------------------------------
>
> I searched in the 2.6.13 version of Timesys and Suse linux, but I
> didn't find definition or declaration in file
> '/usr/include/linux/i2c-dev.h' and '/usr/include/linux/i2c.h'.
Please, look for this functions in the kernel source tree, not in
user-space headers.
--
Eugene
^ permalink raw reply
* RE: Couldn't find reference for i2c_smbus functinos
From: Jenkins, Clive @ 2006-09-20 16:27 UTC (permalink / raw)
To: Sachin Rane, linuxppc-embedded
In-Reply-To: <8584FDC94AFF7640B17B8A89B23B19B34F6576@sbsserver.AlphionCorp.local>
> You can do SMBus level transactions (see documentation file
smbus-protocol
> for details) through the following functions:
> __s32 i2c_smbus_write_quick(int file, __u8 value);
> ...
> Am I missing any information about the location of the above
functions?
Try reading
http://www.lm-sensors.org/browser/i2c/trunk/doc/dev-interface
and other material on the lm-sensors site
> Do I need to implement the above functions?
No.
^ permalink raw reply
* Re: how an application program utilizes the driver.
From: Josh Boyer @ 2006-09-20 16:30 UTC (permalink / raw)
To: David Hawkins; +Cc: linuxppc-embedded
In-Reply-To: <451168F6.3030701@ovro.caltech.edu>
On Wed, 2006-09-20 at 09:14 -0700, David Hawkins wrote:
>
> You really should read through Linux Device Drivers by Rubini,
Which is available here:
http://lwn.net/Kernel/LDD3/
josh
^ permalink raw reply
* Re: how an application program utilizes the driver.
From: David Hawkins @ 2006-09-20 16:14 UTC (permalink / raw)
To: Ming Liu; +Cc: linuxppc-embedded
In-Reply-To: <BAY110-F240E99BA0EDF765EC09402B2230@phx.gbl>
Hi Ming,
> My situation is: I want to write a driver for my custom device.(In the
> driver there are some functions defined to read or write my device.) Then
> in my application program, I use these defined functions to operate my
> hardware device. I think this is a normal process to operate the hardware
> with driver+app, right?
Right, but you've missed a few critical points.
For your custom device, you'll create a driver that implements
*kernel space* functions my_driver_open(), read(), write(), close()
etc. You'll install that module and create an appropriate
device node, eg. /dev/my_driver.
In your *user-space* application code, you'll open that device
int main(argc, argv) ...
int fd = open("/dev/my_driver" ...)
and then write to your device ...
int write(fd, buffer, len);
or read from your device ...
int read(fd, buffer, len);
The user-space calls open, read, write eventually call down into
your driver space code. The driver and application are not
linked, they communicate via the /dev interface.
You really should read through Linux Device Drivers by Rubini,
or check out a tutorial such as
http://www.ovro.caltech.edu/~dwh/correlator/pdf/LNX-723-Hawkins.pdf
http://www.ovro.caltech.edu/~dwh/correlator/software/driver_design.tar.gz
http://www.ovro.caltech.edu/~dwh/correlator/index.html
Regards,
Dave
^ permalink raw reply
* Re: [POWERPC] merge iSeries i/o operations with the rest
From: Hollis Blanchard @ 2006-09-20 16:01 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: ppc-dev, paulus
In-Reply-To: <20060920221558.1322b8b4.sfr@canb.auug.org.au>
On Wed, 2006-09-20 at 22:15 +1000, Stephen Rothwell wrote:
> + if (firmware_has_feature(FW_FEATURE_ISERIES)) {
> + BUG();
> + return;
> + }
Shouldn't all these be BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES))?
--
Hollis Blanchard
IBM Linux Technology Center
^ permalink raw reply
* Unable to mount jffs2
From: Mathews, Phil @ 2006-09-20 15:55 UTC (permalink / raw)
To: Wolfgang Denk, shyi; +Cc: linuxppc-embedded
In-Reply-To: <20060914005216.72C23353C57@atlas.denx.de>
[-- Attachment #1.1: Type: text/plain, Size: 190 bytes --]
See attachment
-- Phil Mathews
Innovative Concepts, Inc.
8200 Greensboro Dr., Suite 700
McLean, VA 22102
703-893-2007 x478
phil.mathews@innocon.com
[-- Attachment #1.2: Type: text/html, Size: 683 bytes --]
[-- Attachment #2: error --]
[-- Type: application/octet-stream, Size: 3929 bytes --]
I am unable to mount a jffs2 filesystem on a 2.6.15 kernel build from ELDK.
It appears the the erase block size (0x40000) does not get transferred to the target MPC8272ADS. Looking at the results below, the target MTD driver is assuming a 0x20000 erase block size.
Commands to build jffs2 filesystem on PC:
/opt/freescale/ltib/usr/bin/mkfs.jffs2 -d bin -o /nfsroot/bin -b -q -v -e 0x40000
{Note - using /home/mathews/eldk/usr/bin/mkfs.jffs2 didn't make a difference}
Relevant portions of .config:
==============8<==============8<==============
#
# Memory Technology Devices (MTD)
#
CONFIG_MTD=y
CONFIG_MTD_DEBUG=y
CONFIG_MTD_DEBUG_VERBOSE=3
CONFIG_MTD_CONCAT=y
CONFIG_MTD_PARTITIONS=y
# CONFIG_MTD_REDBOOT_PARTS is not set
CONFIG_MTD_CMDLINE_PARTS=y
#
# User Modules And Translation Layers
#
CONFIG_MTD_CHAR=y
CONFIG_MTD_BLOCK=y
# CONFIG_FTL is not set
# CONFIG_NFTL is not set
# CONFIG_INFTL is not set
# CONFIG_RFD_FTL is not set
#
# RAM/ROM/Flash chip drivers
#
CONFIG_MTD_CFI=y
# CONFIG_MTD_JEDECPROBE is not set
CONFIG_MTD_GEN_PROBE=y
CONFIG_MTD_CFI_ADV_OPTIONS=y
CONFIG_MTD_CFI_NOSWAP=y
# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
CONFIG_MTD_CFI_GEOMETRY=y
# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set
# CONFIG_MTD_MAP_BANK_WIDTH_2 is not set
CONFIG_MTD_MAP_BANK_WIDTH_4=y
# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
# CONFIG_MTD_CFI_I1 is not set
# CONFIG_MTD_CFI_I2 is not set
CONFIG_MTD_CFI_I4=y
# CONFIG_MTD_CFI_I8 is not set
# CONFIG_MTD_OTP is not set
CONFIG_MTD_CFI_INTELEXT=y
CONFIG_MTD_CFI_AMDSTD=y
CONFIG_MTD_CFI_AMDSTD_RETRY=2
CONFIG_MTD_CFI_STAA=y
CONFIG_MTD_CFI_UTIL=y
CONFIG_MTD_RAM=y
CONFIG_MTD_ROM=y
# CONFIG_MTD_ABSENT is not set
#
# Mapping drivers for chip access
#
CONFIG_MTD_COMPLEX_MAPPINGS=y
CONFIG_MTD_PHYSMAP=y
CONFIG_MTD_PHYSMAP_START=0xfe000000
CONFIG_MTD_PHYSMAP_LEN=0x2000000
CONFIG_MTD_PHYSMAP_BANKWIDTH=4
# CONFIG_MTD_PM82X is not set
# CONFIG_MTD_PCI is not set
# CONFIG_MTD_PLATRAM is not set
==============8<==============8<==============
Attempts to mount jffs2 fs on target:
# hexdump -n 1024 /dev/mtdblock2 | more
0000000 1985 2005 0000 0018 65fa fd45 0000 0000
0000010 0000 0000 0000 0000 1985 e001 0000 002b
0000020 3e42 2427 0000 0001 0000 0000 0000 0002
0000030 4510 4b94 0304 0000 fc1c fd39 d3ae a45a
0000040 746d 70ff 1985 e002 0000 0044 a4ef 223e
0000050 0000 0002 0000 0001 0000 41ed 7d10 0064
0000060 0000 0000 4510 4b94 4510 4b94 4510 4b94
0000070 0000 0000 0000 0000 0000 0000 0000 0000
0000080 0000 0000 69f4 c8ea ffff ffff ffff ffff
0000090 ffff ffff ffff ffff ffff ffff ffff ffff
*
0000400 # mount -o remount,rw /dev/ram0 /
# mkdir /mnt
# mount -t jffs2 /dev/mtdblock2 /mnt
# Erase at 0x00160000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x00140000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x00120000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x00100000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x000e0000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x000c0000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x000a0000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x00080000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x00060000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x00040000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x00020000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x001a0000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x00180000 failed immediately: -EROFS. Is the sector locked?
df
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/ram0 4037 3133 904 78% /
/dev/mtdblock2 1792 1792 0 100% /mnt
^ permalink raw reply
* Couldn't find reference for i2c_smbus functinos
From: Sachin Rane @ 2006-09-20 15:07 UTC (permalink / raw)
To: linuxppc-embedded
In-Reply-To: <8584FDC94AFF7640B17B8A89B23B19B34F6573@sbsserver.AlphionCorp.local>
[-- Attachment #1: Type: text/plain, Size: 1441 bytes --]
Hi,
Following text is from "/usr/local/linux/Doumentation/dev-interface":
----------------------------------------------------------------------------------------------------------------------------------
You can do SMBus level transactions (see documentation file smbus-protocol
for details) through the following functions:
__s32 i2c_smbus_write_quick(int file, __u8 value);
__s32 i2c_smbus_read_byte(int file);
__s32 i2c_smbus_write_byte(int file, __u8 value);
__s32 i2c_smbus_read_byte_data(int file, __u8 command);
__s32 i2c_smbus_write_byte_data(int file, __u8 command, __u8 value);
__s32 i2c_smbus_read_word_data(int file, __u8 command);
__s32 i2c_smbus_write_word_data(int file, __u8 command, __u16 value);
__s32 i2c_smbus_process_call(int file, __u8 command, __u16 value);
__s32 i2c_smbus_read_block_data(int file, __u8 command, __u8 *values);
__s32 i2c_smbus_write_block_data(int file, __u8 command, __u8 length,
__u8 *values);
---------------------------------------------------------------------------------------
I searched in the 2.6.13 version of Timesys and Suse linux, but I didn't find definition or declaration in file '/usr/include/linux/i2c-dev.h' and '/usr/include/linux/i2c.h'.
Am I missing any information about the location of the above functions?
Do I need to implement the above functions?
Thanks and Regards,
Sachin Rane
[-- Attachment #2: Type: text/html, Size: 2259 bytes --]
^ permalink raw reply
* [PATCH] 40x: Fix debug status register defines
From: Josh Boyer @ 2006-09-20 14:11 UTC (permalink / raw)
To: paulus, mporter; +Cc: linuxppc-dev
This patch fixes some debug register defines on PPC 40x that were incorrect.
Signed-off-by: Josh Boyer <jdub@us.ibm.com>
---
include/asm-ppc/reg_booke.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
--- linux-2.6.orig/include/asm-ppc/reg_booke.h
+++ linux-2.6/include/asm-ppc/reg_booke.h
@@ -300,14 +300,14 @@ do { \
#define DBSR_IC 0x80000000 /* Instruction Completion */
#define DBSR_BT 0x40000000 /* Branch taken */
#define DBSR_TIE 0x10000000 /* Trap Instruction debug Event */
-#define DBSR_IAC1 0x00800000 /* Instruction Address Compare 1 Event */
-#define DBSR_IAC2 0x00400000 /* Instruction Address Compare 2 Event */
-#define DBSR_IAC3 0x00200000 /* Instruction Address Compare 3 Event */
-#define DBSR_IAC4 0x00100000 /* Instruction Address Compare 4 Event */
-#define DBSR_DAC1R 0x00080000 /* Data Address Compare 1 Read Event */
-#define DBSR_DAC1W 0x00040000 /* Data Address Compare 1 Write Event */
-#define DBSR_DAC2R 0x00020000 /* Data Address Compare 2 Read Event */
-#define DBSR_DAC2W 0x00010000 /* Data Address Compare 2 Write Event */
+#define DBSR_IAC1 0x04000000 /* Instruction Address Compare 1 Event */
+#define DBSR_IAC2 0x02000000 /* Instruction Address Compare 2 Event */
+#define DBSR_IAC3 0x00080000 /* Instruction Address Compare 3 Event */
+#define DBSR_IAC4 0x00040000 /* Instruction Address Compare 4 Event */
+#define DBSR_DAC1R 0x01000000 /* Data Address Compare 1 Read Event */
+#define DBSR_DAC1W 0x00800000 /* Data Address Compare 1 Write Event */
+#define DBSR_DAC2R 0x00400000 /* Data Address Compare 2 Read Event */
+#define DBSR_DAC2W 0x00200000 /* Data Address Compare 2 Write Event */
#endif
/* Bit definitions related to the ESR. */
^ permalink raw reply
* how an application program utilizes the driver.
From: Ming Liu @ 2006-09-20 13:48 UTC (permalink / raw)
To: linuxppc-embedded
Dear all,
Maybe this question sounds stupid for most software engineers. But I really
have much confusion on this topic. So I have to ask for explanation.
My situation is: I want to write a driver for my custom device.(In the
driver there are some functions defined to read or write my device.) Then
in my application program, I use these defined functions to operate my
hardware device. I think this is a normal process to operate the hardware
with driver+app, right?
My driver is defined in drv_hello.c. I have compiled it into a module
drv_hello.ko and it could be insmoded or rmmoded correctly. It looks like:
//drv_hello.c
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
MODULE_LICENSE("Dual BSD/GPL");
void show_hello(){
printk("hello.\n");
}
static int hello_init(void){
printk(KERN_ALERT "module starts.\n");
return 0;
}
static void hello_exit(void){
printk(KERN_ALERT "module exits.\n");
}
module_init(hello_init);
module_exit(hello_exit);
EXPORT_SYMBOL(show_hello);
In my application program app_hello.c, I use the function show_hello to
achieve the simple task: print "hello" on the console. Here is my app
program:
//app_hello.c
extern void show_hello();
int main(int argc, char** argv)
{
show_hello();
return 0;
}
Then, here comes my problem: I don't know how to compile my application
program and then it could dynamically refer to the function show_hello()
defined in the memory area of the driver module. How can I tell the
compiler and linker that the app program is expected to be linked with the
driver module dynamically? If possible, please give me a detailed
explanation.
Waiting for your suggestion. Thanks for your help.
Regards
Ming
_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger: http://messenger.msn.com/cn
^ permalink raw reply
* Re: [PATCH] adbhid: make KEY_SYSRQ configurable on ADB based machines
From: Aristeu Sergio Rozanski Filho @ 2006-09-20 13:44 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <20060808154937.GC3363@cathedrallabs.org>
> This patch adds a sysfs entry on /sys/class/adb/keyboard0/sysrq_key to
> configure which key will be mapped to KEY_SYSRQ. This is needed to make
> sysrq usable on machines which doesn't have current sysrq key. This
> patch and the previous two ones has been tested for some days in my
> machine without problems.
any comments on this one?
> Signed-off-by: Aristeu S. Rozanski F. <aris@cathedrallabs.org>
> Acked-by: Michael Hanselmann <linux-kernel@hansmi.ch>
>
> Index: ppc-2.6/drivers/macintosh/adbhid.c
> ===================================================================
> --- ppc-2.6.orig/drivers/macintosh/adbhid.c 2006-08-04 09:45:43.000000000 -0300
> +++ ppc-2.6/drivers/macintosh/adbhid.c 2006-08-04 09:52:06.000000000 -0300
> @@ -61,6 +61,47 @@
> .notifier_call = adb_message_handler,
> };
>
> +/* SYSRQ support */
> +#ifdef CONFIG_MAGIC_SYSRQ
> +static int adbhid_sysrq_key = 0x69;
> +
> +static ssize_t adbhid_show_sysrq_key(struct class_device *dev, char *buf)
> +{
> + return sprintf(buf, "%#x\n", adbhid_sysrq_key);
> +}
> +static ssize_t adbhid_store_sysrq_key(struct class_device *dev,
> + const char *buf, size_t n)
> +{
> + int val;
> +
> + val = simple_strtol(buf, NULL, 10);
> + if (val > 255)
> + return -EINVAL;
> + adbhid_sysrq_key = val;
> +
> + return n;
> +}
> +
> +static CLASS_DEVICE_ATTR(sysrq_key, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH,
> + adbhid_show_sysrq_key, adbhid_store_sysrq_key);
> +static inline int adbhid_key_is_sysrq(int keycode)
> +{
> + if (unlikely(keycode == adbhid_sysrq_key))
> + return KEY_SYSRQ;
> + return 0;
> +}
> +
> +static inline void adbhid_register_sysrq_attr(struct class_device *dev)
> +{
> + class_device_create_file(dev, &class_device_attr_sysrq_key);
> +}
> +#define adbhid_set_sysrq(x) set_bit(KEY_SYSRQ, (x))
> +#else /* !CONFIG_MAGIC_SYSRQ */
> +#define adbhid_key_is_sysrq(x) (0)
> +#define adbhid_register_sysrq_attr(x) do { } while(0)
> +#define adbhid_set_sysrq(x) do { } while(0)
> +#endif /* CONFIG_MAGIC_SYSRQ */
> +
> /* Some special keys */
> #define ADB_KEY_DEL 0x33
> #define ADB_KEY_CMD 0x37
> @@ -176,7 +217,7 @@
> /* 0x66 */ KEY_HANJA, /* 123 */
> /* 0x67 */ KEY_F11, /* 87 */
> /* 0x68 */ KEY_HANGEUL, /* 122 */
> - /* 0x69 */ KEY_SYSRQ, /* 99 */
> + /* 0x69 */ 0,
> /* 0x6a */ 0,
> /* 0x6b */ KEY_SCROLLLOCK, /* 70 */
> /* 0x6c */ 0,
> @@ -275,7 +316,7 @@
> adbhid_input_keycode(int id, int keycode, int repeat, struct pt_regs *regs)
> {
> struct adbhid *ahid = adbhid[id];
> - int up_flag, key;
> + int up_flag, key = 0;
>
> up_flag = (keycode & 0x80);
> keycode &= 0x7f;
> @@ -336,7 +377,9 @@
> #endif /* CONFIG_PPC_PMAC */
> }
>
> - key = adbhid[id]->keycode[keycode];
> + key = adbhid_key_is_sysrq(keycode);
> + if (!key)
> + key = adbhid[id]->keycode[keycode];
> if (key) {
> input_regs(adbhid[id]->input, regs);
> input_report_key(adbhid[id]->input, key, !up_flag);
> @@ -759,6 +802,7 @@
> for (i = 0; i < 128; i++)
> if (hid->keycode[i])
> set_bit(hid->keycode[i], input_dev->keybit);
> + adbhid_set_sysrq(input_dev->keybit);
>
> input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_REP);
> input_dev->ledbit[0] = BIT(LED_SCROLLL) | BIT(LED_CAPSL) | BIT(LED_NUML);
> @@ -901,6 +945,8 @@
> adb_get_infos(id, &default_id, &cur_handler_id);
> reg |= adbhid_input_reregister(id, default_id, org_handler_id,
> cur_handler_id, 0);
> +
> + adbhid_register_sysrq_attr(keyboard_ids.device[i]);
> }
>
> for (i = 0; i < buttons_ids.nids; i++) {
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
--
Aristeu
^ permalink raw reply
* Re: [PATCH] adb: create class devices for each handler
From: Aristeu Sergio Rozanski Filho @ 2006-09-20 13:44 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <20060808154535.GB3363@cathedrallabs.org>
> This patch creates a class device for each registered ADB handler
> (currently only adbhid) such as /sys/classes/adb/keyboard0/,
> /sys/classes/adb/mouse0/. This is needed for the next patch, to create
> a sysfs entry to make SYSRQ key configurable on ADB based machines.
any comments on this one?
> Signed-off-by: Aristeu S. Rozanski F. <aris@cathedrallabs.org>
> Acked-by: Michael Hanselmann <linux-kernel@hansmi.ch>
>
> Index: ppc-2.6/drivers/macintosh/adb.c
> ===================================================================
> --- ppc-2.6.orig/drivers/macintosh/adb.c 2006-08-03 23:51:35.000000000 -0300
> +++ ppc-2.6/drivers/macintosh/adb.c 2006-08-03 23:56:00.000000000 -0300
> @@ -102,11 +102,22 @@
> static void adbdev_init(void);
> static int try_handler_change(int, int);
>
> +static char *adb_device_id_string[] = {
> + [ADB_DONGLE] = "dongle",
> + [ADB_KEYBOARD] = "keyboard",
> + [ADB_MOUSE] = "mouse",
> + [ADB_TABLET] = "tablet",
> + [ADB_MODEM] = "modem",
> + [ADB_MISC] = "misc",
> +};
> +
> static struct adb_handler {
> void (*handler)(unsigned char *, int, struct pt_regs *, int);
> int original_address;
> int handler_id;
> int busy;
> + char name[16];
> + struct class_device *device;
> } adb_handler[16];
>
> /*
> @@ -541,6 +552,15 @@
> write_lock_irq(&adb_handler_lock);
> adb_handler[i].handler = handler;
> write_unlock_irq(&adb_handler_lock);
> +
> + snprintf(adb_handler[i].name,
> + sizeof(adb_handler[i].name), "%s%i",
> + adb_device_id_string[default_id], ids->nids);
> + adb_handler[i].device = class_device_create(
> + adb_dev_class, NULL,
> + MKDEV(0, 0), NULL,
> + adb_handler[i].name);
> + ids->device[ids->nids] = adb_handler[i].device;
> ids->id[ids->nids++] = i;
> }
> }
> @@ -563,6 +583,7 @@
> }
> ret = 0;
> adb_handler[index].handler = NULL;
> + class_device_del(adb_handler[index].device);
> }
> write_unlock_irq(&adb_handler_lock);
> up(&adb_handler_sem);
> Index: ppc-2.6/include/linux/adb.h
> ===================================================================
> --- ppc-2.6.orig/include/linux/adb.h 2006-08-03 23:51:35.000000000 -0300
> +++ ppc-2.6/include/linux/adb.h 2006-08-03 23:57:56.000000000 -0300
> @@ -3,6 +3,7 @@
> */
> #ifndef __ADB_H
> #define __ADB_H
> +#include <linux/device.h>
>
> /* ADB commands */
> #define ADB_BUSRESET 0
> @@ -58,6 +59,7 @@
> struct adb_ids {
> int nids;
> unsigned char id[16];
> + struct class_device *device[16];
> };
>
> /* Structure which encapsulates a low-level ADB driver */
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
--
Aristeu
^ permalink raw reply
* Re: [PATCH] adbhid: enable KEY_FN key reporting
From: Aristeu Sergio Rozanski Filho @ 2006-09-20 13:44 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <20060808154117.GA3363@cathedrallabs.org>
> This patch enables the KEY_FN reporting on ADB based machines. This is a
> needed step to move special key sequences handling to user space and to
> allow the usage of Fn key to other purposes. I've been running this for
> some days without problems.
>
> Signed-off-by: Aristeu S. Rozanski F. <aris@cathedrallabs.org>
> Acked-by: Michael Hanselmann <linux-kernel@hansmi.ch>
any comments on this one?
> Index: ppc-2.6/drivers/macintosh/adbhid.c
> ===================================================================
> --- ppc-2.6.orig/drivers/macintosh/adbhid.c 2006-08-04 08:53:20.000000000 -0300
> +++ ppc-2.6/drivers/macintosh/adbhid.c 2006-08-04 09:45:43.000000000 -0300
> @@ -70,7 +70,7 @@
> #define ADB_KEY_POWER_OLD 0x7e
> #define ADB_KEY_POWER 0x7f
>
> -u8 adb_to_linux_keycodes[128] = {
> +u16 adb_to_linux_keycodes[128] = {
> /* 0x00 */ KEY_A, /* 30 */
> /* 0x01 */ KEY_S, /* 31 */
> /* 0x02 */ KEY_D, /* 32 */
> @@ -134,7 +134,7 @@
> /* 0x3c */ KEY_RIGHT, /* 106 */
> /* 0x3d */ KEY_DOWN, /* 108 */
> /* 0x3e */ KEY_UP, /* 103 */
> - /* 0x3f */ 0,
> + /* 0x3f */ KEY_FN, /* 0x1d0 */
> /* 0x40 */ 0,
> /* 0x41 */ KEY_KPDOT, /* 83 */
> /* 0x42 */ 0,
> @@ -208,7 +208,7 @@
> int original_handler_id;
> int current_handler_id;
> int mouse_kind;
> - unsigned char *keycode;
> + u16 *keycode;
> char name[64];
> char phys[32];
> int flags;
> @@ -275,7 +275,7 @@
> adbhid_input_keycode(int id, int keycode, int repeat, struct pt_regs *regs)
> {
> struct adbhid *ahid = adbhid[id];
> - int up_flag;
> + int up_flag, key;
>
> up_flag = (keycode & 0x80);
> keycode &= 0x7f;
> @@ -322,8 +322,7 @@
> }
> } else
> ahid->flags |= FLAG_FN_KEY_PRESSED;
> - /* Swallow the key press */
> - return;
> + break;
> case ADB_KEY_DEL:
> /* Emulate Fn+delete = forward delete */
> if (ahid->flags & FLAG_FN_KEY_PRESSED) {
> @@ -337,10 +336,10 @@
> #endif /* CONFIG_PPC_PMAC */
> }
>
> - if (adbhid[id]->keycode[keycode]) {
> + key = adbhid[id]->keycode[keycode];
> + if (key) {
> input_regs(adbhid[id]->input, regs);
> - input_report_key(adbhid[id]->input,
> - adbhid[id]->keycode[keycode], !up_flag);
> + input_report_key(adbhid[id]->input, key, !up_flag);
> input_sync(adbhid[id]->input);
> } else
> printk(KERN_INFO "Unhandled ADB key (scancode %#02x) %s.\n", keycode,
> @@ -764,8 +763,8 @@
> input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_REP);
> input_dev->ledbit[0] = BIT(LED_SCROLLL) | BIT(LED_CAPSL) | BIT(LED_NUML);
> input_dev->event = adbhid_kbd_event;
> - input_dev->keycodemax = 127;
> - input_dev->keycodesize = 1;
> + input_dev->keycodemax = KEY_FN;
> + input_dev->keycodesize = sizeof(hid->keycode[0]);
> break;
>
> case ADB_MOUSE:
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
--
Aristeu
^ permalink raw reply
* I2C: Getting Compiation Error for application program
From: Sachin Rane @ 2006-09-20 12:51 UTC (permalink / raw)
To: linux-users-list; +Cc: i2c, linuxppc-embedded
[-- Attachment #1: Type: text/plain, Size: 1093 bytes --]
Hi,
I am trying to compile simple program (appended), but getting lots of compilation error.
I am using Timesys Linux 2.6.13 for ppc440 evaluation board.
Command used for compilation:
$> gcc eeprom-client.c -o eeprom-client.o
Could you help me to find out the reason behind getting the errors?
Regards,
Sachin Rane
8< ------------------------eeprom-client.c -------------------------------------------------------------------------------------
#include <linux/i2c.h>
#include <linux/i2c-dev.h>
int main()
{
int file;
int adapter_nr = 0; /* probably dynamically determined */
char filename[20];
int addr = 0xA1; /* The I2C address */
sprintf(filename,"/dev/i2c-%d",adapter_nr);
if ((file = open(filename,O_RDWR)) < 0)
{
exit(1);
}
if (ioctl(file,I2C_SLAVE,addr) < 0)
{
exit(1);
}
else
{
printf("\n Able to bind the adapter");
}
return 0;
}
8< -------------------------------------------------------------------------------------------------------------
[-- Attachment #2: Type: text/html, Size: 2423 bytes --]
^ permalink raw reply
* Re: linux-2.6 system ACE driver - need help
From: Jeff Angielski @ 2006-09-20 12:38 UTC (permalink / raw)
To: agnel juni; +Cc: linuxppc-embedded
In-Reply-To: <20060919224349.25812.qmail@web8408.mail.in.yahoo.com>
On Tue, 2006-09-19 at 23:43 +0100, agnel juni wrote:
> First, I would like to know if the driver tested in interrupt mode.
Does it work for you in polling mode? If not, you probably have a
problem with the way you are accessing the system ace - cache,
endianess, byte alignment, etc. If it does work in polling, the usual
suspects are interrupt masking errors or some low level problems with
your IRQ signals. Since you know the size of a sector and the size of
the sysace buffers, how many interrupts do you get per sector read? Do
you see extras or not enough?
> We are able to mount the CF, but it is very inconsistent.
Dump the sector data to the screen that you are reading from the CF.
Especially look at the results from the initial identify command to
verify that they make sense, and because that is the easiest to check.
> Same is the case with fdisk command. When it fails,we get errors which you could see in the screen-dump below.
> Are we missing to apply the right patch? Please let us know your
> inputs to go forward.
> Looking forwards for your reply.
>
> # mount -t msdos /dev/xsysace /root/cf
Shouldn't this be /dev/xsysace1? You want to mount a partition not the
entire block device.
--
Jeff Angielski
The PTR Group
^ permalink raw reply
* [POWERPC] merge iSeries i/o operations with the rest
From: Stephen Rothwell @ 2006-09-20 12:15 UTC (permalink / raw)
To: paulus; +Cc: ppc-dev
In-Reply-To: <20060918153853.f4332d2a.sfr@canb.auug.org.au>
This patch changes the io operations so that they are out of line if
CONFIG_PPC_ISERIES is set and includes a firmware feature check in
that case.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
arch/powerpc/kernel/io.c | 26 +++
arch/powerpc/platforms/iseries/pci.c | 304 +++++++++++++++++++++++++-----
include/asm-powerpc/io.h | 148 ++++++++-------
include/asm-powerpc/iseries/iseries_io.h | 60 ------
4 files changed, 355 insertions(+), 183 deletions(-)
This version depends on the other i/o patches I have sent recently.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
diff --git a/arch/powerpc/kernel/io.c b/arch/powerpc/kernel/io.c
index 80a3209..7836995 100644
--- a/arch/powerpc/kernel/io.c
+++ b/arch/powerpc/kernel/io.c
@@ -22,12 +22,18 @@ #include <linux/compiler.h>
#include <linux/module.h>
#include <asm/io.h>
+#include <asm/firmware.h>
+#include <asm/bug.h>
void _insb(volatile u8 __iomem *port, void *buf, long count)
{
u8 *tbuf = buf;
u8 tmp;
+ if (firmware_has_feature(FW_FEATURE_ISERIES)) {
+ BUG();
+ return;
+ }
if (unlikely(count <= 0))
return;
asm volatile("sync");
@@ -44,6 +50,10 @@ void _outsb(volatile u8 __iomem *port, c
{
const u8 *tbuf = buf;
+ if (firmware_has_feature(FW_FEATURE_ISERIES)) {
+ BUG();
+ return;
+ }
if (unlikely(count <= 0))
return;
asm volatile("sync");
@@ -59,6 +69,10 @@ void _insw_ns(volatile u16 __iomem *port
u16 *tbuf = buf;
u16 tmp;
+ if (firmware_has_feature(FW_FEATURE_ISERIES)) {
+ BUG();
+ return;
+ }
if (unlikely(count <= 0))
return;
asm volatile("sync");
@@ -75,6 +89,10 @@ void _outsw_ns(volatile u16 __iomem *por
{
const u16 *tbuf = buf;
+ if (firmware_has_feature(FW_FEATURE_ISERIES)) {
+ BUG();
+ return;
+ }
if (unlikely(count <= 0))
return;
asm volatile("sync");
@@ -90,6 +108,10 @@ void _insl_ns(volatile u32 __iomem *port
u32 *tbuf = buf;
u32 tmp;
+ if (firmware_has_feature(FW_FEATURE_ISERIES)) {
+ BUG();
+ return;
+ }
if (unlikely(count <= 0))
return;
asm volatile("sync");
@@ -106,6 +128,10 @@ void _outsl_ns(volatile u32 __iomem *por
{
const u32 *tbuf = buf;
+ if (firmware_has_feature(FW_FEATURE_ISERIES)) {
+ BUG();
+ return;
+ }
if (unlikely(count <= 0))
return;
asm volatile("sync");
diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index f4d427a..9646ee1 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -34,6 +34,7 @@ #include <asm/machdep.h>
#include <asm/pci-bridge.h>
#include <asm/iommu.h>
#include <asm/abs_addr.h>
+#include <asm/firmware.h>
#include <asm/iseries/hv_call_xm.h>
#include <asm/iseries/mf.h>
@@ -270,46 +271,6 @@ void pcibios_fixup_resources(struct pci_
}
/*
- * I/0 Memory copy MUST use mmio commands on iSeries
- * To do; For performance, include the hv call directly
- */
-void iSeries_memset_io(volatile void __iomem *dest, char c, size_t Count)
-{
- u8 ByteValue = c;
- long NumberOfBytes = Count;
-
- while (NumberOfBytes > 0) {
- iSeries_Write_Byte(ByteValue, dest++);
- -- NumberOfBytes;
- }
-}
-EXPORT_SYMBOL(iSeries_memset_io);
-
-void iSeries_memcpy_toio(volatile void __iomem *dest, void *source, size_t count)
-{
- char *src = source;
- long NumberOfBytes = count;
-
- while (NumberOfBytes > 0) {
- iSeries_Write_Byte(*src++, dest++);
- -- NumberOfBytes;
- }
-}
-EXPORT_SYMBOL(iSeries_memcpy_toio);
-
-void iSeries_memcpy_fromio(void *dest, const volatile void __iomem *src, size_t count)
-{
- char *dst = dest;
- long NumberOfBytes = count;
-
- while (NumberOfBytes > 0) {
- *dst++ = iSeries_Read_Byte(src++);
- -- NumberOfBytes;
- }
-}
-EXPORT_SYMBOL(iSeries_memcpy_fromio);
-
-/*
* Look down the chain to find the matching Device Device
*/
static struct device_node *find_Device_Node(int bus, int devfn)
@@ -491,7 +452,7 @@ static inline struct device_node *xlate_
* iSeries_Read_Word = Read Word (16 bit)
* iSeries_Read_Long = Read Long (32 bit)
*/
-u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress)
+static u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress)
{
u64 BarOffset;
u64 dsa;
@@ -518,9 +479,8 @@ u8 iSeries_Read_Byte(const volatile void
return (u8)ret.value;
}
-EXPORT_SYMBOL(iSeries_Read_Byte);
-u16 iSeries_Read_Word(const volatile void __iomem *IoAddress)
+static u16 iSeries_Read_Word(const volatile void __iomem *IoAddress)
{
u64 BarOffset;
u64 dsa;
@@ -548,9 +508,8 @@ u16 iSeries_Read_Word(const volatile voi
return swab16((u16)ret.value);
}
-EXPORT_SYMBOL(iSeries_Read_Word);
-u32 iSeries_Read_Long(const volatile void __iomem *IoAddress)
+static u32 iSeries_Read_Long(const volatile void __iomem *IoAddress)
{
u64 BarOffset;
u64 dsa;
@@ -578,7 +537,6 @@ u32 iSeries_Read_Long(const volatile voi
return swab32((u32)ret.value);
}
-EXPORT_SYMBOL(iSeries_Read_Long);
/*
* Write MM I/O Instructions for the iSeries
@@ -587,7 +545,7 @@ EXPORT_SYMBOL(iSeries_Read_Long);
* iSeries_Write_Word = Write Word(16 bit)
* iSeries_Write_Long = Write Long(32 bit)
*/
-void iSeries_Write_Byte(u8 data, volatile void __iomem *IoAddress)
+static void iSeries_Write_Byte(u8 data, volatile void __iomem *IoAddress)
{
u64 BarOffset;
u64 dsa;
@@ -612,9 +570,8 @@ void iSeries_Write_Byte(u8 data, volatil
rc = HvCall4(HvCallPciBarStore8, dsa, BarOffset, data, 0);
} while (CheckReturnCode("WWB", DevNode, &retry, rc) != 0);
}
-EXPORT_SYMBOL(iSeries_Write_Byte);
-void iSeries_Write_Word(u16 data, volatile void __iomem *IoAddress)
+static void iSeries_Write_Word(u16 data, volatile void __iomem *IoAddress)
{
u64 BarOffset;
u64 dsa;
@@ -639,9 +596,8 @@ void iSeries_Write_Word(u16 data, volati
rc = HvCall4(HvCallPciBarStore16, dsa, BarOffset, swab16(data), 0);
} while (CheckReturnCode("WWW", DevNode, &retry, rc) != 0);
}
-EXPORT_SYMBOL(iSeries_Write_Word);
-void iSeries_Write_Long(u32 data, volatile void __iomem *IoAddress)
+static void iSeries_Write_Long(u32 data, volatile void __iomem *IoAddress)
{
u64 BarOffset;
u64 dsa;
@@ -666,4 +622,248 @@ void iSeries_Write_Long(u32 data, volati
rc = HvCall4(HvCallPciBarStore32, dsa, BarOffset, swab32(data), 0);
} while (CheckReturnCode("WWL", DevNode, &retry, rc) != 0);
}
-EXPORT_SYMBOL(iSeries_Write_Long);
+
+extern unsigned char __raw_readb(const volatile void __iomem *addr)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES)) {
+ BUG();
+ return 0;
+ }
+ return *(volatile unsigned char __force *)addr;
+}
+EXPORT_SYMBOL(__raw_readb);
+
+extern unsigned short __raw_readw(const volatile void __iomem *addr)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES)) {
+ BUG();
+ return 0;
+ }
+ return *(volatile unsigned short __force *)addr;
+}
+EXPORT_SYMBOL(__raw_readw);
+
+extern unsigned int __raw_readl(const volatile void __iomem *addr)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES)) {
+ BUG();
+ return 0;
+ }
+ return *(volatile unsigned int __force *)addr;
+}
+EXPORT_SYMBOL(__raw_readl);
+
+extern unsigned long __raw_readq(const volatile void __iomem *addr)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES)) {
+ BUG();
+ return 0;
+ }
+ return *(volatile unsigned long __force *)addr;
+}
+EXPORT_SYMBOL(__raw_readq);
+
+extern void __raw_writeb(unsigned char v, volatile void __iomem *addr)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES))
+ BUG();
+ else
+ *(volatile unsigned char __force *)addr = v;
+}
+EXPORT_SYMBOL(__raw_writeb);
+
+extern void __raw_writew(unsigned short v, volatile void __iomem *addr)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES))
+ BUG();
+ else
+ *(volatile unsigned short __force *)addr = v;
+}
+EXPORT_SYMBOL(__raw_writew);
+
+extern void __raw_writel(unsigned int v, volatile void __iomem *addr)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES))
+ BUG();
+ else
+ *(volatile unsigned int __force *)addr = v;
+}
+EXPORT_SYMBOL(__raw_writel);
+
+extern void __raw_writeq(unsigned long v, volatile void __iomem *addr)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES))
+ BUG();
+ else
+ *(volatile unsigned long __force *)addr = v;
+}
+EXPORT_SYMBOL(__raw_writeq);
+
+int in_8(const volatile unsigned char __iomem *addr)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES))
+ return iSeries_Read_Byte(addr);
+ return __in_8(addr);
+}
+EXPORT_SYMBOL(in_8);
+
+void out_8(volatile unsigned char __iomem *addr, int val)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES))
+ iSeries_Write_Byte(val, addr);
+ else
+ __out_8(addr, val);
+}
+EXPORT_SYMBOL(out_8);
+
+int in_le16(const volatile unsigned short __iomem *addr)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES))
+ return iSeries_Read_Word(addr);
+ return __in_le16(addr);
+}
+EXPORT_SYMBOL(in_le16);
+
+int in_be16(const volatile unsigned short __iomem *addr)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES)) {
+ BUG();
+ return 0;
+ }
+ return __in_be16(addr);
+}
+EXPORT_SYMBOL(in_be16);
+
+void out_le16(volatile unsigned short __iomem *addr, int val)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES))
+ iSeries_Write_Word(val, addr);
+ else
+ __out_le16(addr, val);
+}
+EXPORT_SYMBOL(out_le16);
+
+void out_be16(volatile unsigned short __iomem *addr, int val)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES))
+ BUG();
+ else
+ __out_be16(addr, val);
+}
+EXPORT_SYMBOL(out_be16);
+
+unsigned in_le32(const volatile unsigned __iomem *addr)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES))
+ return iSeries_Read_Long(addr);
+ return __in_le32(addr);
+}
+EXPORT_SYMBOL(in_le32);
+
+unsigned in_be32(const volatile unsigned __iomem *addr)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES)) {
+ BUG();
+ return 0;
+ }
+ return __in_be32(addr);
+}
+EXPORT_SYMBOL(in_be32);
+
+void out_le32(volatile unsigned __iomem *addr, int val)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES))
+ iSeries_Write_Long(val, addr);
+ else
+ __out_le32(addr, val);
+}
+EXPORT_SYMBOL(out_le32);
+
+void out_be32(volatile unsigned __iomem *addr, int val)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES))
+ BUG();
+ else
+ __out_be32(addr, val);
+}
+EXPORT_SYMBOL(out_be32);
+
+unsigned long in_le64(const volatile unsigned long __iomem *addr)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES)) {
+ BUG();
+ return 0;
+ }
+ return __in_le64(addr);
+}
+EXPORT_SYMBOL(in_le64);
+
+unsigned long in_be64(const volatile unsigned long __iomem *addr)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES)) {
+ BUG();
+ return 0;
+ }
+ return __in_be64(addr);
+}
+EXPORT_SYMBOL(in_be64);
+
+void out_le64(volatile unsigned long __iomem *addr, unsigned long val)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES))
+ BUG();
+ else
+ __out_le64(addr, val);
+}
+EXPORT_SYMBOL(out_le64);
+
+void out_be64(volatile unsigned long __iomem *addr, unsigned long val)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES))
+ BUG();
+ else
+ __out_be64(addr, val);
+}
+EXPORT_SYMBOL(out_be64);
+
+void memset_io(volatile void __iomem *addr, int c, unsigned long n)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES)) {
+ volatile char __iomem *d = addr;
+
+ while (n-- > 0) {
+ iSeries_Write_Byte(c, d++);
+ }
+ } else
+ eeh_memset_io(addr, c, n);
+}
+EXPORT_SYMBOL(memset_io);
+
+void memcpy_fromio(void *dest, const volatile void __iomem *src,
+ unsigned long n)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES)) {
+ char *d = dest;
+ const volatile char __iomem *s = src;
+
+ while (n-- > 0) {
+ *d++ = iSeries_Read_Byte(s++);
+ }
+ } else
+ eeh_memcpy_fromio(dest, src, n);
+}
+EXPORT_SYMBOL(memcpy_fromio);
+
+void memcpy_toio(volatile void __iomem *dest, const void *src, unsigned long n)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES)) {
+ const char *s = src;
+ volatile char __iomem *d = dest;
+
+ while (n-- > 0) {
+ iSeries_Write_Byte(*s++, d++);
+ }
+ } else
+ eeh_memcpy_toio(dest, src, n);
+}
+EXPORT_SYMBOL(memcpy_toio);
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index 174fb89..46bae1c 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -20,9 +20,6 @@ #include <linux/compiler.h>
#include <asm/page.h>
#include <asm/byteorder.h>
#include <asm/paca.h>
-#ifdef CONFIG_PPC_ISERIES
-#include <asm/iseries/iseries_io.h>
-#endif
#include <asm/synch.h>
#include <asm/delay.h>
@@ -37,41 +34,53 @@ extern unsigned long isa_io_base;
extern unsigned long pci_io_base;
#ifdef CONFIG_PPC_ISERIES
-/* __raw_* accessors aren't supported on iSeries */
-#define __raw_readb(addr) { BUG(); 0; }
-#define __raw_readw(addr) { BUG(); 0; }
-#define __raw_readl(addr) { BUG(); 0; }
-#define __raw_readq(addr) { BUG(); 0; }
-#define __raw_writeb(v, addr) { BUG(); 0; }
-#define __raw_writew(v, addr) { BUG(); 0; }
-#define __raw_writel(v, addr) { BUG(); 0; }
-#define __raw_writeq(v, addr) { BUG(); 0; }
-#define readb(addr) iSeries_Read_Byte(addr)
-#define readw(addr) iSeries_Read_Word(addr)
-#define readl(addr) iSeries_Read_Long(addr)
-#define writeb(data, addr) iSeries_Write_Byte((data),(addr))
-#define writew(data, addr) iSeries_Write_Word((data),(addr))
-#define writel(data, addr) iSeries_Write_Long((data),(addr))
-#define memset_io(a,b,c) iSeries_memset_io((a),(b),(c))
-#define memcpy_fromio(a,b,c) iSeries_memcpy_fromio((a), (b), (c))
-#define memcpy_toio(a,b,c) iSeries_memcpy_toio((a), (b), (c))
-
-#define inb(addr) readb(((void __iomem *)(long)(addr)))
-#define inw(addr) readw(((void __iomem *)(long)(addr)))
-#define inl(addr) readl(((void __iomem *)(long)(addr)))
-#define outb(data,addr) writeb(data,((void __iomem *)(long)(addr)))
-#define outw(data,addr) writew(data,((void __iomem *)(long)(addr)))
-#define outl(data,addr) writel(data,((void __iomem *)(long)(addr)))
-/*
- * The *_ns versions below don't do byte-swapping.
- * Neither do the standard versions now, these are just here
- * for older code.
- */
-#define insb(port, buf, ns) _insb((u8 __iomem *)((port)+pci_io_base), (buf), (ns))
-#define insw(port, buf, ns) _insw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns))
-#define insl(port, buf, nl) _insl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl))
-#else
+extern int in_8(const volatile unsigned char __iomem *addr);
+extern void out_8(volatile unsigned char __iomem *addr, int val);
+extern int in_le16(const volatile unsigned short __iomem *addr);
+extern int in_be16(const volatile unsigned short __iomem *addr);
+extern void out_le16(volatile unsigned short __iomem *addr, int val);
+extern void out_be16(volatile unsigned short __iomem *addr, int val);
+extern unsigned in_le32(const volatile unsigned __iomem *addr);
+extern unsigned in_be32(const volatile unsigned __iomem *addr);
+extern void out_le32(volatile unsigned __iomem *addr, int val);
+extern void out_be32(volatile unsigned __iomem *addr, int val);
+extern unsigned long in_le64(const volatile unsigned long __iomem *addr);
+extern unsigned long in_be64(const volatile unsigned long __iomem *addr);
+extern void out_le64(volatile unsigned long __iomem *addr, unsigned long val);
+extern void out_be64(volatile unsigned long __iomem *addr, unsigned long val);
+
+extern unsigned char __raw_readb(const volatile void __iomem *addr);
+extern unsigned short __raw_readw(const volatile void __iomem *addr);
+extern unsigned int __raw_readl(const volatile void __iomem *addr);
+extern unsigned long __raw_readq(const volatile void __iomem *addr);
+extern void __raw_writeb(unsigned char v, volatile void __iomem *addr);
+extern void __raw_writew(unsigned short v, volatile void __iomem *addr);
+extern void __raw_writel(unsigned int v, volatile void __iomem *addr);
+extern void __raw_writeq(unsigned long v, volatile void __iomem *addr);
+
+extern void memset_io(volatile void __iomem *addr, int c, unsigned long n);
+extern void memcpy_fromio(void *dest, const volatile void __iomem *src,
+ unsigned long n);
+extern void memcpy_toio(volatile void __iomem *dest, const void *src,
+ unsigned long n);
+
+#else /* CONFIG_PPC_ISERIES */
+
+#define in_8(addr) __in_8((addr))
+#define out_8(addr, val) __out_8((addr), (val))
+#define in_le16(addr) __in_le16((addr))
+#define in_be16(addr) __in_be16((addr))
+#define out_le16(addr, val) __out_le16((addr), (val))
+#define out_be16(addr, val) __out_be16((addr), (val))
+#define in_le32(addr) __in_le32((addr))
+#define in_be32(addr) __in_be32((addr))
+#define out_le32(addr, val) __out_le32((addr), (val))
+#define out_be32(addr, val) __out_be32((addr), (val))
+#define in_le64(addr) __in_le64((addr))
+#define in_be64(addr) __in_be64((addr))
+#define out_le64(addr, val) __out_le64((addr), (val))
+#define out_be64(addr, val) __out_be64((addr), (val))
static inline unsigned char __raw_readb(const volatile void __iomem *addr)
{
@@ -105,23 +114,11 @@ static inline void __raw_writeq(unsigned
{
*(volatile unsigned long __force *)addr = v;
}
-#define readb(addr) eeh_readb(addr)
-#define readw(addr) eeh_readw(addr)
-#define readl(addr) eeh_readl(addr)
-#define readq(addr) eeh_readq(addr)
-#define writeb(data, addr) eeh_writeb((data), (addr))
-#define writew(data, addr) eeh_writew((data), (addr))
-#define writel(data, addr) eeh_writel((data), (addr))
-#define writeq(data, addr) eeh_writeq((data), (addr))
#define memset_io(a,b,c) eeh_memset_io((a),(b),(c))
#define memcpy_fromio(a,b,c) eeh_memcpy_fromio((a),(b),(c))
#define memcpy_toio(a,b,c) eeh_memcpy_toio((a),(b),(c))
-#define inb(port) eeh_inb((unsigned long)port)
-#define outb(val, port) eeh_outb(val, (unsigned long)port)
-#define inw(port) eeh_inw((unsigned long)port)
-#define outw(val, port) eeh_outw(val, (unsigned long)port)
-#define inl(port) eeh_inl((unsigned long)port)
-#define outl(val, port) eeh_outl(val, (unsigned long)port)
+
+#endif /* CONFIG_PPC_ISERIES */
/*
* The insw/outsw/insl/outsl macros don't do byte-swapping.
@@ -132,12 +129,25 @@ #define insb(port, buf, ns) eeh_insb((po
#define insw(port, buf, ns) eeh_insw_ns((port), (buf), (ns))
#define insl(port, buf, nl) eeh_insl_ns((port), (buf), (nl))
-#endif
-
#define outsb(port, buf, ns) _outsb((u8 __iomem *)((port)+pci_io_base), (buf), (ns))
#define outsw(port, buf, ns) _outsw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns))
#define outsl(port, buf, nl) _outsl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl))
+#define readb(addr) eeh_readb(addr)
+#define readw(addr) eeh_readw(addr)
+#define readl(addr) eeh_readl(addr)
+#define readq(addr) eeh_readq(addr)
+#define writeb(data, addr) eeh_writeb((data), (addr))
+#define writew(data, addr) eeh_writew((data), (addr))
+#define writel(data, addr) eeh_writel((data), (addr))
+#define writeq(data, addr) eeh_writeq((data), (addr))
+#define inb(port) eeh_inb((unsigned long)port)
+#define outb(val, port) eeh_outb(val, (unsigned long)port)
+#define inw(port) eeh_inw((unsigned long)port)
+#define outw(val, port) eeh_outw(val, (unsigned long)port)
+#define inl(port) eeh_inl((unsigned long)port)
+#define outl(val, port) eeh_outl(val, (unsigned long)port)
+
#define readb_relaxed(addr) readb(addr)
#define readw_relaxed(addr) readw(addr)
#define readl_relaxed(addr) readl(addr)
@@ -258,7 +268,7 @@ #define iobarrier_w() eieio()
* and should not be used directly by device drivers. Use inb/readb
* instead.
*/
-static inline int in_8(const volatile unsigned char __iomem *addr)
+static inline int __in_8(const volatile unsigned char __iomem *addr)
{
int ret;
@@ -267,14 +277,14 @@ static inline int in_8(const volatile un
return ret;
}
-static inline void out_8(volatile unsigned char __iomem *addr, int val)
+static inline void __out_8(volatile unsigned char __iomem *addr, int val)
{
__asm__ __volatile__("sync; stb%U0%X0 %1,%0"
: "=m" (*addr) : "r" (val));
get_paca()->io_sync = 1;
}
-static inline int in_le16(const volatile unsigned short __iomem *addr)
+static inline int __in_le16(const volatile unsigned short __iomem *addr)
{
int ret;
@@ -283,7 +293,7 @@ static inline int in_le16(const volatile
return ret;
}
-static inline int in_be16(const volatile unsigned short __iomem *addr)
+static inline int __in_be16(const volatile unsigned short __iomem *addr)
{
int ret;
@@ -292,21 +302,21 @@ static inline int in_be16(const volatile
return ret;
}
-static inline void out_le16(volatile unsigned short __iomem *addr, int val)
+static inline void __out_le16(volatile unsigned short __iomem *addr, int val)
{
__asm__ __volatile__("sync; sthbrx %1,0,%2"
: "=m" (*addr) : "r" (val), "r" (addr));
get_paca()->io_sync = 1;
}
-static inline void out_be16(volatile unsigned short __iomem *addr, int val)
+static inline void __out_be16(volatile unsigned short __iomem *addr, int val)
{
__asm__ __volatile__("sync; sth%U0%X0 %1,%0"
: "=m" (*addr) : "r" (val));
get_paca()->io_sync = 1;
}
-static inline unsigned in_le32(const volatile unsigned __iomem *addr)
+static inline unsigned __in_le32(const volatile unsigned __iomem *addr)
{
unsigned ret;
@@ -315,7 +325,7 @@ static inline unsigned in_le32(const vol
return ret;
}
-static inline unsigned in_be32(const volatile unsigned __iomem *addr)
+static inline unsigned __in_be32(const volatile unsigned __iomem *addr)
{
unsigned ret;
@@ -324,21 +334,21 @@ static inline unsigned in_be32(const vol
return ret;
}
-static inline void out_le32(volatile unsigned __iomem *addr, int val)
+static inline void __out_le32(volatile unsigned __iomem *addr, int val)
{
__asm__ __volatile__("sync; stwbrx %1,0,%2" : "=m" (*addr)
: "r" (val), "r" (addr));
get_paca()->io_sync = 1;
}
-static inline void out_be32(volatile unsigned __iomem *addr, int val)
+static inline void __out_be32(volatile unsigned __iomem *addr, int val)
{
__asm__ __volatile__("sync; stw%U0%X0 %1,%0"
: "=m" (*addr) : "r" (val));
get_paca()->io_sync = 1;
}
-static inline unsigned long in_le64(const volatile unsigned long __iomem *addr)
+static inline unsigned long __in_le64(const volatile unsigned long __iomem *addr)
{
unsigned long tmp, ret;
@@ -358,7 +368,7 @@ static inline unsigned long in_le64(cons
return ret;
}
-static inline unsigned long in_be64(const volatile unsigned long __iomem *addr)
+static inline unsigned long __in_be64(const volatile unsigned long __iomem *addr)
{
unsigned long ret;
@@ -367,7 +377,7 @@ static inline unsigned long in_be64(cons
return ret;
}
-static inline void out_le64(volatile unsigned long __iomem *addr, unsigned long val)
+static inline void __out_le64(volatile unsigned long __iomem *addr, unsigned long val)
{
unsigned long tmp;
@@ -385,15 +395,13 @@ static inline void out_le64(volatile uns
get_paca()->io_sync = 1;
}
-static inline void out_be64(volatile unsigned long __iomem *addr, unsigned long val)
+static inline void __out_be64(volatile unsigned long __iomem *addr, unsigned long val)
{
__asm__ __volatile__("sync; std%U0%X0 %1,%0" : "=m" (*addr) : "r" (val));
get_paca()->io_sync = 1;
}
-#ifndef CONFIG_PPC_ISERIES
#include <asm/eeh.h>
-#endif
/**
* check_signature - find BIOS signatures
@@ -409,7 +417,6 @@ static inline int check_signature(const
const unsigned char *signature, int length)
{
int retval = 0;
-#ifndef CONFIG_PPC_ISERIES
do {
if (readb(io_addr) != *signature)
goto out;
@@ -419,7 +426,6 @@ #ifndef CONFIG_PPC_ISERIES
} while (length);
retval = 1;
out:
-#endif
return retval;
}
diff --git a/include/asm-powerpc/iseries/iseries_io.h b/include/asm-powerpc/iseries/iseries_io.h
deleted file mode 100644
index f29009b..0000000
--- a/include/asm-powerpc/iseries/iseries_io.h
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef _ASM_POWERPC_ISERIES_ISERIES_IO_H
-#define _ASM_POWERPC_ISERIES_ISERIES_IO_H
-
-
-#ifdef CONFIG_PPC_ISERIES
-#include <linux/types.h>
-/*
- * Created by Allan Trautman on Thu Dec 28 2000.
- *
- * Remaps the io.h for the iSeries Io
- * Copyright (C) 2000 Allan H Trautman, IBM Corporation
- *
- * 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
- *
- * Change Activity:
- * Created December 28, 2000
- * End Change Activity
- */
-
-#ifdef CONFIG_PCI
-extern u8 iSeries_Read_Byte(const volatile void __iomem * IoAddress);
-extern u16 iSeries_Read_Word(const volatile void __iomem * IoAddress);
-extern u32 iSeries_Read_Long(const volatile void __iomem * IoAddress);
-extern void iSeries_Write_Byte(u8 IoData, volatile void __iomem * IoAddress);
-extern void iSeries_Write_Word(u16 IoData, volatile void __iomem * IoAddress);
-extern void iSeries_Write_Long(u32 IoData, volatile void __iomem * IoAddress);
-
-extern void iSeries_memset_io(volatile void __iomem *dest, char x, size_t n);
-extern void iSeries_memcpy_toio(volatile void __iomem *dest, void *source,
- size_t n);
-extern void iSeries_memcpy_fromio(void *dest,
- const volatile void __iomem *source, size_t n);
-#else
-static inline u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress)
-{
- return 0xff;
-}
-
-static inline void iSeries_Write_Byte(u8 IoData,
- volatile void __iomem *IoAddress)
-{
-}
-#endif /* CONFIG_PCI */
-
-#endif /* CONFIG_PPC_ISERIES */
-#endif /* _ASM_POWERPC_ISERIES_ISERIES_IO_H */
--
1.4.2.1
^ permalink raw reply related
* Re: Linux on custom Xilinx board with PPC405 hangs on boot
From: Peter N. Andreasen @ 2006-09-20 9:16 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <36468a5c0609140713pb42f3f8n3578151b50a488f@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3822 bytes --]
I have a custom Xilinx FPGA board which is similar to ML300 but uses
Uartllite and does not have disk or display.
When I start the Linux kernel I end up with an exception during the probe
for Flash - I think.
I have added a bunch of printk lines in order to see what is happening but I
am a little stuck at the moment.
The Flash chip is an AM29LV320D 4Mbyte in 16-bit access mode, and it sits on
address 0xFF80'0000
This is what I get on my terminal. I would be happy to hear your advice.
Peter
loaded at: 00400000 004CF1E0
board data at: 004CC138 004CC150
relocated to: 004052F4 0040530C
zimage at: 00405801 00472CFB
initrd at: 00473000 004CB2FF
avail ram: 004D0000 02000000
Linux/PPC load: root=/dev/ram rw console=ttl0
Uncompressing Linux...done.
Now booting the kernel
id mach(): done
MMU:enter
MMU:hw init
MMU:mapin
MMU:mapin_ram done
MMU:setio
MMU:exit
Linux version 2.4.26 (pna@glazedevel) (gcc version 3.4.1) #50 Wed Sep 20
11:06:12 CEST 2006
setup_arch: enter
setup_arch: bootmem
Xilinx Virtex-II Pro port (C) 2002 MontaVista Software, Inc. (
source@mvista.com)
arch: exit
On node 0 totalpages: 8192
zone(0): 8192 pages.
zone(1): 0 pages.
zone(2): 0 pages.
Kernel command line: root=/dev/ram rw console=ttl0
(start) init/main.c: parse_options
(end) parse_options
(start) arch/ppc/mm/pgtable.c: __ioremap
(end) arch/ppc/mm/pgtable.c: __ioremap
Xilinx INTC #0 at 0x81200000 mapped to 0xFDFFF000
(start) arch/ppc/mm/pgtable.c: __ioremap
(end) arch/ppc/mm/pgtable.c: __ioremap
Calibrating delay loop... 287.53 BogoMIPS
Memory: 30924k available (776k kernel code, 276k data, 44k init, 0k highmem)
Dentry cache hash table entries: 4096 (order: 3, 32768 bytes)
Inode cache hash table entries: 2048 (order: 2, 16384 bytes)
Mount cache hash table entries: 512 (order: 0, 4096 bytes)
Buffer cache hash table entries: 1024 (order: 0, 4096 bytes)
Page-cache hash table entries: 8192 (order: 3, 32768 bytes)
POSIX conformance testing by UNIFIX
(start) init/main.c: init
(start) init/main.c: do_basic_setup
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Initializing RT netlink socket
(start) init/main.c: do_initcalls
Starting kswapd
devfs: v1.12c (20020818) Richard Gooch (rgooch@atnf.csiro.au)
devfs: boot_options: 0x1
JFFS version 1.0, (C) 1999, 2000 Axis Communications AB
JFFS2 version 2.1. (C) 2001 Red Hat, Inc., designed by Axis Communications
AB.
Generic RTC Driver v1.07
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
loop: loaded (max 8 devices)
(start) drivers/mtd/maps/physmap.c: init_physmap
physmap flash device: 4000000 at ff800000
(start) arch/ppc/mm/pgtable.c: __ioremap
(end) arch/ppc/mm/pgtable.c: __ioremap
(start) drivers/mtd/chips/chipreg.c: do_map_probe
(start) drivers/mtd/chips/chipreg.c: get_mtd_chip_driver
(end) drivers/mtd/chips/chipreg.c: get_mtd_chip_driver
(after get_mtd_chip_driver) drivers/mtd/chips/chipreg.c: do_map_probe
(start) drivers/mtd/chips/gen_probe.c: mtd_do_chip_probe
(start) drivers/mtd/chips/gen_probe.c: genprobe_ident_chips
Instruction machine check in kernel mode.
Oops: machine check, sig: 7
NIP: C00A2960 XER: 40000000 LR: C009CBD8 SP: C04D9D90 REGS: c04d9ce0 TRAP:
0200 Not tainted
MSR: 00009030 EE: 1 PR: 0 FP: 0 ME: 1 IR/DR: 11
TASK = c04d8000[1] 'swapper' Last syscall: 120
last math 00000000 last altivec 00000000
GPR00: C00A2958 C04D9D90 C04D8000 C00DC1C8 000000F0 00400000 C04D9DD0
C00DB387
GPR08: 00000002 C307D000 C0176360 00000001 C00F0000 000057E0 80001040
80000820
GPR16: 00001020 00000840 10021000 08040800 C00D0000 C00EAC18 C00D0000
00000000
GPR24: C00C0000 00000001 C04D9DD0 C04D9E10 C04D9E10 00400000 C04D9DD0
C00DC1C8
Call backtrace:
C009CE80 C00A26D0 C009D3A0 C009C750 C00E9BB0 C00024F4 C0005ED4
Kernel panic: Attempted to kill init!
<0>Rebooting in 180 seconds..
[-- Attachment #2: Type: text/html, Size: 4398 bytes --]
^ permalink raw reply
* Re: JTAG debugger for MPC82xx/MPC83xx
From: Kelsey Dawes @ 2006-09-20 6:20 UTC (permalink / raw)
To: Steven Hein; +Cc: linuxppc-embedded
In-Reply-To: <4510664B.2020304@sgi.com>
On Tue, Sep 19, 2006 at 04:51:07PM -0500, Steven Hein wrote:
> Hi,
Hi,
<SNIP>
> We will definitely want one with a network connection,
> and will will run the debugger software from a Linux host.
> Ideally, we would also like one that provides a library
> to allow us to write apps to function the debugger.
>
> Can anyone comment on what JTAG debugger they are using,
> and how have your experiences been? Are there any other
> good options besides the ones mentioned above.
> I'd appreciate any input.
>
> Thanks!
> Steve
We've been using the BDI-2000 from abatron on an 8248 board. It's done
everything we've needed to do so far.
It has a serial interface, but we use the ethernet port.
Remote debug works well, and other usual tasks also - flash programming, etc.
Can't comment about developing apps for the debugger, sorry.
-kelsey
^ permalink raw reply
* Re: [POWERPC] convert string i/o operations to C
From: Segher Boessenkool @ 2006-09-20 0:29 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Stephen Rothwell, paulus, ppc-dev
In-Reply-To: <1158710938.6002.223.camel@localhost.localdomain>
>> Why? If "ns" <= 0 there is no I/O done...
>
> For the sake of being paranoid :) What happens on x86 if you do a
> rep ;
> insw with a 0 count ?
Nothing, except wasting energy.
Segher
^ permalink raw reply
* Re: [POWERPC] convert string i/o operations to C
From: Michael Ellerman @ 2006-09-20 4:38 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: ppc-dev, paulus
In-Reply-To: <20060920133532.ce818ab7.sfr@canb.auug.org.au>
[-- Attachment #1: Type: text/plain, Size: 851 bytes --]
On Wed, 2006-09-20 at 13:35 +1000, Stephen Rothwell wrote:
> This produces essentially the same code and will make the iSeries i/o
> consolidation easier.
A bit more white space would be nice :D, eg:
> +void _insb(volatile u8 __iomem *port, void *buf, long count)
> +{
> + u8 *tbuf = buf;
> + u8 tmp;
> +
> + if (unlikely(count <= 0))
> + return;
> + asm volatile("sync");
> + do {
> + tmp = *port;
> + asm volatile("eieio");
> + *tbuf++ = tmp;
> + } while (--count != 0);
> + asm volatile("twi 0,%0,0; isync" : : "r" (tmp));
> +}
> +EXPORT_SYMBOL(_insb);
cheers
--
Michael Ellerman
OzLabs, IBM Australia Development Lab
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 191 bytes --]
^ permalink raw reply
* Re: [PATCH] Start arch/powerpc/boot code reorganization
From: Josh Boyer @ 2006-09-20 3:10 UTC (permalink / raw)
To: Mark A. Greer; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <20060920012042.GA28489@mag.az.mvista.com>
On Tue, 2006-09-19 at 18:20 -0700, Mark A. Greer wrote:
> Paul,
>
> Regarding our earlier conversation about ft_translate_addr and
> ft_parentize. I just realized that on IRC today Matt Porter pointed
> out that using the "reg" property in ns16550.c is wrong. We--several
> of us on #mklinux--decided that the "address" property is the correct
> thing to use because we should really be using a virtual address from
> the fw (bootwrapper has no ioremap). So, unless someone objects,
> we'll all add the "address" property to our uart device nodes in our
> fdt's (if they can be used as the console).
An example of where this is needed is 4xx. Lots of boards rely on the
openbios mapping created for the UART in the zImage wrapper. However,
the kernel doesn't rely on that, and the "reg" property of the .dts
should contain the physical address.
It was pointed out on IRC that the "address" property is defined in the
OF spec for specifying virtual address mappings. This is exactly what
we need in that it allows the zImage wrapper to use the fw defined UART
mapping, but the kernel still gets the real physical address later on.
And other things that don't use zImage wrappers, like u-boot, can simply
ignore the "address" property defined within the UART node.
The options that were discussed were this, hardcoding, or implementing
ioremap in the bootwraper. This seemed to be the most elegant way of
doing things.
josh
^ permalink raw reply
* [POWERPC] convert string i/o operations to C
From: Stephen Rothwell @ 2006-09-20 3:35 UTC (permalink / raw)
To: paulus; +Cc: ppc-dev
In-Reply-To: <20060919222351.d27a1a06.sfr@canb.auug.org.au>
This produces essentially the same code and will make the iSeries i/o
consolidation easier.
The count parameter is changed to long since that will produce the same
(better) code on 32 and 64 bit builds.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
arch/powerpc/kernel/Makefile | 2 -
arch/powerpc/kernel/io.c | 117 +++++++++++++++++++++++++++++++++++++++
arch/powerpc/kernel/misc.S | 95 --------------------------------
arch/powerpc/kernel/ppc_ksyms.c | 7 --
include/asm-powerpc/io.h | 12 ++--
include/asm-ppc/io.h | 12 ++--
6 files changed, 130 insertions(+), 115 deletions(-)
This version has lots more C code. Paulus also said that the "sync"s
could go after the check for count <= 0.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 8b3f4fa..8b133af 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -51,7 +51,7 @@ extra-$(CONFIG_8xx) := head_8xx.o
extra-y += vmlinux.lds
obj-y += time.o prom.o traps.o setup-common.o \
- udbg.o misc.o
+ udbg.o misc.o io.o
obj-$(CONFIG_PPC32) += entry_32.o setup_32.o misc_32.o
obj-$(CONFIG_PPC64) += misc_64.o dma_64.o iommu.o
obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o
diff --git a/arch/powerpc/kernel/io.c b/arch/powerpc/kernel/io.c
new file mode 100644
index 0000000..80a3209
--- /dev/null
+++ b/arch/powerpc/kernel/io.c
@@ -0,0 +1,117 @@
+/*
+ * I/O string operations
+ * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
+ * Copyright (C) 2006 IBM Corporation
+ *
+ * Largely rewritten by Cort Dougan (cort@cs.nmt.edu)
+ * and Paul Mackerras.
+ *
+ * Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com)
+ * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com)
+ *
+ * Rewritten in C by Stephen Rothwell.
+ *
+ * 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.
+ */
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/compiler.h>
+#include <linux/module.h>
+
+#include <asm/io.h>
+
+void _insb(volatile u8 __iomem *port, void *buf, long count)
+{
+ u8 *tbuf = buf;
+ u8 tmp;
+
+ if (unlikely(count <= 0))
+ return;
+ asm volatile("sync");
+ do {
+ tmp = *port;
+ asm volatile("eieio");
+ *tbuf++ = tmp;
+ } while (--count != 0);
+ asm volatile("twi 0,%0,0; isync" : : "r" (tmp));
+}
+EXPORT_SYMBOL(_insb);
+
+void _outsb(volatile u8 __iomem *port, const void *buf, long count)
+{
+ const u8 *tbuf = buf;
+
+ if (unlikely(count <= 0))
+ return;
+ asm volatile("sync");
+ do {
+ *port = *tbuf++;
+ } while (--count != 0);
+ asm volatile("sync");
+}
+EXPORT_SYMBOL(_outsb);
+
+void _insw_ns(volatile u16 __iomem *port, void *buf, long count)
+{
+ u16 *tbuf = buf;
+ u16 tmp;
+
+ if (unlikely(count <= 0))
+ return;
+ asm volatile("sync");
+ do {
+ tmp = *port;
+ asm volatile("eieio");
+ *tbuf++ = tmp;
+ } while (--count != 0);
+ asm volatile("twi 0,%0,0; isync" : : "r" (tmp));
+}
+EXPORT_SYMBOL(_insw_ns);
+
+void _outsw_ns(volatile u16 __iomem *port, const void *buf, long count)
+{
+ const u16 *tbuf = buf;
+
+ if (unlikely(count <= 0))
+ return;
+ asm volatile("sync");
+ do {
+ *port = *tbuf++;
+ } while (--count != 0);
+ asm volatile("sync");
+}
+EXPORT_SYMBOL(_outsw_ns);
+
+void _insl_ns(volatile u32 __iomem *port, void *buf, long count)
+{
+ u32 *tbuf = buf;
+ u32 tmp;
+
+ if (unlikely(count <= 0))
+ return;
+ asm volatile("sync");
+ do {
+ tmp = *port;
+ asm volatile("eieio");
+ *tbuf++ = tmp;
+ } while (--count != 0);
+ asm volatile("twi 0,%0,0; isync" : : "r" (tmp));
+}
+EXPORT_SYMBOL(_insl_ns);
+
+void _outsl_ns(volatile u32 __iomem *port, const void *buf, long count)
+{
+ const u32 *tbuf = buf;
+
+ if (unlikely(count <= 0))
+ return;
+ asm volatile("sync");
+ do {
+ *port = *tbuf++;
+ } while (--count != 0);
+ asm volatile("sync");
+}
+EXPORT_SYMBOL(_outsl_ns);
diff --git a/arch/powerpc/kernel/misc.S b/arch/powerpc/kernel/misc.S
index 6feb391..330c9dc 100644
--- a/arch/powerpc/kernel/misc.S
+++ b/arch/powerpc/kernel/misc.S
@@ -43,98 +43,3 @@ _GLOBAL(add_reloc_offset)
add r3,r3,r5
mtlr r0
blr
-
-/*
- * I/O string operations
- *
- * insb(port, buf, len)
- * outsb(port, buf, len)
- * insw(port, buf, len)
- * outsw(port, buf, len)
- * insl(port, buf, len)
- * outsl(port, buf, len)
- * insw_ns(port, buf, len)
- * outsw_ns(port, buf, len)
- * insl_ns(port, buf, len)
- * outsl_ns(port, buf, len)
- *
- * The *_ns versions don't do byte-swapping.
- */
-_GLOBAL(_insb)
- sync
- cmpwi 0,r5,0
- mtctr r5
- subi r4,r4,1
- blelr-
-00: lbz r5,0(r3)
- eieio
- stbu r5,1(r4)
- bdnz 00b
- twi 0,r5,0
- isync
- blr
-
-_GLOBAL(_outsb)
- cmpwi 0,r5,0
- mtctr r5
- subi r4,r4,1
- blelr-
- sync
-00: lbzu r5,1(r4)
- stb r5,0(r3)
- bdnz 00b
- sync
- blr
-
-_GLOBAL(_insw_ns)
- sync
- cmpwi 0,r5,0
- mtctr r5
- subi r4,r4,2
- blelr-
-00: lhz r5,0(r3)
- eieio
- sthu r5,2(r4)
- bdnz 00b
- twi 0,r5,0
- isync
- blr
-
-_GLOBAL(_outsw_ns)
- cmpwi 0,r5,0
- mtctr r5
- subi r4,r4,2
- blelr-
- sync
-00: lhzu r5,2(r4)
- sth r5,0(r3)
- bdnz 00b
- sync
- blr
-
-_GLOBAL(_insl_ns)
- sync
- cmpwi 0,r5,0
- mtctr r5
- subi r4,r4,4
- blelr-
-00: lwz r5,0(r3)
- eieio
- stwu r5,4(r4)
- bdnz 00b
- twi 0,r5,0
- isync
- blr
-
-_GLOBAL(_outsl_ns)
- cmpwi 0,r5,0
- mtctr r5
- subi r4,r4,4
- blelr-
- sync
-00: lwzu r5,4(r4)
- stw r5,0(r3)
- bdnz 00b
- sync
- blr
-
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 75429e5..807193a 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -95,13 +95,6 @@ #ifdef CONFIG_PPC64
EXPORT_SYMBOL(copy_4K_page);
#endif
-EXPORT_SYMBOL(_insb);
-EXPORT_SYMBOL(_outsb);
-EXPORT_SYMBOL(_insw_ns);
-EXPORT_SYMBOL(_outsw_ns);
-EXPORT_SYMBOL(_insl_ns);
-EXPORT_SYMBOL(_outsl_ns);
-
#if defined(CONFIG_PPC32) && (defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE))
EXPORT_SYMBOL(ppc_ide_md);
#endif
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index 51a5987..57e7d14 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -143,12 +143,12 @@ #define readw_relaxed(addr) readw(addr)
#define readl_relaxed(addr) readl(addr)
#define readq_relaxed(addr) readq(addr)
-extern void _insb(volatile u8 __iomem *port, void *buf, int ns);
-extern void _outsb(volatile u8 __iomem *port, const void *buf, int ns);
-extern void _insw_ns(volatile u16 __iomem *port, void *buf, int ns);
-extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, int ns);
-extern void _insl_ns(volatile u32 __iomem *port, void *buf, int nl);
-extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, int nl);
+extern void _insb(volatile u8 __iomem *port, void *buf, long count);
+extern void _outsb(volatile u8 __iomem *port, const void *buf, long count);
+extern void _insw_ns(volatile u16 __iomem *port, void *buf, long count);
+extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, long count);
+extern void _insl_ns(volatile u32 __iomem *port, void *buf, long count);
+extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, long count);
static inline void mmiowb(void)
{
diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h
index 9fac420..3d9a9e6 100644
--- a/include/asm-ppc/io.h
+++ b/include/asm-ppc/io.h
@@ -327,12 +327,12 @@ #define outw_p(val, port) outw((val), (p
#define inl_p(port) inl((port))
#define outl_p(val, port) outl((val), (port))
-extern void _insb(volatile u8 __iomem *port, void *buf, int ns);
-extern void _outsb(volatile u8 __iomem *port, const void *buf, int ns);
-extern void _insw_ns(volatile u16 __iomem *port, void *buf, int ns);
-extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, int ns);
-extern void _insl_ns(volatile u32 __iomem *port, void *buf, int nl);
-extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, int nl);
+extern void _insb(volatile u8 __iomem *port, void *buf, long count);
+extern void _outsb(volatile u8 __iomem *port, const void *buf, long count);
+extern void _insw_ns(volatile u16 __iomem *port, void *buf, long count);
+extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, long count);
+extern void _insl_ns(volatile u32 __iomem *port, void *buf, long count);
+extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, long count);
#define IO_SPACE_LIMIT ~0
--
1.4.2.1
^ permalink raw reply related
* Re: [PATCH] Remove powerpc specific parts of 3c509 driver
From: Segher Boessenkool @ 2006-09-20 1:41 UTC (permalink / raw)
To: Linas Vepstas; +Cc: akpm, Stephen Rothwell, ppc-dev, netdev, jgarzik
In-Reply-To: <20060920011750.GS29167@austin.ibm.com>
> Well, I'm having trouble thinking of other busses that have as strong
> a sense of the "address-data" style I/O as PCI. Busses like scsi and
> ide are primarily "command-data" or "data-data" in style. Only the
> address-data style busses need readl/writel-style routines.
SBUS, JBUS, VMEbus, NuBus, RapidIO, eBus, various SoC busses, to name
a few. There are many, and most are big-endian.
Segher
^ permalink raw reply
* Re: [PATCH] Start arch/powerpc/boot code reorganization
From: Mark A. Greer @ 2006-09-20 1:28 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <20060920012042.GA28489@mag.az.mvista.com>
On Tue, Sep 19, 2006 at 06:20:42PM -0700, Mark A. Greer wrote:
> Paul,
>
> Regarding our earlier conversation about ft_translate_addr and
...
BTW, the only changes to your patch would be removing translate_addr from
dt_ops in ops.h and removing the "dt_ops.translate_addr = NULL;" line
in of.c.
I'll respin the other patches.
Mark
^ permalink raw reply
* Re: [PATCH] Start arch/powerpc/boot code reorganization
From: Mark A. Greer @ 2006-09-20 1:20 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <17680.30367.157642.674242@cargo.ozlabs.ibm.com>
Paul,
Regarding our earlier conversation about ft_translate_addr and
ft_parentize. I just realized that on IRC today Matt Porter pointed
out that using the "reg" property in ns16550.c is wrong. We--several
of us on #mklinux--decided that the "address" property is the correct
thing to use because we should really be using a virtual address from
the fw (bootwrapper has no ioremap). So, unless someone objects,
we'll all add the "address" property to our uart device nodes in our
fdt's (if they can be used as the console).
A couple consequences, if that happens:
- It removes the requirement for ft_translate_addr (and
dt_ops.translate_addr) in the bootwrapper. That cleans up
flatdevtree_misc.c a lot.
- Since ft_find_node/device will be the only caller of ft_parentize
now, that may change your plans for ft_parentize.
Do you have any objections to using "address" property instead of "reg"?
Mark
^ permalink raw reply
* Re: [PATCH] Remove powerpc specific parts of 3c509 driver
From: Jeff Garzik @ 2006-09-20 1:18 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: akpm, Stephen Rothwell, ppc-dev, netdev
In-Reply-To: <1192ED41-329C-4CB0-AD87-B3BF62EC4337@kernel.crashing.org>
Segher Boessenkool wrote:
>>> Sure, PCI busses are little-endian. But is readX()/writeX() for PCI
>>> only?
>>
>> Yes.
>>
>> For other buses, use foo_writel(), etc.
>
> Can this please be documented then? Never heard this before...
You have come late to the party. This has been the case for many, many
years.
And there is no point in a massive rename to pci_writel(), either.
Jeff
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox