SuperH Interfaces Guide

Author:Paul Mundt

Memory Management

SH-4

Store Queue API

voidsq_flush_range(unsigned long start, unsigned int len)

Flush (prefetch) a specific SQ range

Parameters

unsignedlongstart
the store queue address to start flushing from
unsignedintlen
the length to flush

Description

Flushes the store queue cache fromstart tostart +len in alinear fashion.

unsigned longsq_remap(unsigned long phys, unsigned int size, const char * name, pgprot_t prot)

Map a physical address through the Store Queues

Parameters

unsignedlongphys
Physical address of mapping.
unsignedintsize
Length of mapping.
constchar*name
User invoking mapping.
pgprot_tprot
Protection bits.

Description

Remaps the physical addressphys through the next available store queueaddress ofsize length.name is logged at boot time as well as throughthe sysfs interface.

voidsq_unmap(unsigned long vaddr)

Unmap a Store Queue allocation

Parameters

unsignedlongvaddr
Pre-allocated Store Queue mapping.

Description

Unmaps the store queue allocationmap that was previously created bysq_remap(). Also frees up the pte that was previously inserted intothe kernel page table and discards the UTLB translation.

Machine Specific Interfaces

mach-dreamcast

intaica_rtc_gettimeofday(structdevice * dev, struct rtc_time * tm)

Get the time from the AICA RTC

Parameters

structdevice*dev
the RTC device (ignored)
structrtc_time*tm
pointer to resulting RTC time structure

Description

Grabs the current RTC seconds counter and adjusts it to the Unix Epoch.

intaica_rtc_settimeofday(structdevice * dev, struct rtc_time * tm)

Set the AICA RTC to the current time

Parameters

structdevice*dev
the RTC device (ignored)
structrtc_time*tm
pointer to new RTC time structure

Description

Adjusts the giventv to the AICA Epoch and sets the RTC seconds counter.

mach-x3proto

intilsel_enable(ilsel_source_t set)

Enable an ILSEL set.

Parameters

ilsel_source_tset
ILSEL source (see ilsel_source_t enum in include/asm-sh/ilsel.h).

Description

Enables a given non-aliased ILSEL source (<= ILSEL_KEY) at the highestavailable interrupt level. Callers should take care to order callsitesnoting descending interrupt levels. Aliasing FPGA and external boardIRQs need to useilsel_enable_fixed().

The return value is an IRQ number that can later be taken down withilsel_disable().

intilsel_enable_fixed(ilsel_source_t set, unsigned int level)

Enable an ILSEL set at a fixed interrupt level

Parameters

ilsel_source_tset
ILSEL source (see ilsel_source_t enum in include/asm-sh/ilsel.h).
unsignedintlevel
Interrupt level (1 - 15)

Description

Enables a given ILSEL source at a fixed interrupt level. Necessaryboth for level reservation as well as for aliased sources that onlyexist on special ILSEL#s.

Returns an IRQ number (asilsel_enable()).

voidilsel_disable(unsigned int irq)

Disable an ILSEL set

Parameters

unsignedintirq
Bit position for ILSEL set value (retval from enable routines)

Description

Disable a previously enabled ILSEL set.

Busses

SuperHyway

intsuperhyway_add_device(unsigned long base, struct superhyway_device * sdev, struct superhyway_bus * bus)

Add a SuperHyway module

Parameters

unsignedlongbase
Physical address where module is mapped.
structsuperhyway_device*sdev
SuperHyway device to add, or NULL to allocate a new one.
structsuperhyway_bus*bus
Bus where SuperHyway module resides.

Description

This is responsible for adding a new SuperHyway module. This sets up a newstruct superhyway_device for the module being added ifsdev == NULL.

Devices are initially added in the order that they are scanned (from thetop-down of the memory map), and are assigned an ID based on the order thatthey are added. Any manual addition of a module will thus get the ID afterthe devices already discovered regardless of where it resides in memory.

Further work can and should be done in superhyway_scan_bus(), to be surethat any new modules are properly discovered and subsequently registered.

intsuperhyway_register_driver(struct superhyway_driver * drv)

Register a new SuperHyway driver

Parameters

structsuperhyway_driver*drv
SuperHyway driver to register.

Description

This registers the passed indrv. Any devices matching the id table willautomatically be populated and handed off to the driver’s specified proberoutine.

voidsuperhyway_unregister_driver(struct superhyway_driver * drv)

Unregister a SuperHyway driver

Parameters

structsuperhyway_driver*drv
SuperHyway driver to unregister.

Description

This cleans up aftersuperhyway_register_driver(), and should be invoked inthe exit path of any module drivers.

Maple

intmaple_driver_register(struct maple_driver * drv)

register a maple driver

Parameters

structmaple_driver*drv
maple driver to be registered.

Description

Registers the passed indrv, while updating the bus type.Devices with matching function IDs will be automatically probed.

voidmaple_driver_unregister(struct maple_driver * drv)

unregister a maple driver.

Parameters

structmaple_driver*drv
maple driver to unregister.

Description

Cleans up aftermaple_driver_register(). To be invoked in the exitpath of any module drivers.

voidmaple_getcond_callback(struct maple_device * dev, void (*callback)(struct mapleq *mq), unsigned long interval, unsigned long function)

setup handling MAPLE_COMMAND_GETCOND

Parameters

structmaple_device*dev
device responding
void(*)(structmapleq*mq)callback
handler callback
unsignedlonginterval
interval in jiffies between callbacks
unsignedlongfunction
the function code for the device
intmaple_add_packet(struct maple_device * mdev, u32 function, u32 command, size_t length, void * data)

add a single instruction to the maple bus queue

Parameters

structmaple_device*mdev
maple device
u32function
function on device being queried
u32command
maple command to add
size_tlength
length of command string (in 32 bit words)
void*data
remainder of command string