mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-01 13:20:30 +00:00
Geert's PPC support and Hydra driver
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@430 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
b6f6b537d4
commit
1ade24f919
15 files changed
+254
-7
No files matched your search
@@ -13,6 +13,10 @@ ask CVS about it:
|
||||
for example:
|
||||
cvs diff -r V2-0-0 -r V2-0-1 -u
|
||||
|
||||
2.3.1 (199904??)
|
||||
All: Now compiles on PPC
|
||||
Module i2c-hydra: NEW
|
||||
|
||||
2.3.0 (19990422)
|
||||
All: Many, many changes and improvements
|
||||
All: Many small bugs and problems removed
|
||||
|
||||
@@ -24,6 +24,8 @@ problems.
|
||||
Author of the i2c-via and sis5595 drivers.
|
||||
* Mark D. Studebaker <mds@eng.paradyne.com>
|
||||
Author of the i2c-ali15x3 driver, as well as other drivers.
|
||||
* Geert Uytterhoeven <geert@linux-m68k.org>
|
||||
Author of the i2c-hydra driver.
|
||||
* Adrian Baugh <adrian.baugh@keble.ox.ac.uk>
|
||||
Author of wmsensors (get it at http://users.ox.ac.uk/~kebl0850/wmlm78);
|
||||
he also tested lots of things, and helped us out on several occasions.
|
||||
|
||||
@@ -169,5 +169,5 @@ USEFUL PROGRAMS
|
||||
The prog subdirectory contains lots of useful programs, many of which are
|
||||
not installed. doc/progs contains some documentation for each of them.
|
||||
Most important are prog/mkdev/mkdev.sh, which creates /dev/i2c-* files,
|
||||
and prog/detect/dectect.pl, which tries to detect what adapters are
|
||||
and prog/detect/detect.pl, which tries to detect what adapters are
|
||||
present on your system.
|
||||
@@ -3,6 +3,8 @@ Many, many things. Most notably:
|
||||
KERNEL MODULES
|
||||
==============
|
||||
|
||||
* `modprobe w83781d force_w38781d=0,0x49' let to strange beeping on Frodo's
|
||||
computer. Why?
|
||||
* Increase use count of adapter driver if directory of chip is entered
|
||||
* maxilife.c: Introduce new insmod variables
|
||||
* maxilife.c: Round REG_TO_VID correctly
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
Kernel driver `i2c-hydra.o'
|
||||
|
||||
Status: Complete and somewhat tested
|
||||
|
||||
Supported adapters:
|
||||
* Apple `Hydra' Mac I/O
|
||||
Datasheet: Publicly available (?)
|
||||
|
||||
Author: Geert Uytterhoeven <geert@linux-m68k.org>
|
||||
|
||||
|
||||
Module Parameters
|
||||
-----------------
|
||||
|
||||
(none)
|
||||
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
i2c-hydra is an i2c bus driver for CHRP motherboards with the Apple Hydra Mac
|
||||
I/O.
|
||||
|
||||
Your /proc/pci or lspci listing must show this :
|
||||
|
||||
Unknown class: Apple Hydra (rev 2)
|
||||
|
||||
To install this driver, simply do
|
||||
# modprobe i2c-hydra
|
||||
|
||||
@@ -183,7 +183,7 @@ Module i2c.o
|
||||
============
|
||||
|
||||
This is Simon Vogl's i2c module (this one is different from the i2c module
|
||||
included in kernels around 1.2.120!).
|
||||
included in kernels around 2.1.120!).
|
||||
|
||||
A driver
|
||||
--------
|
||||
|
||||
@@ -48,3 +48,9 @@ Here come the changes:
|
||||
* Removed files: object files and executables
|
||||
Everywhere, remakeable files are removed, to keep the source distribution
|
||||
small and lean.
|
||||
|
||||
* algo-bit.h: Removed comment typo (Geert)
|
||||
|
||||
* bit-lp.c: Added #include <linux/stddef> (Geert)
|
||||
|
||||
* i2c.h: Added HW_B_HYDRA, removed two comment typos (Geert)
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
struct bit_adapter {
|
||||
char name[32]; /* give it a nice name */
|
||||
unsigned int id; /* not used yet, maybe later */
|
||||
void *data; /* private data for lolevel routines */
|
||||
void *data; /* private data for lowlevel routines */
|
||||
void (*setsda) (void *data, int state);
|
||||
void (*setscl) (void *data, int state);
|
||||
int (*getsda) (void *data);
|
||||
|
||||
@@ -24,6 +24,7 @@ static char rcsid[] = "$Id: bit-lp.c,v 1.6 1998/12/30 08:36:08 i2c Exp i2c $";
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/module.h>
|
||||
#include <asm/io.h>
|
||||
#include <linux/stddef.h>
|
||||
|
||||
#include "i2c.h"
|
||||
#include "algo-bit.h"
|
||||
|
||||
@@ -339,11 +339,12 @@ extern int i2c_adapter_id(struct i2c_adapter *adap);
|
||||
#define HW_B_BT848 0x05 /* BT848 video boards */
|
||||
#define HW_B_WNV 0x06 /* Winnov Videums */
|
||||
#define HW_B_VIA 0x07 /* Via vt82c586b */
|
||||
#define HW_B_HYDRA 0x08 /* Apple Hydra Mac I/O */
|
||||
|
||||
/* --- PCF 8584 based algorithms */
|
||||
#define HW_P_LP 0x00 /* Parallel port interface */
|
||||
#define HW_P_ISA 0x01 /* generic ISA Bus inteface card */
|
||||
#define HW_P_ELEK 0x02 /* Elektor ISA Bus inteface card */
|
||||
#define HW_P_ISA 0x01 /* generic ISA Bus interface card */
|
||||
#define HW_P_ELEK 0x02 /* Elektor ISA Bus interface card */
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,8 @@ MODULE_DIR := kernel/busses
|
||||
# Regrettably, even 'simply expanded variables' will not put their currently
|
||||
# defined value verbatim into the command-list of rules...
|
||||
KERNELBUSSESTARGETS := $(MODULE_DIR)/i2c-piix4.o $(MODULE_DIR)/i2c-isa.o \
|
||||
$(MODULE_DIR)/i2c-via.o $(MODULE_DIR)/i2c-ali15x3.o
|
||||
$(MODULE_DIR)/i2c-via.o $(MODULE_DIR)/i2c-ali15x3.o \
|
||||
$(MODULE_DIR)/i2c-hydra.o
|
||||
|
||||
KERNELBUSSESOLD := bit-via.o bit-mb.o isa.o piix4.o
|
||||
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
i2c-hydra.c - Part of lm_sensors, Linux kernel modules
|
||||
for hardware monitoring
|
||||
|
||||
i2c Support for the Apple `Hydra' Mac I/O
|
||||
|
||||
Copyright (c) 1999 Geert Uytterhoeven <geert@linux-m68k.org>
|
||||
|
||||
Based on i2c Support for Via Technologies 82C586B South Bridge
|
||||
Copyright (c) 1998, 1999 Kyösti Mälkki <kmalkki@cc.hut.fi>
|
||||
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/pci.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/system.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#include "i2c.h"
|
||||
#include "algo-bit.h"
|
||||
|
||||
/* PCI device */
|
||||
#define VENDOR PCI_VENDOR_ID_APPLE
|
||||
#define DEVICE PCI_DEVICE_ID_APPLE_HYDRA
|
||||
|
||||
#define HYDRA_CACHE_PD 0x00000030
|
||||
|
||||
#define HYDRA_CPD_PD0 0x00000001 /* CachePD lines */
|
||||
#define HYDRA_CPD_PD1 0x00000002
|
||||
#define HYDRA_CPD_PD2 0x00000004
|
||||
#define HYDRA_CPD_PD3 0x00000008
|
||||
|
||||
#define HYDRA_SCLK HYDRA_CPD_PD0
|
||||
#define HYDRA_SDAT HYDRA_CPD_PD1
|
||||
#define HYDRA_SCLK_OE 0x00000010
|
||||
#define HYDRA_SDAT_OE 0x00000020
|
||||
|
||||
static unsigned long hydra_base;
|
||||
|
||||
static inline void pdregw(u32 val)
|
||||
{
|
||||
writel(val, hydra_base+HYDRA_CACHE_PD);
|
||||
}
|
||||
|
||||
static inline u32 pdregr(void)
|
||||
{
|
||||
u32 val = readl(hydra_base+HYDRA_CACHE_PD);
|
||||
return val;
|
||||
}
|
||||
|
||||
static void bit_hydra_setscl(void *data, int state)
|
||||
{
|
||||
u32 val = pdregr();
|
||||
if (state)
|
||||
val &= ~ HYDRA_SCLK_OE;
|
||||
else {
|
||||
val &= ~HYDRA_SCLK;
|
||||
val |= HYDRA_SCLK_OE;
|
||||
}
|
||||
pdregw(val);
|
||||
}
|
||||
|
||||
static void bit_hydra_setsda(void *data, int state)
|
||||
{
|
||||
u32 val = pdregr();
|
||||
if (state)
|
||||
val &= ~ HYDRA_SDAT_OE;
|
||||
else {
|
||||
val &= ~HYDRA_SDAT;
|
||||
val |= HYDRA_SDAT_OE;
|
||||
}
|
||||
pdregw(val);
|
||||
}
|
||||
|
||||
static int bit_hydra_getscl(void *data)
|
||||
{
|
||||
return (pdregr() & HYDRA_SCLK) != 0;
|
||||
}
|
||||
|
||||
static int bit_hydra_getsda(void *data)
|
||||
{
|
||||
return (pdregr() & HYDRA_SDAT) != 0;
|
||||
}
|
||||
|
||||
static int bit_hydra_reg(struct i2c_client *client)
|
||||
{
|
||||
MOD_INC_USE_COUNT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bit_hydra_unreg(struct i2c_client *client)
|
||||
{
|
||||
MOD_DEC_USE_COUNT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
struct bit_adapter bit_hydra_ops = {
|
||||
"Hydra i2c",
|
||||
HW_B_HYDRA,
|
||||
NULL,
|
||||
bit_hydra_setsda,
|
||||
bit_hydra_setscl,
|
||||
bit_hydra_getsda,
|
||||
bit_hydra_getscl,
|
||||
bit_hydra_reg,
|
||||
bit_hydra_unreg,
|
||||
5, 5, 100, /*waits, timeout */
|
||||
};
|
||||
|
||||
|
||||
static int find_hydra(void)
|
||||
{
|
||||
struct pci_dev *dev;
|
||||
|
||||
if (!pci_present())
|
||||
return -ENODEV;
|
||||
|
||||
dev = pci_find_device(VENDOR, DEVICE, NULL);
|
||||
|
||||
if (!dev) {
|
||||
printk("Hydra not found\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
hydra_base = (unsigned long)ioremap(dev->base_address[0], 0x100);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int init_i2c_hydra(void)
|
||||
{
|
||||
if (find_hydra() < 0) {
|
||||
printk("Error while reading PCI configuration\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
pdregw(0); /* clear SCLK_OE and SDAT_OE */
|
||||
|
||||
if (i2c_bit_add_bus(&bit_hydra_ops) == 0) {
|
||||
printk("Hydra i2c: Module succesfully loaded\n");
|
||||
return 0;
|
||||
} else {
|
||||
iounmap((void *)hydra_base);
|
||||
printk("Hydra i2c: Algo-bit error, couldn't register bus\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MODULE
|
||||
MODULE_AUTHOR("Geert Uytterhoeven <geert@linux-m68k.org>");
|
||||
MODULE_DESCRIPTION("i2c for Apple Hydra Mac I/O");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return init_i2c_hydra();
|
||||
}
|
||||
|
||||
void cleanup_module(void)
|
||||
{
|
||||
i2c_bit_del_bus(&bit_hydra_ops);
|
||||
if (hydra_base) {
|
||||
pdregw(0); /* clear SCLK_OE and SDAT_OE */
|
||||
iounmap((void *)hydra_base);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/stddef.h>
|
||||
#include <asm/system.h>
|
||||
|
||||
#include "i2c.h"
|
||||
#ifdef I2C_SPINLOCK
|
||||
|
||||
@@ -78,6 +78,14 @@ use vars qw(@pci_adapters @chip_ids @undetectable_adapters);
|
||||
driver => "i2c-ali15x3",
|
||||
match => sub { $_[0] =~ /^SMBus ALI15X3 adapter at [0-9,a-f]{4}/ },
|
||||
}
|
||||
{
|
||||
vendid => 0x106b,
|
||||
devid => 0x000e,
|
||||
func => 0,
|
||||
procid => "Apple Computer Inc. Hydra Mac I/O",
|
||||
driver => "i2c-hydra",
|
||||
match => sub { $_[0] =~ /^Hydra i2c/ },
|
||||
},
|
||||
);
|
||||
|
||||
use subs qw(lm78_detect lm78_isa_detect lm78_alias_detect lm75_detect
|
||||
|
||||
+8
-1
@@ -22,11 +22,16 @@
|
||||
#include <unistd.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
|
||||
/* To keep glibc2 happy */
|
||||
#ifdef __GLIBC__
|
||||
#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ == 0
|
||||
#include <sys/perm.h>
|
||||
#endif
|
||||
|
||||
#ifdef __powerpc__
|
||||
unsigned long isa_io_base = 0; /* XXX for now */
|
||||
#endif /* __powerpc__ */
|
||||
|
||||
char hexchar(int i)
|
||||
{
|
||||
if ((i >= 0) && (i <= 9))
|
||||
@@ -93,6 +98,7 @@ int main(int argc, char *argv[])
|
||||
fprintf(stderr," You have five seconds to reconsider and press CTRL-C!\n\n");
|
||||
sleep(5);
|
||||
|
||||
#ifndef __powerpc__
|
||||
if ((datareg < 0x400) && (datareg < 0x400)) {
|
||||
if(ioperm(datareg,1,1)) {
|
||||
fprintf(stderr,"Error: Could not ioperm() data register!\n");
|
||||
@@ -108,6 +114,7 @@ int main(int argc, char *argv[])
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
printf(" 0 1 2 3 4 5 6 7 8 9 a b c d e f\n");
|
||||
for (i = 0; i < 256; i+=16) {
|
||||
|
||||
Reference in new issue
Block a user