Lines Matching refs:host

33 static inline struct device *ms_dev(struct realtek_pci_ms *host)
35 return &(host->pdev->dev);
38 static inline void ms_clear_error(struct realtek_pci_ms *host)
40 rtsx_pci_write_register(host->pcr, CARD_STOP,
46 static void ms_print_debug_regs(struct realtek_pci_ms *host)
48 struct rtsx_pcr *pcr = host->pcr;
52 /* Print MS host internal registers */
62 dev_dbg(ms_dev(host), "0x%04X: 0x%02x\n", i, *(ptr++));
64 dev_dbg(ms_dev(host), "0x%04X: 0x%02x\n", i, *(ptr++));
69 #define ms_print_debug_regs(host)
73 static int ms_power_on(struct realtek_pci_ms *host)
75 struct rtsx_pcr *pcr = host->pcr;
107 static int ms_power_off(struct realtek_pci_ms *host)
109 struct rtsx_pcr *pcr = host->pcr;
128 static int ms_transfer_data(struct realtek_pci_ms *host, unsigned char data_dir,
131 struct rtsx_pcr *pcr = host->pcr;
136 struct memstick_dev *card = host->msh->card;
139 dev_dbg(ms_dev(host), "%s: tpc = 0x%02x, data_dir = %s, length = %d\n",
182 ms_clear_error(host);
199 static int ms_write_bytes(struct realtek_pci_ms *host, u8 tpc,
202 struct rtsx_pcr *pcr = host->pcr;
205 dev_dbg(ms_dev(host), "%s: tpc = 0x%02x\n", __func__, tpc);
237 dev_dbg(ms_dev(host), "MS_TRANS_CFG: 0x%02x\n", val);
242 ms_print_debug_regs(host);
244 ms_clear_error(host);
267 static int ms_read_bytes(struct realtek_pci_ms *host, u8 tpc,
270 struct rtsx_pcr *pcr = host->pcr;
274 dev_dbg(ms_dev(host), "%s: tpc = 0x%02x\n", __func__, tpc);
306 dev_dbg(ms_dev(host), "MS_TRANS_CFG: 0x%02x\n", val);
311 ms_print_debug_regs(host);
313 ms_clear_error(host);
338 static int rtsx_pci_ms_issue_cmd(struct realtek_pci_ms *host)
340 struct memstick_request *req = host->req;
344 dev_dbg(ms_dev(host), "%s\n", __func__);
347 if (host->ifmode != MEMSTICK_SERIAL)
352 err = ms_transfer_data(host, req->data_dir,
356 err = ms_read_bytes(host, req->tpc, cfg,
359 err = ms_write_bytes(host, req->tpc, cfg,
366 if (req->need_card_int && (host->ifmode == MEMSTICK_SERIAL)) {
367 err = ms_read_bytes(host, MS_TPC_GET_INT,
374 dev_dbg(ms_dev(host), "int_reg: 0x%02x\n", int_reg);
391 struct realtek_pci_ms *host = container_of(work,
393 struct rtsx_pcr *pcr = host->pcr;
394 struct memstick_host *msh = host->msh;
401 rtsx_pci_switch_clock(host->pcr, host->clock, host->ssc_depth,
407 if (!host->req) {
409 rc = memstick_next_req(msh, &host->req);
410 dev_dbg(ms_dev(host), "next req %d\n", rc);
413 host->req->error = rtsx_pci_ms_issue_cmd(host);
422 struct realtek_pci_ms *host = memstick_priv(msh);
424 dev_dbg(ms_dev(host), "--> %s\n", __func__);
426 if (rtsx_pci_card_exclusive_check(host->pcr, RTSX_MS_CARD))
429 schedule_work(&host->handle_req);
435 struct realtek_pci_ms *host = memstick_priv(msh);
436 struct rtsx_pcr *pcr = host->pcr;
441 dev_dbg(ms_dev(host), "%s: param = %d, value = %d\n",
444 err = rtsx_pci_card_exclusive_check(host->pcr, RTSX_MS_CARD);
451 err = ms_power_on(host);
453 err = ms_power_off(host);
484 host->ssc_depth = ssc_depth;
485 host->clock = clock;
486 host->ifmode = value;
497 struct realtek_pci_ms *host = platform_get_drvdata(pdev);
498 struct memstick_host *msh = host->msh;
500 dev_dbg(ms_dev(host), "--> %s\n", __func__);
508 struct realtek_pci_ms *host = platform_get_drvdata(pdev);
509 struct memstick_host *msh = host->msh;
511 dev_dbg(ms_dev(host), "--> %s\n", __func__);
526 struct realtek_pci_ms *host = platform_get_drvdata(pdev);
528 memstick_detect_change(host->msh);
534 struct realtek_pci_ms *host;
549 msh = memstick_alloc_host(sizeof(*host), &pdev->dev);
553 host = memstick_priv(msh);
554 host->pcr = pcr;
555 host->msh = msh;
556 host->pdev = pdev;
557 platform_set_drvdata(pdev, host);
561 mutex_init(&host->host_mutex);
563 INIT_WORK(&host->handle_req, rtsx_pci_ms_handle_req);
579 struct realtek_pci_ms *host = platform_get_drvdata(pdev);
584 pcr = host->pcr;
587 msh = host->msh;
588 host->eject = true;
589 cancel_work_sync(&host->handle_req);
591 mutex_lock(&host->host_mutex);
592 if (host->req) {
599 host->req->error = -ENOMEDIUM;
601 rc = memstick_next_req(msh, &host->req);
603 host->req->error = -ENOMEDIUM;
606 mutex_unlock(&host->host_mutex);