~ubuntu-branches/ubuntu/trusty/linux-keystone/trusty-proposed

« back to all changes in this revision

Viewing changes to drivers/mfd/rtl8411.c

  • Committer: Package Import Robot
  • Author(s): Ike Panhc, Ike Panhc, Upstream Kernel Changes, Ubuntu: 3.13.0-36.63
  • Date: 2014-08-20 13:53:11 UTC
  • Revision ID: package-import@ubuntu.com-20140820135311-79314y76vlfia5e2
Tags: 3.13.0-11.18
[ Ike Panhc ]

* Release Tracking Bug
  - LP: #1365272
* Rebase to Ubuntu-3.13.0-35.62

[ Upstream Kernel Changes ]

* rapidio: keystone: fix kernel link warning (wrong section usage)
  - LP: #1365300
* rapidio: keystone: use GFP_DMA to allocate DMA buffers
  - LP: #1365300
* rapidio: rio-dev: use GFP_DMA to allocate DMA buffers
  - LP: #1365300
* remoteproc: patch for aligning uio address and size
  - LP: #1365300
* ARM: 8036/1: Enable IRQs before attempting to read user space in
  __und_usr
  - LP: #1365299

[ Ubuntu: 3.13.0-36.63 ]

* Release Tracking Bug
  - LP: #1365052
* SAUCE: (no-up) irqchip:gic: change access of gicc_ctrl register to read
  modify write.
  - LP: #1357527
* SAUCE: (no-up) arm64: optimized copy_to_user and copy_from_user
  assembly code
  - LP: #1358949
* SAUCE: (no-up) Drop APM X-Gene SoC Ethernet driver
  - LP: #1360140
* [Config] Drop XGENE entries
  - LP: #1360140
* [Config] CONFIG_NET_XGENE=m for arm64
  - LP: #1360140
* SAUCE: Add compat macro for skb_get_hash
  - LP: #1358162
* SAUCE: bcache: prevent crash on changing writeback_running
  - LP: #1357295
* SAUCE: (no-up) arm64: Fix the csr-mask for APM X-Gene SoC AHCI SATA PHY
  clock DTS node.
  - LP: #1359489
* SAUCE: (no-up) ahci_xgene: Skip the PHY and clock initialization if
  already configured by the firmware.
  - LP: #1359501
* SAUCE: (no-up) ahci_xgene: Fix the link down in first attempt for the
  APM X-Gene SoC AHCI SATA host controller driver.
  - LP: #1359507
* SAUCE: (no-up) pci-xgene-msi: fixed deadlock in irq_set_affinity
  - LP: #1359514
* iwlwifi: mvm: Add a missed beacons threshold
  - LP: #1349572
* mac80211: reset probe_send_count also in HW_CONNECTION_MONITOR case
  - LP: #1349572
* genirq: Add an accessor for IRQ_PER_CPU flag
  - LP: #1357527
* arm64: perf: add support for percpu pmu interrupt
  - LP: #1357527
* cifs: sanity check length of data to send before sending
  - LP: #1283101
* KVM: nVMX: Pass vmexit parameters to nested_vmx_vmexit
  - LP: #1329434
* KVM: nVMX: Rework interception of IRQs and NMIs
  - LP: #1329434
* KVM: vmx: disable APIC virtualization in nested guests
  - LP: #1329434
* HID: Add transport-driver functions to the USB HID interface.
  - LP: #1353021
* ahci_xgene: Removing NCQ support from the APM X-Gene SoC AHCI SATA Host
  Controller driver.
  - LP: #1358498
* fold d_kill() and d_free()
  - LP: #1354234
* fold try_prune_one_dentry()
  - LP: #1354234
* new helper: dentry_free()
  - LP: #1354234
* expand the call of dentry_lru_del() in dentry_kill()
  - LP: #1354234
* dentry_kill(): don't try to remove from shrink list
  - LP: #1354234
* don't remove from shrink list in select_collect()
  - LP: #1354234
* more graceful recovery in umount_collect()
  - LP: #1354234
* dcache: don't need rcu in shrink_dentry_list()
  - LP: #1354234
* lift the "already marked killed" case into shrink_dentry_list()
* split dentry_kill()
  - LP: #1354234
* expand dentry_kill(dentry, 0) in shrink_dentry_list()
  - LP: #1354234
* shrink_dentry_list(): take parent's ->d_lock earlier
  - LP: #1354234
* dealing with the rest of shrink_dentry_list() livelock
  - LP: #1354234
* dentry_kill() doesn't need the second argument now
  - LP: #1354234
* dcache: add missing lockdep annotation
  - LP: #1354234
* fs: convert use of typedef ctl_table to struct ctl_table
  - LP: #1354234
* lock_parent: don't step on stale ->d_parent of all-but-freed one
  - LP: #1354234
* tools/testing/selftests/ptrace/peeksiginfo.c: add PAGE_SIZE definition
  - LP: #1358855
* x86, irq, pic: Probe for legacy PIC and set legacy_pic appropriately
  - LP: #1317697
* bnx2x: Fix kernel crash and data miscompare after EEH recovery
  - LP: #1353105
* bnx2x: Adapter not recovery from EEH error injection
  - LP: #1353105
* Fix: module signature vs tracepoints: add new TAINT_UNSIGNED_MODULE
  - LP: #1359670
* bcache: fix crash on shutdown in passthrough mode
  - LP: #1357295
* bcache: fix uninterruptible sleep in writeback thread
  - LP: #1357295
* namespaces: Use task_lock and not rcu to protect nsproxy
  - LP: #1328088
* MAINTAINERS: Add entry for APM X-Gene SoC ethernet driver
  - LP: #1360140
* Documentation: dts: Add bindings for APM X-Gene SoC ethernet driver
  - LP: #1360140
* dts: Add bindings for APM X-Gene SoC ethernet driver
  - LP: #1360140
* drivers: net: Add APM X-Gene SoC ethernet driver support.
  - LP: #1360140
* powerpc/mm: Add new "set" flag argument to pte/pmd update function
  - LP: #1357014
* powerpc/thp: Add write barrier after updating the valid bit
  - LP: #1357014
* powerpc/thp: Don't recompute vsid and ssize in loop on invalidate
  - LP: #1357014
* powerpc/thp: Invalidate old 64K based hash page mapping before insert
  of 4k pte
  - LP: #1357014
* powerpc/thp: Handle combo pages in invalidate
  - LP: #1357014
* powerpc/thp: Invalidate with vpn in loop
  - LP: #1357014
* powerpc/thp: Use ACCESS_ONCE when loading pmdp
  - LP: #1357014
* powerpc/mm: Use read barrier when creating real_pte
  - LP: #1357014
* powerpc/thp: Add tracepoints to track hugepage invalidate
  - LP: #1357014
* powerpc: subpage_protect: Increase the array size to take care of 64TB
  - LP: #1357014
* mfd: rtsx: Add set pull control macro and simplify rtl8411
  - LP: #1361086
* mfd: rtsx: Add support for card reader rtl8402
  - LP: #1361086
* kvm: iommu: fix the third parameter of kvm_iommu_put_pages
  (CVE-2014-3601)
  - LP: #1362443
  - CVE-2014-3601
* isofs: Fix unbounded recursion when processing relocated directories
  - LP: #1362447, #1362448
  - CVE-2014-5472
* net: sctp: inherit auth_capable on INIT collisions
  - LP: #1349804
  - CVE-2014-5077
* blk-mq: fix initializing request's start time
  - LP: #1297522
* SAUCE: (no-up) dt-bindings: Add Potenza PMU binding
  - LP: #1357527
* SAUCE: (no-up) arm64: dts: Add PMU node for APM X-Gene Storm SOC
  - LP: #1357527

Show diffs side-by-side

added added

removed removed

Lines of Context:
191
191
                        BPP_LDO_POWB, BPP_LDO_SUSPEND);
192
192
}
193
193
 
194
 
static int rtl8411_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
 
194
static int rtl8411_do_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage,
 
195
                int bpp_tuned18_shift, int bpp_asic_1v8)
195
196
{
196
197
        u8 mask, val;
197
198
        int err;
198
199
 
199
 
        mask = (BPP_REG_TUNED18 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_MASK;
 
200
        mask = (BPP_REG_TUNED18 << bpp_tuned18_shift) | BPP_PAD_MASK;
200
201
        if (voltage == OUTPUT_3V3) {
201
202
                err = rtsx_pci_write_register(pcr,
202
203
                                SD30_DRIVE_SEL, 0x07, pcr->sd30_drive_sel_3v3);
203
204
                if (err < 0)
204
205
                        return err;
205
 
                val = (BPP_ASIC_3V3 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_3V3;
 
206
                val = (BPP_ASIC_3V3 << bpp_tuned18_shift) | BPP_PAD_3V3;
206
207
        } else if (voltage == OUTPUT_1V8) {
207
208
                err = rtsx_pci_write_register(pcr,
208
209
                                SD30_DRIVE_SEL, 0x07, pcr->sd30_drive_sel_1v8);
209
210
                if (err < 0)
210
211
                        return err;
211
 
                val = (BPP_ASIC_1V8 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_1V8;
 
212
                val = (bpp_asic_1v8 << bpp_tuned18_shift) | BPP_PAD_1V8;
212
213
        } else {
213
214
                return -EINVAL;
214
215
        }
216
217
        return rtsx_pci_write_register(pcr, LDO_CTL, mask, val);
217
218
}
218
219
 
 
220
static int rtl8411_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
 
221
{
 
222
        return rtl8411_do_switch_output_voltage(pcr, voltage,
 
223
                        BPP_TUNED18_SHIFT_8411, BPP_ASIC_1V8);
 
224
}
 
225
 
 
226
static int rtl8402_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
 
227
{
 
228
        return rtl8411_do_switch_output_voltage(pcr, voltage,
 
229
                        BPP_TUNED18_SHIFT_8402, BPP_ASIC_2V0);
 
230
}
 
231
 
219
232
static unsigned int rtl8411_cd_deglitch(struct rtsx_pcr *pcr)
220
233
{
221
234
        unsigned int card_exist;
295
308
        .force_power_down = rtl8411_force_power_down,
296
309
};
297
310
 
 
311
static const struct pcr_ops rtl8402_pcr_ops = {
 
312
        .fetch_vendor_settings = rtl8411_fetch_vendor_settings,
 
313
        .extra_init_hw = rtl8411_extra_init_hw,
 
314
        .optimize_phy = NULL,
 
315
        .turn_on_led = rtl8411_turn_on_led,
 
316
        .turn_off_led = rtl8411_turn_off_led,
 
317
        .enable_auto_blink = rtl8411_enable_auto_blink,
 
318
        .disable_auto_blink = rtl8411_disable_auto_blink,
 
319
        .card_power_on = rtl8411_card_power_on,
 
320
        .card_power_off = rtl8411_card_power_off,
 
321
        .switch_output_voltage = rtl8402_switch_output_voltage,
 
322
        .cd_deglitch = rtl8411_cd_deglitch,
 
323
        .conv_clk_and_div_n = rtl8411_conv_clk_and_div_n,
 
324
        .force_power_down = rtl8411_force_power_down,
 
325
};
 
326
 
298
327
static const struct pcr_ops rtl8411b_pcr_ops = {
299
328
        .fetch_vendor_settings = rtl8411b_fetch_vendor_settings,
300
329
        .extra_init_hw = rtl8411b_extra_init_hw,
441
470
        0,
442
471
};
443
472
 
 
473
void rtl8411_init_common_params(struct rtsx_pcr *pcr)
 
474
{
 
475
        pcr->extra_caps = EXTRA_CAPS_SD_SDR50 | EXTRA_CAPS_SD_SDR104;
 
476
        pcr->num_slots = 2;
 
477
        pcr->flags = 0;
 
478
        pcr->card_drive_sel = RTL8411_CARD_DRIVE_DEFAULT;
 
479
        pcr->sd30_drive_sel_1v8 = DRIVER_TYPE_B;
 
480
        pcr->sd30_drive_sel_3v3 = DRIVER_TYPE_D;
 
481
        pcr->aspm_en = ASPM_L1_EN;
 
482
        pcr->tx_initial_phase = SET_CLOCK_PHASE(23, 7, 14);
 
483
        pcr->rx_initial_phase = SET_CLOCK_PHASE(4, 3, 10);
 
484
        pcr->ic_version = rtl8411_get_ic_version(pcr);
 
485
}
 
486
 
444
487
void rtl8411_init_params(struct rtsx_pcr *pcr)
445
488
{
446
 
        pcr->extra_caps = EXTRA_CAPS_SD_SDR50 | EXTRA_CAPS_SD_SDR104;
447
 
        pcr->num_slots = 2;
 
489
        rtl8411_init_common_params(pcr);
448
490
        pcr->ops = &rtl8411_pcr_ops;
449
 
 
450
 
        pcr->flags = 0;
451
 
        pcr->card_drive_sel = RTL8411_CARD_DRIVE_DEFAULT;
452
 
        pcr->sd30_drive_sel_1v8 = DRIVER_TYPE_B;
453
 
        pcr->sd30_drive_sel_3v3 = DRIVER_TYPE_D;
454
 
        pcr->aspm_en = ASPM_L1_EN;
455
 
        pcr->tx_initial_phase = SET_CLOCK_PHASE(23, 7, 14);
456
 
        pcr->rx_initial_phase = SET_CLOCK_PHASE(4, 3, 10);
457
 
 
458
 
        pcr->ic_version = rtl8411_get_ic_version(pcr);
459
 
        pcr->sd_pull_ctl_enable_tbl = rtl8411_sd_pull_ctl_enable_tbl;
460
 
        pcr->sd_pull_ctl_disable_tbl = rtl8411_sd_pull_ctl_disable_tbl;
461
 
        pcr->ms_pull_ctl_enable_tbl = rtl8411_ms_pull_ctl_enable_tbl;
462
 
        pcr->ms_pull_ctl_disable_tbl = rtl8411_ms_pull_ctl_disable_tbl;
 
491
        set_pull_ctrl_tables(pcr, rtl8411);
463
492
}
464
493
 
465
494
void rtl8411b_init_params(struct rtsx_pcr *pcr)
466
495
{
467
 
        pcr->extra_caps = EXTRA_CAPS_SD_SDR50 | EXTRA_CAPS_SD_SDR104;
468
 
        pcr->num_slots = 2;
 
496
        rtl8411_init_common_params(pcr);
469
497
        pcr->ops = &rtl8411b_pcr_ops;
470
 
 
471
 
        pcr->flags = 0;
472
 
        pcr->card_drive_sel = RTL8411_CARD_DRIVE_DEFAULT;
473
 
        pcr->sd30_drive_sel_1v8 = DRIVER_TYPE_B;
474
 
        pcr->sd30_drive_sel_3v3 = DRIVER_TYPE_D;
475
 
        pcr->aspm_en = ASPM_L1_EN;
476
 
        pcr->tx_initial_phase = SET_CLOCK_PHASE(23, 7, 14);
477
 
        pcr->rx_initial_phase = SET_CLOCK_PHASE(4, 3, 10);
478
 
 
479
 
        pcr->ic_version = rtl8411_get_ic_version(pcr);
480
 
 
481
 
        if (rtl8411b_is_qfn48(pcr)) {
482
 
                pcr->sd_pull_ctl_enable_tbl =
483
 
                        rtl8411b_qfn48_sd_pull_ctl_enable_tbl;
484
 
                pcr->sd_pull_ctl_disable_tbl =
485
 
                        rtl8411b_qfn48_sd_pull_ctl_disable_tbl;
486
 
                pcr->ms_pull_ctl_enable_tbl =
487
 
                        rtl8411b_qfn48_ms_pull_ctl_enable_tbl;
488
 
                pcr->ms_pull_ctl_disable_tbl =
489
 
                        rtl8411b_qfn48_ms_pull_ctl_disable_tbl;
490
 
        } else {
491
 
                pcr->sd_pull_ctl_enable_tbl =
492
 
                        rtl8411b_qfn64_sd_pull_ctl_enable_tbl;
493
 
                pcr->sd_pull_ctl_disable_tbl =
494
 
                        rtl8411b_qfn64_sd_pull_ctl_disable_tbl;
495
 
                pcr->ms_pull_ctl_enable_tbl =
496
 
                        rtl8411b_qfn64_ms_pull_ctl_enable_tbl;
497
 
                pcr->ms_pull_ctl_disable_tbl =
498
 
                        rtl8411b_qfn64_ms_pull_ctl_disable_tbl;
499
 
        }
 
498
        if (rtl8411b_is_qfn48(pcr))
 
499
                set_pull_ctrl_tables(pcr, rtl8411b_qfn48);
 
500
        else
 
501
                set_pull_ctrl_tables(pcr, rtl8411b_qfn64);
 
502
}
 
503
 
 
504
void rtl8402_init_params(struct rtsx_pcr *pcr)
 
505
{
 
506
        rtl8411_init_common_params(pcr);
 
507
        pcr->ops = &rtl8402_pcr_ops;
 
508
        set_pull_ctrl_tables(pcr, rtl8411);
500
509
}