Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

feature.c File Reference

#include <linux/types.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <asm/spinlock.h>
#include <asm/errno.h>
#include <asm/ohare.h>
#include <asm/heathrow.h>
#include <asm/keylargo.h>
#include <asm/uninorth.h>
#include <asm/io.h>
#include <asm/prom.h>
#include <asm/feature.h>

Include dependency graph for feature.c:

Go to the source code of this file.

Defines

#define MAX_FEATURE_CONTROLLERS   2
#define MAX_FEATURE_OFFSET   0x100
#define FREG(c, r)   (&(((c)->reg)[(r)>>2]))
#define KL_FCR(r)   (keylargo_base + ((r) >> 2))
#define KL_IN(r)   (in_le32(KL_FCR(r)))
#define KL_OUT(r, v)   (out_le32(KL_FCR(r), (v)))
#define KL_BIS(r, v)   (KL_OUT((r), KL_IN(r) | (v)))
#define KL_BIC(r, v)   (KL_OUT((r), KL_IN(r) & ~(v)))
#define UN_REG(r)   (uninorth_base + ((r) >> 2))
#define UN_IN(r)   (in_be32(UN_REG(r)))
#define UN_OUT(r, v)   (out_be32(UN_REG(r), (v)))
#define UN_BIS(r, v)   (UN_OUT((r), UN_IN(r) | (v)))
#define UN_BIC(r, v)   (UN_OUT((r), UN_IN(r) & ~(v)))
#define FTR_NEED_OPENPIC_TWEAK   0x00000001

Typedefs

typedef feature_bit fbit

Functions

static struct feature_controllerfeature_add_controller (struct device_node *controller_device, fbit *bits)
static struct feature_controllerfeature_lookup_controller (struct device_node *device)
static void uninorth_init (void)
static void keylargo_init (void)
void feature_init (void)
int feature_set (struct device_node *device, enum system_feature f)
int feature_clear (struct device_node *device, enum system_feature f)
int feature_test (struct device_node *device, enum system_feature f)
void feature_set_gmac_power (struct device_node *device, int power)
void feature_set_gmac_phy_reset (struct device_node *device, int reset)
void feature_set_usb_power (struct device_node *device, int power)
void feature_set_firewire_power (struct device_node *device, int power)

Variables

static fbit feature_bits_ohare_pbook []
static fbit feature_bits_heathrow []
static fbit feature_bits_wallstreet []
static fbit feature_bits_paddington []
static fbit feature_bits_keylargo []
static struct feature_controller controllers [MAX_FEATURE_CONTROLLERS]
static int controller_count = 0
static volatile u32uninorth_base
static volatile u32keylargo_base
static struct feature_controllerkeylargo
static int uninorth_rev
static int keylargo_rev
static u32 board_features
static struct board_features_t __init []


Define Documentation

#define FREG c,
r   )     (&(((c)->reg)[(r)>>2]))
 

Definition at line 32 of file feature.c.

Referenced by feature_add_controller(), feature_clear(), feature_init(), feature_set(), and feature_test().

#define FTR_NEED_OPENPIC_TWEAK   0x00000001
 

Definition at line 257 of file feature.c.

#define KL_BIC r,
 )     (KL_OUT((r), KL_IN(r) & ~(v)))
 

Definition at line 39 of file feature.c.

Referenced by feature_set_usb_power().

#define KL_BIS r,
 )     (KL_OUT((r), KL_IN(r) | (v)))
 

Definition at line 38 of file feature.c.

Referenced by feature_set_usb_power(), and keylargo_init().

#define KL_FCR r   )     (keylargo_base + ((r) >> 2))
 

Definition at line 35 of file feature.c.

Referenced by feature_set_gmac_phy_reset().

#define KL_IN r   )     (in_le32(KL_FCR(r)))
 

Definition at line 36 of file feature.c.

Referenced by feature_set_usb_power().

#define KL_OUT r,
 )     (out_le32(KL_FCR(r), (v)))
 

Definition at line 37 of file feature.c.

Referenced by feature_set_usb_power().

#define MAX_FEATURE_CONTROLLERS   2
 

Definition at line 30 of file feature.c.

#define MAX_FEATURE_OFFSET   0x100
 

Definition at line 31 of file feature.c.

#define UN_BIC r,
 )     (UN_OUT((r), UN_IN(r) & ~(v)))
 

Definition at line 46 of file feature.c.

Referenced by feature_set_gmac_power().

#define UN_BIS r,
 )     (UN_OUT((r), UN_IN(r) | (v)))
 

Definition at line 45 of file feature.c.

Referenced by feature_set_gmac_power().

#define UN_IN r   )     (in_be32(UN_REG(r)))
 

Definition at line 43 of file feature.c.

Referenced by uninorth_init().

#define UN_OUT r,
 )     (out_be32(UN_REG(r), (v)))
 

Definition at line 44 of file feature.c.

Referenced by uninorth_init().

#define UN_REG r   )     (uninorth_base + ((r) >> 2))
 

Definition at line 42 of file feature.c.

Referenced by feature_init().


Typedef Documentation

typedef struct feature_bit fbit
 


Function Documentation

static struct feature_controller * feature_add_controller struct device_node controller_device,
fbit bits
[static]
 

Definition at line 361 of file feature.c.

References address_range::address, device_node::addrs, feature_controller::bits, controller, controller_count, feature_controller::device, FREG, device_node::full_name, ioremap, KERN_ERR, KERN_INFO, feature_controller::lock, device_node::n_addrs, NULL, OHARE_FEATURE_REG, out_le32(), printk, feature_controller::reg, address_range::size, spin_lock_init, STARMAX_FEATURES, and u32.

Referenced by feature_init().

Here is the call graph for this function:

int feature_clear struct device_node device,
enum system_feature  f
 

Definition at line 458 of file feature.c.

References bit, feature_controller::bits, controller, EINVAL, ENODEV, FEATURE_last, feature_lookup_controller(), FREG, in_le32(), feature_controller::lock, feature_bit::mask, out_le32(), feature_bit::polarity, printk, feature_controller::reg, feature_bit::reg, spin_lock_irqsave, spin_unlock_irqrestore, and value.

Referenced by __initfunc(), bmac_reset_chip(), feature_init(), media_bay_step(), set_mb_power(), set_mesh_power(), set_scc_power(), and swim3_add_device().

Here is the call graph for this function:

void feature_init void   ) 
 

Definition at line 276 of file feature.c.

References address_range::address, device_node::addrs, board_features, controller_count, feature_controller::device, device, device_is_compatible(), feature_add_controller(), feature_clear(), FEATURE_Sound_CLK_enable, FEATURE_Sound_power, find_devices(), FREG, get_property(), HEATHROW_FEATURE_REG, HRW_DEFAULTS, i, in_be32(), in_le32(), ioremap, KERN_INFO, keylargo_base, keylargo_init(), keylargo_rev, machine_is_compatible(), device_node::n_addrs, NULL, out_le32(), printk, feature_controller::reg, rev, u32, UN_REG, UNI_N_VERSION, uninorth_base, uninorth_init(), uninorth_rev, and x1000.

Referenced by __initfunc().

Here is the call graph for this function:

static struct feature_controller * feature_lookup_controller struct device_node device  )  [static]
 

Definition at line 401 of file feature.c.

References controller_count, i, NULL, and printk.

Referenced by feature_clear(), feature_set(), and feature_test().

int feature_set struct device_node device,
enum system_feature  f
 

Definition at line 425 of file feature.c.

References bit, feature_controller::bits, controller, EINVAL, ENODEV, FEATURE_last, feature_lookup_controller(), FREG, in_le32(), feature_controller::lock, feature_bit::mask, out_le32(), feature_bit::polarity, printk, feature_controller::reg, feature_bit::reg, spin_lock_irqsave, spin_unlock_irqrestore, and value.

Referenced by __initfunc(), bmac_reset_chip(), dmasound_init(), mb_content(), set_mb_power(), set_media_bay(), set_mesh_power(), set_scc_power(), swim3_add_device(), and xmon_init_scc().

Here is the call graph for this function:

void feature_set_firewire_power struct device_node device,
int  power
 

Definition at line 633 of file feature.c.

void feature_set_gmac_phy_reset struct device_node device,
int  reset
 

Definition at line 545 of file feature.c.

References in_8(), keylargo_base, KL_FCR, KL_GPIO_ETH_PHY_RESET, feature_controller::lock, out_8(), spin_lock_irqsave, spin_unlock_irqrestore, and u8.

Referenced by mii_lookup_and_reset().

Here is the call graph for this function:

void feature_set_gmac_power struct device_node device,
int  power
 

Definition at line 528 of file feature.c.

References feature_controller::lock, spin_lock_irqsave, spin_unlock_irqrestore, udelay, UN_BIC, UN_BIS, UNI_N_CLOCK_CNTL, UNI_N_CLOCK_CNTL_GMAC, and uninorth_base.

Referenced by gmac_set_power(), and uninorth_init().

void feature_set_usb_power struct device_node device,
int  power
 

Definition at line 560 of file feature.c.

References get_property(), keylargo_base, KEYLARGO_FCR0, KEYLARGO_FCR4, KL0_USB0_CELL_ENABLE, KL0_USB0_PAD_SUSPEND0, KL0_USB0_PAD_SUSPEND1, KL0_USB1_CELL_ENABLE, KL0_USB1_PAD_SUSPEND0, KL0_USB1_PAD_SUSPEND1, KL4_SET_PORT_CONNECT, KL4_SET_PORT_DISCONNECT, KL4_SET_PORT_ENABLE, KL4_SET_PORT_RESUME, KL_BIC, KL_BIS, KL_IN, KL_OUT, feature_controller::lock, mdelay, NULL, number, reg, spin_lock_irqsave, spin_unlock_irqrestore, strlen, strncmp(), u32, and udelay.

Here is the call graph for this function:

int feature_test struct device_node device,
enum system_feature  f
 

Definition at line 491 of file feature.c.

References bit, feature_controller::bits, controller, EINVAL, ENODEV, FEATURE_last, feature_lookup_controller(), FREG, in_le32(), feature_bit::mask, feature_bit::polarity, printk, feature_controller::reg, feature_bit::reg, and value.

Referenced by set_scc_power().

Here is the call graph for this function:

static void keylargo_init void   )  [static]
 

Definition at line 880 of file feature.c.

References KEYLARGO_FCR2, KL2_MPIC_ENABLE, and KL_BIS.

Referenced by feature_init().

static void uninorth_init void   )  [static]
 

Definition at line 842 of file feature.c.

References device_is_compatible(), feature_set_gmac_power(), find_devices(), device_node::next, UN_IN, UN_OUT, UNI_N_ARB_CTRL, UNI_N_ARB_CTRL_QACK_DELAY, UNI_N_ARB_CTRL_QACK_DELAY105, UNI_N_ARB_CTRL_QACK_DELAY_MASK, UNI_N_ARB_CTRL_QACK_DELAY_SHIFT, and uninorth_rev.

Referenced by feature_init().

Here is the call graph for this function:


Variable Documentation

struct board_features_t __init[] [static]
 

u32 board_features [static]
 

Definition at line 255 of file feature.c.

Referenced by feature_init().

int controller_count = 0 [static]
 

Definition at line 247 of file feature.c.

Referenced by feature_add_controller(), feature_init(), and feature_lookup_controller().

struct feature_controller controllers[MAX_FEATURE_CONTROLLERS] [static]
 

Definition at line 246 of file feature.c.

Referenced by setup_mode2().

fbit feature_bits_heathrow[] [static]
 

Initial value:

 {
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x38,0,HRW_SWIM_ENABLE},       
        {0x38,0,HRW_MESH_ENABLE},       
        {0x38,0,HRW_IDE0_ENABLE},       
        {0x38,1,HRW_IDE0_RESET_N},      
        {0x38,0,HRW_IOBUS_ENABLE},      
        {0x38,1,0},                     
        {0x38,1,0},                     
        {0x38,0,0},                     
        {0x38,0,HRW_BAY_IDE_ENABLE},    
        {0x38,1,HRW_IDE1_RESET_N},      
        {0x38,0,0},                     
        {0x38,0,HRW_BMAC_RESET},        
        {0x38,0,HRW_BMAC_IO_ENABLE},    
        {0x38,1,0},                     
        {0x38,0,HRW_SLOW_SCC_PCLK},     
        {0x38,1,0},                     
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x38,0,0},                     
}

Definition at line 90 of file feature.c.

fbit feature_bits_keylargo[] [static]
 

Initial value:

 {
        {0x38,0,0},                     
        {0x38,0,KL0_SCC_RESET},         
        {0x38,0,KL0_SERIAL_ENABLE},     
        {0x38,0,KL0_SCC_A_INTF_ENABLE}, 
        {0x38,0,KL0_SCC_B_INTF_ENABLE}, 
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x3c,0,0},                     
        {0x3c,1,KL1_EIDE0_RESET_N},     
        {0x38,0,0},                     
        {0x34,1,0x00000200},            
        {0x34,1,0x00000400},            
        {0x38,0,0},                     
        {0x3c,0,0x0},                   
        {0x3c,1,KL1_EIDE1_RESET_N},     
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x40,1,KL2_MODEM_POWER_N},     
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x3c,1,KL1_UIDE_RESET_N},      
        {0x34,0,KL_MBCR_MBDEV_ENABLE},  
        {0x34,0,0x00000100},            
        {0x40,1,KL2_AIRPORT_RESET_N},   
}

Definition at line 191 of file feature.c.

fbit feature_bits_ohare_pbook[] [static]
 

Initial value:

 {
        {0x38,0,0},                     
        {0x38,0,OH_SCC_RESET},          
        {0x38,0,OH_SCC_ENABLE},         
        {0x38,0,OH_SCCA_IO},            
        {0x38,0,OH_SCCB_IO},            
        {0x38,0,OH_FLOPPY_ENABLE},      
        {0x38,0,OH_MESH_ENABLE},        
        {0x38,0,OH_IDE0_ENABLE},        
        {0x38,1,OH_IDE0_RESET_N},       
        {0x38,0,OH_IOBUS_ENABLE},       
        {0x38,1,OH_BAY_RESET_N},        
        {0x38,1,OH_BAY_POWER_N},        
        {0x38,0,OH_BAY_PCI_ENABLE},     
        {0x38,0,OH_BAY_IDE_ENABLE},     
        {0x38,1,OH_IDE1_RESET_N},       
        {0x38,0,OH_BAY_FLOPPY_ENABLE},  
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x38,0,0},                     
}

Definition at line 56 of file feature.c.

fbit feature_bits_paddington[] [static]
 

Initial value:

 {
        {0x38,0,0},                     
        {0x38,0,PADD_RESET_SCC},        
        {0x38,0,HRW_SCC_ENABLE},        
        {0x38,0,HRW_SCCA_IO},           
        {0x38,0,HRW_SCCB_IO},           
        {0x38,0,HRW_SWIM_ENABLE},       
        {0x38,0,HRW_MESH_ENABLE},       
        {0x38,0,HRW_IDE0_ENABLE},       
        {0x38,1,HRW_IDE0_RESET_N},      
        {0x38,0,HRW_IOBUS_ENABLE},      
        {0x38,1,HRW_BAY_RESET_N},       
        {0x38,1,HRW_BAY_POWER_N},       
        {0x38,0,HRW_BAY_PCI_ENABLE},    
        {0x38,0,HRW_BAY_IDE_ENABLE},    
        {0x38,1,HRW_IDE1_RESET_N},      
        {0x38,0,HRW_BAY_FLOPPY_ENABLE}, 
        {0x38,0,HRW_BMAC_RESET},        
        {0x38,0,HRW_BMAC_IO_ENABLE},    
        {0x38,1,PADD_MODEM_POWER_N},    
        {0x38,0,HRW_SLOW_SCC_PCLK},     
        {0x38,1,HRW_SOUND_POWER_N},     
        {0x38,0,HRW_SOUND_CLK_ENABLE},  
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x38,0,0},                     
}

Definition at line 158 of file feature.c.

fbit feature_bits_wallstreet[] [static]
 

Initial value:

 {
        {0x38,0,0},                     
        {0x38,0,HRW_RESET_SCC},         
        {0x38,0,HRW_SCC_ENABLE},        
        {0x38,0,HRW_SCCA_IO},           
        {0x38,0,HRW_SCCB_IO},           
        {0x38,0,HRW_SWIM_ENABLE},       
        {0x38,0,HRW_MESH_ENABLE},       
        {0x38,0,HRW_IDE0_ENABLE},       
        {0x38,1,HRW_IDE0_RESET_N},      
        {0x38,0,HRW_IOBUS_ENABLE},      
        {0x38,1,HRW_BAY_RESET_N},       
        {0x38,1,HRW_BAY_POWER_N},       
        {0x38,0,HRW_BAY_PCI_ENABLE},    
        {0x38,0,HRW_BAY_IDE_ENABLE},    
        {0x38,1,HRW_IDE1_RESET_N},      
        {0x38,0,HRW_BAY_FLOPPY_ENABLE}, 
        {0x38,0,HRW_BMAC_RESET},        
        {0x38,0,HRW_BMAC_IO_ENABLE},    
        {0x38,1,HRW_MODEM_POWER_N},     
        {0x38,0,HRW_SLOW_SCC_PCLK},     
        {0x38,1,HRW_SOUND_POWER_N},     
        {0x38,0,HRW_SOUND_CLK_ENABLE},  
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x38,0,0},                     
        {0x38,0,0},                     
}

Definition at line 123 of file feature.c.

struct feature_controller* keylargo [static]
 

Definition at line 252 of file feature.c.

Referenced by interpret_macio_props().

volatile u32* keylargo_base [static]
 

Definition at line 251 of file feature.c.

Referenced by feature_init(), feature_set_gmac_phy_reset(), and feature_set_usb_power().

int keylargo_rev [static]
 

Definition at line 254 of file feature.c.

Referenced by feature_init().

volatile u32* uninorth_base [static]
 

Definition at line 250 of file feature.c.

Referenced by feature_init(), and feature_set_gmac_power().

int uninorth_rev [static]
 

Definition at line 253 of file feature.c.

Referenced by feature_init(), and uninorth_init().