Changes in 4.9.137 bcache: fix miss key refill->end in writeback hwmon: (pmbus) Fix page count auto-detection. jffs2: free jffs2_sb_info through jffs2_kill_sb() pcmcia: Implement CLKRUN protocol disabling for Ricoh bridges ipmi: Fix timer race with module unload parisc: Fix address in HPMC IVA parisc: Fix map_pages() to not overwrite existing pte entries ALSA: hda - Add quirk for ASUS G751 laptop ALSA: hda - Fix headphone pin config for ASUS G751 ALSA: hda - Add mic quirk for the Lenovo G50-30 (17aa:3905) ALSA: ca0106: Disable IZD on SB0570 DAC to fix audio pops x86/speculation: Enable cross-hyperthread spectre v2 STIBP mitigation x86/corruption-check: Fix panic in memory_corruption_check() when boot option without value is provided x86/speculation: Support Enhanced IBRS on future CPUs bpf: do not blindly change rlimit in reuseport net selftest Revert "perf tools: Fix PMU term format max value calculation" xfrm: policy: use hlist rcu variants on insert sparc: Fix single-pcr perf event counter management. sparc64: Make proc_id signed. sched/fair: Fix the min_vruntime update logic in dequeue_entity() perf cpu_map: Align cpu map synthesized events properly. x86/fpu: Remove second definition of fpu in __fpu__restore_sig() net: qla3xxx: Remove overflowing shift statement selftests: ftrace: Add synthetic event syntax testcase i2c: rcar: cleanup DMA for all kinds of failure locking/lockdep: Fix debug_locks off performance problem ataflop: fix error handling during setup swim: fix cleanup on setup error tun: Consistently configure generic netdev params via rtnetlink s390/sthyi: Fix machine name validity indication hwmon: (pwm-fan) Set fan speed to 0 on suspend perf tools: Free temporary 'sys' string in read_event_files() perf tools: Cleanup trace-event-info 'tdata' leak perf strbuf: Match va_{add,copy} with va_end mmc: sdhci-pci-o2micro: Add quirk for O2 Micro dev 0x8620 rev 0x01 iwlwifi: pcie: avoid empty free RB queue x86/olpc: Indicate that legacy PC XO-1 platform should not register RTC cpufreq: dt: Try freeing static OPPs only if we have added them Bluetooth: btbcm: Add entry for BCM4335C0 UART bluetooth x86: boot: Fix EFI stub alignment pinctrl: qcom: spmi-mpp: Fix err handling of pmic_mpp_set_mux brcmfmac: fix for proper support of 160MHz bandwidth kprobes: Return error if we fail to reuse kprobe instead of BUG_ON() ACPI / LPSS: Add alternative ACPI HIDs for Cherry Trail DMA controllers pinctrl: qcom: spmi-mpp: Fix drive strength setting pinctrl: spmi-mpp: Fix pmic_mpp_config_get() to be compliant pinctrl: ssbi-gpio: Fix pm8xxx_pin_config_get() to be compliant ixgbevf: VF2VF TCP RSS ath10k: schedule hardware restart if WMI command times out cgroup, netclassid: add a preemption point to write_classid scsi: esp_scsi: Track residual for PIO transfers scsi: megaraid_sas: fix a missing-check bug RDMA/core: Do not expose unsupported counters IB/ipoib: Clear IPCB before icmp_send tpm: suppress transmit cmd error logs when TPM 1.2 is disabled/deactivated VMCI: Resource wildcard match fixed usb: gadget: udc: atmel: handle at91sam9rl PMC ext4: fix argument checking in EXT4_IOC_MOVE_EXT MD: fix invalid stored role for a disk PCI/MSI: Warn and return error if driver enables MSI/MSI-X twice coresight: etb10: Fix handling of perf mode crypto: caam - fix implicit casts in endianness helpers usb: chipidea: Prevent unbalanced IRQ disable driver/dma/ioat: Call del_timer_sync() without holding prep_lock uio: ensure class is registered before devices scsi: lpfc: Correct soft lockup when running mds diagnostics signal: Always deliver the kernel's SIGKILL and SIGSTOP to a pid namespace init dmaengine: dma-jz4780: Return error if not probed from DT ALSA: hda: Check the non-cached stream buffers more explicitly ARM: dts: exynos: Remove "cooling-{min|max}-level" for CPU nodes arm: dts: exynos: Add missing cooling device properties for CPUs ARM: dts: exynos: Convert exynos5250.dtsi to opp-v2 bindings ARM: dts: exynos: Mark 1 GHz CPU OPP as suspend OPP on Exynos5250 xen-swiotlb: use actually allocated size on check physical continuous tpm: Restore functionality to xen vtpm driver. xen/blkfront: avoid NULL blkfront_info dereference on device removal xen: fix race in xen_qlock_wait() xen: make xen_qlock_wait() nestable libertas: don't set URB_ZERO_PACKET on IN USB transfer usbip:vudc: BUG kmalloc-2048 (Not tainted): Poison overwritten iwlwifi: mvm: check return value of rs_rate_from_ucode_rate() net/ipv4: defensive cipso option parsing libnvdimm: Hold reference on parent while scheduling async init ASoC: intel: skylake: Add missing break in skl_tplg_get_token() jbd2: fix use after free in jbd2_log_do_checkpoint() gfs2_meta: ->mount() can get NULL dev_name ext4: initialize retries variable in ext4_da_write_inline_data_begin() ext4: propagate error from dquot_initialize() in EXT4_IOC_FSSETXATTR HID: hiddev: fix potential Spectre v1 EDAC, {i7core,sb,skx}_edac: Fix uncorrected error counting EDAC, skx_edac: Fix logical channel intermediate decoding PCI: Add Device IDs for Intel GPU "spurious interrupt" quirk signal/GenWQE: Fix sending of SIGKILL crypto: lrw - Fix out-of bounds access on counter overflow crypto: tcrypt - fix ghash-generic speed test ima: fix showing large 'violations' or 'runtime_measurements_count' hugetlbfs: dirty pages as they are added to pagecache kbuild: fix kernel/bounds.c 'W=1' warning iio: ad5064: Fix regulator handling iio: adc: imx25-gcq: Fix leak of device_node in mx25_gcq_setup_cfgs() iio: adc: at91: fix acking DRDY irq on simple conversions iio: adc: at91: fix wrong channel number in triggered buffer mode w1: omap-hdq: fix missing bus unregister at removal smb3: allow stats which track session and share reconnects to be reset smb3: do not attempt cifs operation in smb3 query info error path smb3: on kerberos mount if server doesn't specify auth type use krb5 printk: Fix panic caused by passing log_buf_len to command line genirq: Fix race on spurious interrupt detection NFSv4.1: Fix the r/wsize checking nfsd: Fix an Oops in free_session() lockd: fix access beyond unterminated strings in prints dm ioctl: harden copy_params()'s copy_from_user() from malicious users powerpc/msi: Fix compile error on mpc83xx MIPS: OCTEON: fix out of bounds array access on CN68XX TC: Set DMA masks for devices media: v4l2-tpg: fix kernel oops when enabling HFLIP and OSD kgdboc: Passing ekgdboc to command line causes panic xen: fix xen_qlock_wait() media: em28xx: use a default format if TRY_FMT fails media: tvp5150: avoid going past array on v4l2_querymenu() media: em28xx: fix input name for Terratec AV 350 media: em28xx: make v4l2-compliance happier by starting sequence on zero arm64: lse: remove -fcall-used-x0 flag rpmsg: smd: fix memory leak on channel create Cramfs: fix abad comparison when wrap-arounds occur arm64: dts: stratix10: Correct System Manager register size soc/tegra: pmc: Fix child-node lookup btrfs: Handle owner mismatch gracefully when walking up tree btrfs: locking: Add extra check in btrfs_init_new_buffer() to avoid deadlock btrfs: fix error handling in free_log_tree btrfs: iterate all devices during trim, instead of fs_devices::alloc_list btrfs: don't attempt to trim devices that don't support it btrfs: wait on caching when putting the bg cache btrfs: reset max_extent_size on clear in a bitmap btrfs: make sure we create all new block groups Btrfs: fix wrong dentries after fsync of file that got its parent replaced btrfs: qgroup: Dirty all qgroups before rescan Btrfs: fix null pointer dereference on compressed write path error btrfs: set max_extent_size properly MD: fix invalid stored role for a disk - try2 Linux 4.9.137 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
242 lines
7.6 KiB
C
242 lines
7.6 KiB
C
/*
|
|
* ricoh.h 1.9 1999/10/25 20:03:34
|
|
*
|
|
* The contents of this file are subject to the Mozilla Public License
|
|
* Version 1.1 (the "License"); you may not use this file except in
|
|
* compliance with the License. You may obtain a copy of the License
|
|
* at http://www.mozilla.org/MPL/
|
|
*
|
|
* Software distributed under the License is distributed on an "AS IS"
|
|
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
|
* the License for the specific language governing rights and
|
|
* limitations under the License.
|
|
*
|
|
* The initial developer of the original code is David A. Hinds
|
|
* <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
|
|
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
|
|
*
|
|
* Alternatively, the contents of this file may be used under the
|
|
* terms of the GNU General Public License version 2 (the "GPL"), in which
|
|
* case the provisions of the GPL are applicable instead of the
|
|
* above. If you wish to allow the use of your version of this file
|
|
* only under the terms of the GPL and not to allow others to use
|
|
* your version of this file under the MPL, indicate your decision by
|
|
* deleting the provisions above and replace them with the notice and
|
|
* other provisions required by the GPL. If you do not delete the
|
|
* provisions above, a recipient may use your version of this file
|
|
* under either the MPL or the GPL.
|
|
*/
|
|
|
|
#ifndef _LINUX_RICOH_H
|
|
#define _LINUX_RICOH_H
|
|
|
|
|
|
#define RF5C_MODE_CTL 0x1f /* Mode control */
|
|
#define RF5C_PWR_CTL 0x2f /* Mixed voltage control */
|
|
#define RF5C_CHIP_ID 0x3a /* Chip identification */
|
|
#define RF5C_MODE_CTL_3 0x3b /* Mode control 3 */
|
|
|
|
/* I/O window address offset */
|
|
#define RF5C_IO_OFF(w) (0x36+((w)<<1))
|
|
|
|
/* Flags for RF5C_MODE_CTL */
|
|
#define RF5C_MODE_ATA 0x01 /* ATA mode */
|
|
#define RF5C_MODE_LED_ENA 0x02 /* IRQ 12 is LED */
|
|
#define RF5C_MODE_CA21 0x04
|
|
#define RF5C_MODE_CA22 0x08
|
|
#define RF5C_MODE_CA23 0x10
|
|
#define RF5C_MODE_CA24 0x20
|
|
#define RF5C_MODE_CA25 0x40
|
|
#define RF5C_MODE_3STATE_BIT7 0x80
|
|
|
|
/* Flags for RF5C_PWR_CTL */
|
|
#define RF5C_PWR_VCC_3V 0x01
|
|
#define RF5C_PWR_IREQ_HIGH 0x02
|
|
#define RF5C_PWR_INPACK_ENA 0x04
|
|
#define RF5C_PWR_5V_DET 0x08
|
|
#define RF5C_PWR_TC_SEL 0x10 /* Terminal Count: irq 11 or 15 */
|
|
#define RF5C_PWR_DREQ_LOW 0x20
|
|
#define RF5C_PWR_DREQ_OFF 0x00 /* DREQ steering control */
|
|
#define RF5C_PWR_DREQ_INPACK 0x40
|
|
#define RF5C_PWR_DREQ_SPKR 0x80
|
|
#define RF5C_PWR_DREQ_IOIS16 0xc0
|
|
|
|
/* Values for RF5C_CHIP_ID */
|
|
#define RF5C_CHIP_RF5C296 0x32
|
|
#define RF5C_CHIP_RF5C396 0xb2
|
|
|
|
/* Flags for RF5C_MODE_CTL_3 */
|
|
#define RF5C_MCTL3_DISABLE 0x01 /* Disable PCMCIA interface */
|
|
#define RF5C_MCTL3_DMA_ENA 0x02
|
|
|
|
/* Register definitions for Ricoh PCI-to-CardBus bridges */
|
|
|
|
/* Extra bits in CB_BRIDGE_CONTROL */
|
|
#define RL5C46X_BCR_3E0_ENA 0x0800
|
|
#define RL5C46X_BCR_3E2_ENA 0x1000
|
|
|
|
/* Bridge Configuration Register */
|
|
#define RL5C4XX_CONFIG 0x80 /* 16 bit */
|
|
#define RL5C4XX_CONFIG_IO_1_MODE 0x0200
|
|
#define RL5C4XX_CONFIG_IO_0_MODE 0x0100
|
|
#define RL5C4XX_CONFIG_PREFETCH 0x0001
|
|
|
|
/* Misc Control Register */
|
|
#define RL5C4XX_MISC 0x0082 /* 16 bit */
|
|
#define RL5C4XX_MISC_HW_SUSPEND_ENA 0x0002
|
|
#define RL5C4XX_MISC_VCCEN_POL 0x0100
|
|
#define RL5C4XX_MISC_VPPEN_POL 0x0200
|
|
#define RL5C46X_MISC_SUSPEND 0x0001
|
|
#define RL5C46X_MISC_PWR_SAVE_2 0x0004
|
|
#define RL5C46X_MISC_IFACE_BUSY 0x0008
|
|
#define RL5C46X_MISC_B_LOCK 0x0010
|
|
#define RL5C46X_MISC_A_LOCK 0x0020
|
|
#define RL5C46X_MISC_PCI_LOCK 0x0040
|
|
#define RL5C47X_MISC_IFACE_BUSY 0x0004
|
|
#define RL5C47X_MISC_PCI_INT_MASK 0x0018
|
|
#define RL5C47X_MISC_PCI_INT_DIS 0x0020
|
|
#define RL5C47X_MISC_SUBSYS_WR 0x0040
|
|
#define RL5C47X_MISC_SRIRQ_ENA 0x0080
|
|
#define RL5C47X_MISC_5V_DISABLE 0x0400
|
|
#define RL5C47X_MISC_LED_POL 0x0800
|
|
|
|
/* 16-bit Interface Control Register */
|
|
#define RL5C4XX_16BIT_CTL 0x0084 /* 16 bit */
|
|
#define RL5C4XX_16CTL_IO_TIMING 0x0100
|
|
#define RL5C4XX_16CTL_MEM_TIMING 0x0200
|
|
#define RL5C46X_16CTL_LEVEL_1 0x0010
|
|
#define RL5C46X_16CTL_LEVEL_2 0x0020
|
|
|
|
/* 16-bit IO and memory timing registers */
|
|
#define RL5C4XX_16BIT_IO_0 0x0088 /* 16 bit */
|
|
#define RL5C4XX_16BIT_MEM_0 0x008a /* 16 bit */
|
|
#define RL5C4XX_SETUP_MASK 0x0007
|
|
#define RL5C4XX_SETUP_SHIFT 0
|
|
#define RL5C4XX_CMD_MASK 0x01f0
|
|
#define RL5C4XX_CMD_SHIFT 4
|
|
#define RL5C4XX_HOLD_MASK 0x1c00
|
|
#define RL5C4XX_HOLD_SHIFT 10
|
|
#define RL5C4XX_MISC_CONTROL 0x2F /* 8 bit */
|
|
#define RL5C4XX_ZV_ENABLE 0x08
|
|
|
|
/* Misc Control 3 Register */
|
|
#define RL5C4XX_MISC3 0x00A2 /* 16 bit */
|
|
#define RL5C47X_MISC3_CB_CLKRUN_DIS BIT(1)
|
|
|
|
#ifdef __YENTA_H
|
|
|
|
#define rl_misc(socket) ((socket)->private[0])
|
|
#define rl_ctl(socket) ((socket)->private[1])
|
|
#define rl_io(socket) ((socket)->private[2])
|
|
#define rl_mem(socket) ((socket)->private[3])
|
|
#define rl_config(socket) ((socket)->private[4])
|
|
|
|
static void ricoh_zoom_video(struct pcmcia_socket *sock, int onoff)
|
|
{
|
|
u8 reg;
|
|
struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
|
|
|
|
reg = config_readb(socket, RL5C4XX_MISC_CONTROL);
|
|
if (onoff)
|
|
/* Zoom zoom, we will all go together, zoom zoom, zoom zoom */
|
|
reg |= RL5C4XX_ZV_ENABLE;
|
|
else
|
|
reg &= ~RL5C4XX_ZV_ENABLE;
|
|
|
|
config_writeb(socket, RL5C4XX_MISC_CONTROL, reg);
|
|
}
|
|
|
|
static void ricoh_set_zv(struct yenta_socket *socket)
|
|
{
|
|
if(socket->dev->vendor == PCI_VENDOR_ID_RICOH)
|
|
{
|
|
switch(socket->dev->device)
|
|
{
|
|
/* There may be more .. */
|
|
case PCI_DEVICE_ID_RICOH_RL5C478:
|
|
socket->socket.zoom_video = ricoh_zoom_video;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
static void ricoh_set_clkrun(struct yenta_socket *socket, bool quiet)
|
|
{
|
|
u16 misc3;
|
|
|
|
/*
|
|
* RL5C475II likely has this setting, too, however no datasheet
|
|
* is publicly available for this chip
|
|
*/
|
|
if (socket->dev->device != PCI_DEVICE_ID_RICOH_RL5C476 &&
|
|
socket->dev->device != PCI_DEVICE_ID_RICOH_RL5C478)
|
|
return;
|
|
|
|
if (socket->dev->revision < 0x80)
|
|
return;
|
|
|
|
misc3 = config_readw(socket, RL5C4XX_MISC3);
|
|
if (misc3 & RL5C47X_MISC3_CB_CLKRUN_DIS) {
|
|
if (!quiet)
|
|
dev_dbg(&socket->dev->dev,
|
|
"CLKRUN feature already disabled\n");
|
|
} else if (disable_clkrun) {
|
|
if (!quiet)
|
|
dev_info(&socket->dev->dev,
|
|
"Disabling CLKRUN feature\n");
|
|
misc3 |= RL5C47X_MISC3_CB_CLKRUN_DIS;
|
|
config_writew(socket, RL5C4XX_MISC3, misc3);
|
|
}
|
|
}
|
|
|
|
static void ricoh_save_state(struct yenta_socket *socket)
|
|
{
|
|
rl_misc(socket) = config_readw(socket, RL5C4XX_MISC);
|
|
rl_ctl(socket) = config_readw(socket, RL5C4XX_16BIT_CTL);
|
|
rl_io(socket) = config_readw(socket, RL5C4XX_16BIT_IO_0);
|
|
rl_mem(socket) = config_readw(socket, RL5C4XX_16BIT_MEM_0);
|
|
rl_config(socket) = config_readw(socket, RL5C4XX_CONFIG);
|
|
}
|
|
|
|
static void ricoh_restore_state(struct yenta_socket *socket)
|
|
{
|
|
config_writew(socket, RL5C4XX_MISC, rl_misc(socket));
|
|
config_writew(socket, RL5C4XX_16BIT_CTL, rl_ctl(socket));
|
|
config_writew(socket, RL5C4XX_16BIT_IO_0, rl_io(socket));
|
|
config_writew(socket, RL5C4XX_16BIT_MEM_0, rl_mem(socket));
|
|
config_writew(socket, RL5C4XX_CONFIG, rl_config(socket));
|
|
ricoh_set_clkrun(socket, true);
|
|
}
|
|
|
|
|
|
/*
|
|
* Magic Ricoh initialization code..
|
|
*/
|
|
static int ricoh_override(struct yenta_socket *socket)
|
|
{
|
|
u16 config, ctl;
|
|
|
|
config = config_readw(socket, RL5C4XX_CONFIG);
|
|
|
|
/* Set the default timings, don't trust the original values */
|
|
ctl = RL5C4XX_16CTL_IO_TIMING | RL5C4XX_16CTL_MEM_TIMING;
|
|
|
|
if(socket->dev->device < PCI_DEVICE_ID_RICOH_RL5C475) {
|
|
ctl |= RL5C46X_16CTL_LEVEL_1 | RL5C46X_16CTL_LEVEL_2;
|
|
} else {
|
|
config |= RL5C4XX_CONFIG_PREFETCH;
|
|
}
|
|
|
|
config_writew(socket, RL5C4XX_16BIT_CTL, ctl);
|
|
config_writew(socket, RL5C4XX_CONFIG, config);
|
|
|
|
ricoh_set_zv(socket);
|
|
ricoh_set_clkrun(socket, false);
|
|
|
|
return 0;
|
|
}
|
|
|
|
#endif /* CONFIG_CARDBUS */
|
|
|
|
#endif /* _LINUX_RICOH_H */
|