Lines Matching refs:host
45 static inline struct device *ms_dev(struct realtek_pci_ms *host) in ms_dev() argument
47 return &(host->pdev->dev); in ms_dev()
50 static inline void ms_clear_error(struct realtek_pci_ms *host) in ms_clear_error() argument
52 rtsx_pci_write_register(host->pcr, CARD_STOP, in ms_clear_error()
58 static void ms_print_debug_regs(struct realtek_pci_ms *host) in ms_print_debug_regs() argument
60 struct rtsx_pcr *pcr = host->pcr; in ms_print_debug_regs()
74 dev_dbg(ms_dev(host), "0x%04X: 0x%02x\n", i, *(ptr++)); in ms_print_debug_regs()
76 dev_dbg(ms_dev(host), "0x%04X: 0x%02x\n", i, *(ptr++)); in ms_print_debug_regs()
81 #define ms_print_debug_regs(host) argument
85 static int ms_power_on(struct realtek_pci_ms *host) in ms_power_on() argument
87 struct rtsx_pcr *pcr = host->pcr; in ms_power_on()
119 static int ms_power_off(struct realtek_pci_ms *host) in ms_power_off() argument
121 struct rtsx_pcr *pcr = host->pcr; in ms_power_off()
140 static int ms_transfer_data(struct realtek_pci_ms *host, unsigned char data_dir, in ms_transfer_data() argument
143 struct rtsx_pcr *pcr = host->pcr; in ms_transfer_data()
148 struct memstick_dev *card = host->msh->card; in ms_transfer_data()
151 dev_dbg(ms_dev(host), "%s: tpc = 0x%02x, data_dir = %s, length = %d\n", in ms_transfer_data()
194 ms_clear_error(host); in ms_transfer_data()
211 static int ms_write_bytes(struct realtek_pci_ms *host, u8 tpc, in ms_write_bytes() argument
214 struct rtsx_pcr *pcr = host->pcr; in ms_write_bytes()
217 dev_dbg(ms_dev(host), "%s: tpc = 0x%02x\n", __func__, tpc); in ms_write_bytes()
249 dev_dbg(ms_dev(host), "MS_TRANS_CFG: 0x%02x\n", val); in ms_write_bytes()
254 ms_print_debug_regs(host); in ms_write_bytes()
256 ms_clear_error(host); in ms_write_bytes()
279 static int ms_read_bytes(struct realtek_pci_ms *host, u8 tpc, in ms_read_bytes() argument
282 struct rtsx_pcr *pcr = host->pcr; in ms_read_bytes()
286 dev_dbg(ms_dev(host), "%s: tpc = 0x%02x\n", __func__, tpc); in ms_read_bytes()
318 dev_dbg(ms_dev(host), "MS_TRANS_CFG: 0x%02x\n", val); in ms_read_bytes()
323 ms_print_debug_regs(host); in ms_read_bytes()
325 ms_clear_error(host); in ms_read_bytes()
350 static int rtsx_pci_ms_issue_cmd(struct realtek_pci_ms *host) in rtsx_pci_ms_issue_cmd() argument
352 struct memstick_request *req = host->req; in rtsx_pci_ms_issue_cmd()
356 dev_dbg(ms_dev(host), "%s\n", __func__); in rtsx_pci_ms_issue_cmd()
359 if (host->ifmode != MEMSTICK_SERIAL) in rtsx_pci_ms_issue_cmd()
364 err = ms_transfer_data(host, req->data_dir, in rtsx_pci_ms_issue_cmd()
368 err = ms_read_bytes(host, req->tpc, cfg, in rtsx_pci_ms_issue_cmd()
371 err = ms_write_bytes(host, req->tpc, cfg, in rtsx_pci_ms_issue_cmd()
378 if (req->need_card_int && (host->ifmode == MEMSTICK_SERIAL)) { in rtsx_pci_ms_issue_cmd()
379 err = ms_read_bytes(host, MS_TPC_GET_INT, in rtsx_pci_ms_issue_cmd()
386 dev_dbg(ms_dev(host), "int_reg: 0x%02x\n", int_reg); in rtsx_pci_ms_issue_cmd()
403 struct realtek_pci_ms *host = container_of(work, in rtsx_pci_ms_handle_req() local
405 struct rtsx_pcr *pcr = host->pcr; in rtsx_pci_ms_handle_req()
406 struct memstick_host *msh = host->msh; in rtsx_pci_ms_handle_req()
413 rtsx_pci_switch_clock(host->pcr, host->clock, host->ssc_depth, in rtsx_pci_ms_handle_req()
419 if (!host->req) { in rtsx_pci_ms_handle_req()
421 rc = memstick_next_req(msh, &host->req); in rtsx_pci_ms_handle_req()
422 dev_dbg(ms_dev(host), "next req %d\n", rc); in rtsx_pci_ms_handle_req()
425 host->req->error = rtsx_pci_ms_issue_cmd(host); in rtsx_pci_ms_handle_req()
434 struct realtek_pci_ms *host = memstick_priv(msh); in rtsx_pci_ms_request() local
436 dev_dbg(ms_dev(host), "--> %s\n", __func__); in rtsx_pci_ms_request()
438 if (rtsx_pci_card_exclusive_check(host->pcr, RTSX_MS_CARD)) in rtsx_pci_ms_request()
441 schedule_work(&host->handle_req); in rtsx_pci_ms_request()
447 struct realtek_pci_ms *host = memstick_priv(msh); in rtsx_pci_ms_set_param() local
448 struct rtsx_pcr *pcr = host->pcr; in rtsx_pci_ms_set_param()
453 dev_dbg(ms_dev(host), "%s: param = %d, value = %d\n", in rtsx_pci_ms_set_param()
456 err = rtsx_pci_card_exclusive_check(host->pcr, RTSX_MS_CARD); in rtsx_pci_ms_set_param()
463 err = ms_power_on(host); in rtsx_pci_ms_set_param()
465 err = ms_power_off(host); in rtsx_pci_ms_set_param()
496 host->ssc_depth = ssc_depth; in rtsx_pci_ms_set_param()
497 host->clock = clock; in rtsx_pci_ms_set_param()
498 host->ifmode = value; in rtsx_pci_ms_set_param()
509 struct realtek_pci_ms *host = platform_get_drvdata(pdev); in rtsx_pci_ms_suspend() local
510 struct memstick_host *msh = host->msh; in rtsx_pci_ms_suspend()
512 dev_dbg(ms_dev(host), "--> %s\n", __func__); in rtsx_pci_ms_suspend()
520 struct realtek_pci_ms *host = platform_get_drvdata(pdev); in rtsx_pci_ms_resume() local
521 struct memstick_host *msh = host->msh; in rtsx_pci_ms_resume()
523 dev_dbg(ms_dev(host), "--> %s\n", __func__); in rtsx_pci_ms_resume()
538 struct realtek_pci_ms *host = platform_get_drvdata(pdev); in rtsx_pci_ms_card_event() local
540 memstick_detect_change(host->msh); in rtsx_pci_ms_card_event()
546 struct realtek_pci_ms *host; in rtsx_pci_ms_drv_probe() local
561 msh = memstick_alloc_host(sizeof(*host), &pdev->dev); in rtsx_pci_ms_drv_probe()
565 host = memstick_priv(msh); in rtsx_pci_ms_drv_probe()
566 host->pcr = pcr; in rtsx_pci_ms_drv_probe()
567 host->msh = msh; in rtsx_pci_ms_drv_probe()
568 host->pdev = pdev; in rtsx_pci_ms_drv_probe()
569 platform_set_drvdata(pdev, host); in rtsx_pci_ms_drv_probe()
573 mutex_init(&host->host_mutex); in rtsx_pci_ms_drv_probe()
575 INIT_WORK(&host->handle_req, rtsx_pci_ms_handle_req); in rtsx_pci_ms_drv_probe()
591 struct realtek_pci_ms *host = platform_get_drvdata(pdev); in rtsx_pci_ms_drv_remove() local
596 if (!host) in rtsx_pci_ms_drv_remove()
599 pcr = host->pcr; in rtsx_pci_ms_drv_remove()
602 msh = host->msh; in rtsx_pci_ms_drv_remove()
603 host->eject = true; in rtsx_pci_ms_drv_remove()
604 cancel_work_sync(&host->handle_req); in rtsx_pci_ms_drv_remove()
606 mutex_lock(&host->host_mutex); in rtsx_pci_ms_drv_remove()
607 if (host->req) { in rtsx_pci_ms_drv_remove()
614 host->req->error = -ENOMEDIUM; in rtsx_pci_ms_drv_remove()
616 rc = memstick_next_req(msh, &host->req); in rtsx_pci_ms_drv_remove()
618 host->req->error = -ENOMEDIUM; in rtsx_pci_ms_drv_remove()
621 mutex_unlock(&host->host_mutex); in rtsx_pci_ms_drv_remove()