Lines Matching refs:sm
133 static void sm501_dump_clk(struct sm501_devdata *sm) in sm501_dump_clk() argument
135 unsigned long misct = smc501_readl(sm->regs + SM501_MISC_TIMING); in sm501_dump_clk()
136 unsigned long pm0 = smc501_readl(sm->regs + SM501_POWER_MODE_0_CLOCK); in sm501_dump_clk()
137 unsigned long pm1 = smc501_readl(sm->regs + SM501_POWER_MODE_1_CLOCK); in sm501_dump_clk()
138 unsigned long pmc = smc501_readl(sm->regs + SM501_POWER_MODE_CONTROL); in sm501_dump_clk()
163 dev_dbg(sm->dev, "MISCT=%08lx, PM0=%08lx, PM1=%08lx\n", in sm501_dump_clk()
166 dev_dbg(sm->dev, "PLL2 = %ld.%ld MHz (%ld), SDCLK0=%08lx, SDCLK1=%08lx\n", in sm501_dump_clk()
169 dev_dbg(sm->dev, "SDRAM: PM0=%ld, PM1=%ld\n", sdclk0, sdclk1); in sm501_dump_clk()
171 dev_dbg(sm->dev, "PM0[%c]: " in sm501_dump_clk()
180 dev_dbg(sm->dev, "PM1[%c]: " in sm501_dump_clk()
190 static void sm501_dump_regs(struct sm501_devdata *sm) in sm501_dump_regs() argument
192 void __iomem *regs = sm->regs; in sm501_dump_regs()
194 dev_info(sm->dev, "System Control %08x\n", in sm501_dump_regs()
196 dev_info(sm->dev, "Misc Control %08x\n", in sm501_dump_regs()
198 dev_info(sm->dev, "GPIO Control Low %08x\n", in sm501_dump_regs()
200 dev_info(sm->dev, "GPIO Control Hi %08x\n", in sm501_dump_regs()
202 dev_info(sm->dev, "DRAM Control %08x\n", in sm501_dump_regs()
204 dev_info(sm->dev, "Arbitration Ctrl %08x\n", in sm501_dump_regs()
206 dev_info(sm->dev, "Misc Timing %08x\n", in sm501_dump_regs()
210 static void sm501_dump_gate(struct sm501_devdata *sm) in sm501_dump_gate() argument
212 dev_info(sm->dev, "CurrentGate %08x\n", in sm501_dump_gate()
213 smc501_readl(sm->regs + SM501_CURRENT_GATE)); in sm501_dump_gate()
214 dev_info(sm->dev, "CurrentClock %08x\n", in sm501_dump_gate()
215 smc501_readl(sm->regs + SM501_CURRENT_CLOCK)); in sm501_dump_gate()
216 dev_info(sm->dev, "PowerModeControl %08x\n", in sm501_dump_gate()
217 smc501_readl(sm->regs + SM501_POWER_MODE_CONTROL)); in sm501_dump_gate()
221 static inline void sm501_dump_gate(struct sm501_devdata *sm) { } in sm501_dump_gate() argument
222 static inline void sm501_dump_regs(struct sm501_devdata *sm) { } in sm501_dump_regs() argument
223 static inline void sm501_dump_clk(struct sm501_devdata *sm) { } in sm501_dump_clk() argument
231 static void sm501_sync_regs(struct sm501_devdata *sm) in sm501_sync_regs() argument
233 smc501_readl(sm->regs); in sm501_sync_regs()
236 static inline void sm501_mdelay(struct sm501_devdata *sm, unsigned int delay) in sm501_mdelay() argument
242 if (sm->in_suspend) in sm501_mdelay()
256 struct sm501_devdata *sm = dev_get_drvdata(dev); in sm501_misc_control() local
261 spin_lock_irqsave(&sm->reg_lock, save); in sm501_misc_control()
263 misc = smc501_readl(sm->regs + SM501_MISC_CONTROL); in sm501_misc_control()
267 smc501_writel(to, sm->regs + SM501_MISC_CONTROL); in sm501_misc_control()
268 sm501_sync_regs(sm); in sm501_misc_control()
270 dev_dbg(sm->dev, "MISC_CONTROL %08lx\n", misc); in sm501_misc_control()
273 spin_unlock_irqrestore(&sm->reg_lock, save); in sm501_misc_control()
290 struct sm501_devdata *sm = dev_get_drvdata(dev); in sm501_modify_reg() local
294 spin_lock_irqsave(&sm->reg_lock, save); in sm501_modify_reg()
296 data = smc501_readl(sm->regs + reg); in sm501_modify_reg()
300 smc501_writel(data, sm->regs + reg); in sm501_modify_reg()
301 sm501_sync_regs(sm); in sm501_modify_reg()
303 spin_unlock_irqrestore(&sm->reg_lock, save); in sm501_modify_reg()
317 struct sm501_devdata *sm = dev_get_drvdata(dev); in sm501_unit_power() local
322 mutex_lock(&sm->clock_lock); in sm501_unit_power()
324 mode = smc501_readl(sm->regs + SM501_POWER_MODE_CONTROL); in sm501_unit_power()
325 gate = smc501_readl(sm->regs + SM501_CURRENT_GATE); in sm501_unit_power()
326 clock = smc501_readl(sm->regs + SM501_CURRENT_CLOCK); in sm501_unit_power()
330 if (unit >= ARRAY_SIZE(sm->unit_power)) { in sm501_unit_power()
335 dev_dbg(sm->dev, "%s: unit %d, cur %d, to %d\n", __func__, unit, in sm501_unit_power()
336 sm->unit_power[unit], to); in sm501_unit_power()
338 if (to == 0 && sm->unit_power[unit] == 0) { in sm501_unit_power()
339 dev_err(sm->dev, "unit %d is already shutdown\n", unit); in sm501_unit_power()
343 sm->unit_power[unit] += to ? 1 : -1; in sm501_unit_power()
344 to = sm->unit_power[unit] ? 1 : 0; in sm501_unit_power()
358 smc501_writel(gate, sm->regs + SM501_POWER_MODE_0_GATE); in sm501_unit_power()
359 smc501_writel(clock, sm->regs + SM501_POWER_MODE_0_CLOCK); in sm501_unit_power()
364 smc501_writel(gate, sm->regs + SM501_POWER_MODE_1_GATE); in sm501_unit_power()
365 smc501_writel(clock, sm->regs + SM501_POWER_MODE_1_CLOCK); in sm501_unit_power()
374 smc501_writel(mode, sm->regs + SM501_POWER_MODE_CONTROL); in sm501_unit_power()
375 sm501_sync_regs(sm); in sm501_unit_power()
377 dev_dbg(sm->dev, "gate %08lx, clock %08lx, mode %08lx\n", in sm501_unit_power()
380 sm501_mdelay(sm, 16); in sm501_unit_power()
383 mutex_unlock(&sm->clock_lock); in sm501_unit_power()
512 struct sm501_devdata *sm = dev_get_drvdata(dev); in sm501_set_clock() local
513 unsigned long mode = smc501_readl(sm->regs + SM501_POWER_MODE_CONTROL); in sm501_set_clock()
514 unsigned long gate = smc501_readl(sm->regs + SM501_CURRENT_GATE); in sm501_set_clock()
515 unsigned long clock = smc501_readl(sm->regs + SM501_CURRENT_CLOCK); in sm501_set_clock()
532 if (sm->rev >= 0xC0) { in sm501_set_clock()
584 mutex_lock(&sm->clock_lock); in sm501_set_clock()
586 mode = smc501_readl(sm->regs + SM501_POWER_MODE_CONTROL); in sm501_set_clock()
587 gate = smc501_readl(sm->regs + SM501_CURRENT_GATE); in sm501_set_clock()
588 clock = smc501_readl(sm->regs + SM501_CURRENT_CLOCK); in sm501_set_clock()
597 smc501_writel(gate, sm->regs + SM501_POWER_MODE_0_GATE); in sm501_set_clock()
598 smc501_writel(clock, sm->regs + SM501_POWER_MODE_0_CLOCK); in sm501_set_clock()
603 smc501_writel(gate, sm->regs + SM501_POWER_MODE_1_GATE); in sm501_set_clock()
604 smc501_writel(clock, sm->regs + SM501_POWER_MODE_1_CLOCK); in sm501_set_clock()
609 mutex_unlock(&sm->clock_lock); in sm501_set_clock()
613 smc501_writel(mode, sm->regs + SM501_POWER_MODE_CONTROL); in sm501_set_clock()
617 sm->regs + SM501_PROGRAMMABLE_PLL_CONTROL); in sm501_set_clock()
619 sm501_sync_regs(sm); in sm501_set_clock()
621 dev_dbg(sm->dev, "gate %08lx, clock %08lx, mode %08lx\n", in sm501_set_clock()
624 sm501_mdelay(sm, 16); in sm501_set_clock()
625 mutex_unlock(&sm->clock_lock); in sm501_set_clock()
627 sm501_dump_clk(sm); in sm501_set_clock()
643 struct sm501_devdata *sm = dev_get_drvdata(dev); in sm501_find_clock() local
649 if (sm->rev >= 0xC0) { in sm501_find_clock()
700 sm501_create_subdev(struct sm501_devdata *sm, char *name, in sm501_create_subdev() argument
714 smdev->pdev.id = sm->pdev_id; in sm501_create_subdev()
715 smdev->pdev.dev.parent = sm->dev; in sm501_create_subdev()
733 static int sm501_register_device(struct sm501_devdata *sm, in sm501_register_device() argument
748 dev_dbg(sm->dev, "registered %s\n", pdev->name); in sm501_register_device()
749 list_add_tail(&smdev->list, &sm->devices); in sm501_register_device()
751 dev_err(sm->dev, "error registering %s (%d)\n", in sm501_register_device()
762 static void sm501_create_subio(struct sm501_devdata *sm, in sm501_create_subio() argument
768 res->parent = sm->io_res; in sm501_create_subio()
769 res->start = sm->io_res->start + offs; in sm501_create_subio()
778 static void sm501_create_mem(struct sm501_devdata *sm, in sm501_create_mem() argument
786 res->parent = sm->mem_res; in sm501_create_mem()
787 res->start = sm->mem_res->start + *offs; in sm501_create_mem()
796 static void sm501_create_irq(struct sm501_devdata *sm, in sm501_create_irq() argument
801 res->start = res->end = sm->irq; in sm501_create_irq()
804 static int sm501_register_usbhost(struct sm501_devdata *sm, in sm501_register_usbhost() argument
809 pdev = sm501_create_subdev(sm, "sm501-usb", 3, 0); in sm501_register_usbhost()
813 sm501_create_subio(sm, &pdev->resource[0], 0x40000, 0x20000); in sm501_register_usbhost()
814 sm501_create_mem(sm, &pdev->resource[1], mem_avail, 256*1024); in sm501_register_usbhost()
815 sm501_create_irq(sm, &pdev->resource[2]); in sm501_register_usbhost()
817 return sm501_register_device(sm, pdev); in sm501_register_usbhost()
820 static void sm501_setup_uart_data(struct sm501_devdata *sm, in sm501_setup_uart_data() argument
824 uart_data->membase = sm->regs + offset; in sm501_setup_uart_data()
825 uart_data->mapbase = sm->io_res->start + offset; in sm501_setup_uart_data()
827 uart_data->irq = sm->irq; in sm501_setup_uart_data()
833 static int sm501_register_uart(struct sm501_devdata *sm, int devices) in sm501_register_uart() argument
838 pdev = sm501_create_subdev(sm, "serial8250", 0, in sm501_register_uart()
846 sm501_setup_uart_data(sm, uart_data++, 0x30000); in sm501_register_uart()
847 sm501_unit_power(sm->dev, SM501_GATE_UART0, 1); in sm501_register_uart()
848 sm501_modify_reg(sm->dev, SM501_IRQ_MASK, 1 << 12, 0); in sm501_register_uart()
849 sm501_modify_reg(sm->dev, SM501_GPIO63_32_CONTROL, 0x01e0, 0); in sm501_register_uart()
852 sm501_setup_uart_data(sm, uart_data++, 0x30020); in sm501_register_uart()
853 sm501_unit_power(sm->dev, SM501_GATE_UART1, 1); in sm501_register_uart()
854 sm501_modify_reg(sm->dev, SM501_IRQ_MASK, 1 << 13, 0); in sm501_register_uart()
855 sm501_modify_reg(sm->dev, SM501_GPIO63_32_CONTROL, 0x1e00, 0); in sm501_register_uart()
860 return sm501_register_device(sm, pdev); in sm501_register_uart()
863 static int sm501_register_display(struct sm501_devdata *sm, in sm501_register_display() argument
868 pdev = sm501_create_subdev(sm, "sm501-fb", 4, 0); in sm501_register_display()
872 sm501_create_subio(sm, &pdev->resource[0], 0x80000, 0x10000); in sm501_register_display()
873 sm501_create_subio(sm, &pdev->resource[1], 0x100000, 0x50000); in sm501_register_display()
874 sm501_create_mem(sm, &pdev->resource[2], mem_avail, *mem_avail); in sm501_register_display()
875 sm501_create_irq(sm, &pdev->resource[3]); in sm501_register_display()
877 return sm501_register_device(sm, pdev); in sm501_register_display()
1012 static int sm501_gpio_register_chip(struct sm501_devdata *sm, in sm501_gpio_register_chip() argument
1016 struct sm501_platdata *pdata = sm->platdata; in sm501_gpio_register_chip()
1026 chip->control = sm->regs + SM501_GPIO63_32_CONTROL; in sm501_gpio_register_chip()
1030 chip->control = sm->regs + SM501_GPIO31_0_CONTROL; in sm501_gpio_register_chip()
1040 static int sm501_register_gpio(struct sm501_devdata *sm) in sm501_register_gpio() argument
1042 struct sm501_gpio *gpio = &sm->gpio; in sm501_register_gpio()
1043 resource_size_t iobase = sm->io_res->start + SM501_GPIO; in sm501_register_gpio()
1046 dev_dbg(sm->dev, "registering gpio block %08llx\n", in sm501_register_gpio()
1053 dev_err(sm->dev, "gpio: failed to request region\n"); in sm501_register_gpio()
1059 dev_err(sm->dev, "gpio: failed to remap registers\n"); in sm501_register_gpio()
1066 ret = sm501_gpio_register_chip(sm, gpio, &gpio->low); in sm501_register_gpio()
1068 dev_err(sm->dev, "failed to add low chip\n"); in sm501_register_gpio()
1072 ret = sm501_gpio_register_chip(sm, gpio, &gpio->high); in sm501_register_gpio()
1074 dev_err(sm->dev, "failed to add high chip\n"); in sm501_register_gpio()
1094 static void sm501_gpio_remove(struct sm501_devdata *sm) in sm501_gpio_remove() argument
1096 struct sm501_gpio *gpio = &sm->gpio; in sm501_gpio_remove()
1097 resource_size_t iobase = sm->io_res->start + SM501_GPIO; in sm501_gpio_remove()
1099 if (!sm->gpio.registered) in sm501_gpio_remove()
1109 static inline int sm501_gpio_isregistered(struct sm501_devdata *sm) in sm501_gpio_isregistered() argument
1111 return sm->gpio.registered; in sm501_gpio_isregistered()
1114 static inline int sm501_register_gpio(struct sm501_devdata *sm) in sm501_register_gpio() argument
1119 static inline void sm501_gpio_remove(struct sm501_devdata *sm) in sm501_gpio_remove() argument
1123 static inline int sm501_gpio_isregistered(struct sm501_devdata *sm) in sm501_gpio_isregistered() argument
1129 static int sm501_register_gpio_i2c_instance(struct sm501_devdata *sm, in sm501_register_gpio_i2c_instance() argument
1136 pdev = sm501_create_subdev(sm, "i2c-gpio", 0, in sm501_register_gpio_i2c_instance()
1170 dev_info(sm->dev, "registering i2c-%d: sda=%d, scl=%d\n", in sm501_register_gpio_i2c_instance()
1174 return sm501_register_device(sm, pdev); in sm501_register_gpio_i2c_instance()
1177 static int sm501_register_gpio_i2c(struct sm501_devdata *sm, in sm501_register_gpio_i2c() argument
1185 ret = sm501_register_gpio_i2c_instance(sm, iic); in sm501_register_gpio_i2c()
1201 struct sm501_devdata *sm = dev_get_drvdata(dev) ; in dbg_regs_show() local
1208 reg, smc501_readl(sm->regs + reg)); in dbg_regs_show()
1226 static inline void sm501_init_reg(struct sm501_devdata *sm, in sm501_init_reg() argument
1232 tmp = smc501_readl(sm->regs + reg); in sm501_init_reg()
1235 smc501_writel(tmp, sm->regs + reg); in sm501_init_reg()
1243 static void sm501_init_regs(struct sm501_devdata *sm, in sm501_init_regs() argument
1246 sm501_misc_control(sm->dev, in sm501_init_regs()
1250 sm501_init_reg(sm, SM501_MISC_TIMING, &init->misc_timing); in sm501_init_regs()
1251 sm501_init_reg(sm, SM501_GPIO31_0_CONTROL, &init->gpio_low); in sm501_init_regs()
1252 sm501_init_reg(sm, SM501_GPIO63_32_CONTROL, &init->gpio_high); in sm501_init_regs()
1255 dev_info(sm->dev, "setting M1XCLK to %ld\n", init->m1xclk); in sm501_init_regs()
1256 sm501_set_clock(sm->dev, SM501_CLOCK_M1XCLK, init->m1xclk); in sm501_init_regs()
1260 dev_info(sm->dev, "setting MCLK to %ld\n", init->mclk); in sm501_init_regs()
1261 sm501_set_clock(sm->dev, SM501_CLOCK_MCLK, init->mclk); in sm501_init_regs()
1274 static int sm501_check_clocks(struct sm501_devdata *sm) in sm501_check_clocks() argument
1276 unsigned long pwrmode = smc501_readl(sm->regs + SM501_CURRENT_CLOCK); in sm501_check_clocks()
1297 static int sm501_init_dev(struct sm501_devdata *sm) in sm501_init_dev() argument
1306 mutex_init(&sm->clock_lock); in sm501_init_dev()
1307 spin_lock_init(&sm->reg_lock); in sm501_init_dev()
1309 INIT_LIST_HEAD(&sm->devices); in sm501_init_dev()
1311 devid = smc501_readl(sm->regs + SM501_DEVICEID); in sm501_init_dev()
1314 dev_err(sm->dev, "incorrect device id %08lx\n", devid); in sm501_init_dev()
1319 smc501_writel(0, sm->regs + SM501_IRQ_MASK); in sm501_init_dev()
1321 dramctrl = smc501_readl(sm->regs + SM501_DRAM_CONTROL); in sm501_init_dev()
1324 dev_info(sm->dev, "SM501 At %p: Version %08lx, %ld Mb, IRQ %d\n", in sm501_init_dev()
1325 sm->regs, devid, (unsigned long)mem_avail >> 20, sm->irq); in sm501_init_dev()
1327 sm->rev = devid & SM501_DEVICEID_REVMASK; in sm501_init_dev()
1329 sm501_dump_gate(sm); in sm501_init_dev()
1331 ret = device_create_file(sm->dev, &dev_attr_dbg_regs); in sm501_init_dev()
1333 dev_err(sm->dev, "failed to create debug regs file\n"); in sm501_init_dev()
1335 sm501_dump_clk(sm); in sm501_init_dev()
1339 pdata = sm->platdata; in sm501_init_dev()
1343 sm501_init_regs(sm, idata); in sm501_init_dev()
1346 sm501_register_usbhost(sm, &mem_avail); in sm501_init_dev()
1348 sm501_register_uart(sm, idata->devices); in sm501_init_dev()
1350 sm501_register_gpio(sm); in sm501_init_dev()
1354 if (!sm501_gpio_isregistered(sm)) in sm501_init_dev()
1355 dev_err(sm->dev, "no gpio available for i2c gpio.\n"); in sm501_init_dev()
1357 sm501_register_gpio_i2c(sm, pdata); in sm501_init_dev()
1360 ret = sm501_check_clocks(sm); in sm501_init_dev()
1362 dev_err(sm->dev, "M1X and M clocks sourced from different " in sm501_init_dev()
1368 sm501_register_display(sm, &mem_avail); in sm501_init_dev()
1375 struct sm501_devdata *sm; in sm501_plat_probe() local
1378 sm = kzalloc(sizeof(*sm), GFP_KERNEL); in sm501_plat_probe()
1379 if (!sm) { in sm501_plat_probe()
1384 sm->dev = &dev->dev; in sm501_plat_probe()
1385 sm->pdev_id = dev->id; in sm501_plat_probe()
1386 sm->platdata = dev_get_platdata(&dev->dev); in sm501_plat_probe()
1391 sm->irq = ret; in sm501_plat_probe()
1393 sm->io_res = platform_get_resource(dev, IORESOURCE_MEM, 1); in sm501_plat_probe()
1394 sm->mem_res = platform_get_resource(dev, IORESOURCE_MEM, 0); in sm501_plat_probe()
1395 if (!sm->io_res || !sm->mem_res) { in sm501_plat_probe()
1401 sm->regs_claim = request_mem_region(sm->io_res->start, in sm501_plat_probe()
1403 if (!sm->regs_claim) { in sm501_plat_probe()
1409 platform_set_drvdata(dev, sm); in sm501_plat_probe()
1411 sm->regs = ioremap(sm->io_res->start, resource_size(sm->io_res)); in sm501_plat_probe()
1412 if (!sm->regs) { in sm501_plat_probe()
1418 ret = sm501_init_dev(sm); in sm501_plat_probe()
1425 iounmap(sm->regs); in sm501_plat_probe()
1427 release_mem_region(sm->io_res->start, 0x100); in sm501_plat_probe()
1429 kfree(sm); in sm501_plat_probe()
1437 static void sm501_set_power(struct sm501_devdata *sm, int on) in sm501_set_power() argument
1439 struct sm501_platdata *pd = sm->platdata; in sm501_set_power()
1445 if (pd->get_power(sm->dev) == on) { in sm501_set_power()
1446 dev_dbg(sm->dev, "is already %d\n", on); in sm501_set_power()
1452 dev_dbg(sm->dev, "setting power to %d\n", on); in sm501_set_power()
1454 pd->set_power(sm->dev, on); in sm501_set_power()
1455 sm501_mdelay(sm, 10); in sm501_set_power()
1461 struct sm501_devdata *sm = platform_get_drvdata(pdev); in sm501_plat_suspend() local
1463 sm->in_suspend = 1; in sm501_plat_suspend()
1464 sm->pm_misc = smc501_readl(sm->regs + SM501_MISC_CONTROL); in sm501_plat_suspend()
1466 sm501_dump_regs(sm); in sm501_plat_suspend()
1468 if (sm->platdata) { in sm501_plat_suspend()
1469 if (sm->platdata->flags & SM501_FLAG_SUSPEND_OFF) in sm501_plat_suspend()
1470 sm501_set_power(sm, 0); in sm501_plat_suspend()
1478 struct sm501_devdata *sm = platform_get_drvdata(pdev); in sm501_plat_resume() local
1480 sm501_set_power(sm, 1); in sm501_plat_resume()
1482 sm501_dump_regs(sm); in sm501_plat_resume()
1483 sm501_dump_gate(sm); in sm501_plat_resume()
1484 sm501_dump_clk(sm); in sm501_plat_resume()
1488 if (smc501_readl(sm->regs + SM501_MISC_CONTROL) != sm->pm_misc) { in sm501_plat_resume()
1489 dev_info(sm->dev, "SM501_MISC_CONTROL changed over sleep\n"); in sm501_plat_resume()
1490 smc501_writel(sm->pm_misc, sm->regs + SM501_MISC_CONTROL); in sm501_plat_resume()
1496 if (sm->platdata && sm->platdata->init) { in sm501_plat_resume()
1497 sm501_init_regs(sm, sm->platdata->init); in sm501_plat_resume()
1503 sm501_dump_regs(sm); in sm501_plat_resume()
1504 sm501_dump_clk(sm); in sm501_plat_resume()
1506 sm->in_suspend = 0; in sm501_plat_resume()
1558 struct sm501_devdata *sm; in sm501_pci_probe() local
1561 sm = kzalloc(sizeof(*sm), GFP_KERNEL); in sm501_pci_probe()
1562 if (!sm) { in sm501_pci_probe()
1568 dev->dev.platform_data = sm->platdata = &sm501_pci_platdata; in sm501_pci_probe()
1571 sm->pdev_id = 32 + dev->devfn; in sm501_pci_probe()
1573 pci_set_drvdata(dev, sm); in sm501_pci_probe()
1581 sm->dev = &dev->dev; in sm501_pci_probe()
1582 sm->irq = dev->irq; in sm501_pci_probe()
1608 sm->io_res = &dev->resource[1]; in sm501_pci_probe()
1609 sm->mem_res = &dev->resource[0]; in sm501_pci_probe()
1611 sm->regs_claim = request_mem_region(sm->io_res->start, in sm501_pci_probe()
1613 if (!sm->regs_claim) { in sm501_pci_probe()
1619 sm->regs = pci_ioremap_bar(dev, 1); in sm501_pci_probe()
1620 if (!sm->regs) { in sm501_pci_probe()
1626 sm501_init_dev(sm); in sm501_pci_probe()
1630 release_mem_region(sm->io_res->start, 0x100); in sm501_pci_probe()
1634 kfree(sm); in sm501_pci_probe()
1639 static void sm501_remove_sub(struct sm501_devdata *sm, in sm501_remove_sub() argument
1646 static void sm501_dev_remove(struct sm501_devdata *sm) in sm501_dev_remove() argument
1650 list_for_each_entry_safe(smdev, tmp, &sm->devices, list) in sm501_dev_remove()
1651 sm501_remove_sub(sm, smdev); in sm501_dev_remove()
1653 device_remove_file(sm->dev, &dev_attr_dbg_regs); in sm501_dev_remove()
1655 sm501_gpio_remove(sm); in sm501_dev_remove()
1660 struct sm501_devdata *sm = pci_get_drvdata(dev); in sm501_pci_remove() local
1662 sm501_dev_remove(sm); in sm501_pci_remove()
1663 iounmap(sm->regs); in sm501_pci_remove()
1665 release_mem_region(sm->io_res->start, 0x100); in sm501_pci_remove()
1672 struct sm501_devdata *sm = platform_get_drvdata(dev); in sm501_plat_remove() local
1674 sm501_dev_remove(sm); in sm501_plat_remove()
1675 iounmap(sm->regs); in sm501_plat_remove()
1677 release_mem_region(sm->io_res->start, 0x100); in sm501_plat_remove()