Commit 4df4db5c authored by Maciej W. Rozycki's avatar Maciej W. Rozycki Committed by Ralf Baechle

[TC] dec_esp: Driver model for the PMAZ-A

This is a set of changes that converts the PMAZ-A support to the driver model.

The use of the driver model required switching to the hotplug SCSI
initialization model, which in turn required a change to the core NCR53C9x
driver.  I decided not to break all the frontend drivers and introduced an
additional parameter for esp_allocate() to select between the old and the new
model.  I hope this is OK, but I would be fine with converting NCR53C9x to the
new model unconditionally as long as I do not have to fix all the other
frontends (OK, perhaps I could do some of them ;-) ).
Signed-off-by: default avatarMaciej W. Rozycki <macro@linux-mips.org>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 335dc50c
...@@ -528,12 +528,16 @@ void esp_bootup_reset(struct NCR_ESP *esp, struct ESP_regs *eregs) ...@@ -528,12 +528,16 @@ void esp_bootup_reset(struct NCR_ESP *esp, struct ESP_regs *eregs)
/* Allocate structure and insert basic data such as SCSI chip frequency /* Allocate structure and insert basic data such as SCSI chip frequency
* data and a pointer to the device * data and a pointer to the device
*/ */
struct NCR_ESP* esp_allocate(struct scsi_host_template *tpnt, void *esp_dev) struct NCR_ESP* esp_allocate(struct scsi_host_template *tpnt, void *esp_dev,
int hotplug)
{ {
struct NCR_ESP *esp, *elink; struct NCR_ESP *esp, *elink;
struct Scsi_Host *esp_host; struct Scsi_Host *esp_host;
esp_host = scsi_register(tpnt, sizeof(struct NCR_ESP)); if (hotplug)
esp_host = scsi_host_alloc(tpnt, sizeof(struct NCR_ESP));
else
esp_host = scsi_register(tpnt, sizeof(struct NCR_ESP));
if(!esp_host) if(!esp_host)
panic("Cannot register ESP SCSI host"); panic("Cannot register ESP SCSI host");
esp = (struct NCR_ESP *) esp_host->hostdata; esp = (struct NCR_ESP *) esp_host->hostdata;
......
...@@ -652,7 +652,7 @@ extern int nesps, esps_in_use, esps_running; ...@@ -652,7 +652,7 @@ extern int nesps, esps_in_use, esps_running;
/* External functions */ /* External functions */
extern void esp_bootup_reset(struct NCR_ESP *esp, struct ESP_regs *eregs); extern void esp_bootup_reset(struct NCR_ESP *esp, struct ESP_regs *eregs);
extern struct NCR_ESP *esp_allocate(struct scsi_host_template *, void *); extern struct NCR_ESP *esp_allocate(struct scsi_host_template *, void *, int);
extern void esp_deallocate(struct NCR_ESP *); extern void esp_deallocate(struct NCR_ESP *);
extern void esp_release(void); extern void esp_release(void);
extern void esp_initialize(struct NCR_ESP *); extern void esp_initialize(struct NCR_ESP *);
......
...@@ -121,7 +121,8 @@ int __init blz1230_esp_detect(struct scsi_host_template *tpnt) ...@@ -121,7 +121,8 @@ int __init blz1230_esp_detect(struct scsi_host_template *tpnt)
*/ */
address = ZTWO_VADDR(board); address = ZTWO_VADDR(board);
eregs = (struct ESP_regs *)(address + REAL_BLZ1230_ESP_ADDR); eregs = (struct ESP_regs *)(address + REAL_BLZ1230_ESP_ADDR);
esp = esp_allocate(tpnt, (void *)board+REAL_BLZ1230_ESP_ADDR); esp = esp_allocate(tpnt, (void *)board + REAL_BLZ1230_ESP_ADDR,
0);
esp_write(eregs->esp_cfg1, (ESP_CONFIG1_PENABLE | 7)); esp_write(eregs->esp_cfg1, (ESP_CONFIG1_PENABLE | 7));
udelay(5); udelay(5);
......
...@@ -100,7 +100,7 @@ int __init blz2060_esp_detect(struct scsi_host_template *tpnt) ...@@ -100,7 +100,7 @@ int __init blz2060_esp_detect(struct scsi_host_template *tpnt)
unsigned long board = z->resource.start; unsigned long board = z->resource.start;
if (request_mem_region(board+BLZ2060_ESP_ADDR, if (request_mem_region(board+BLZ2060_ESP_ADDR,
sizeof(struct ESP_regs), "NCR53C9x")) { sizeof(struct ESP_regs), "NCR53C9x")) {
esp = esp_allocate(tpnt, (void *)board+BLZ2060_ESP_ADDR); esp = esp_allocate(tpnt, (void *)board + BLZ2060_ESP_ADDR, 0);
/* Do command transfer with programmed I/O */ /* Do command transfer with programmed I/O */
esp->do_pio_cmds = 1; esp->do_pio_cmds = 1;
......
...@@ -126,7 +126,7 @@ int __init cyber_esp_detect(struct scsi_host_template *tpnt) ...@@ -126,7 +126,7 @@ int __init cyber_esp_detect(struct scsi_host_template *tpnt)
sizeof(struct ESP_regs)); sizeof(struct ESP_regs));
return 0; return 0;
} }
esp = esp_allocate(tpnt, (void *)board+CYBER_ESP_ADDR); esp = esp_allocate(tpnt, (void *)board + CYBER_ESP_ADDR, 0);
/* Do command transfer with programmed I/O */ /* Do command transfer with programmed I/O */
esp->do_pio_cmds = 1; esp->do_pio_cmds = 1;
......
...@@ -98,7 +98,7 @@ int __init cyberII_esp_detect(struct scsi_host_template *tpnt) ...@@ -98,7 +98,7 @@ int __init cyberII_esp_detect(struct scsi_host_template *tpnt)
address = (unsigned long)ZTWO_VADDR(board); address = (unsigned long)ZTWO_VADDR(board);
eregs = (struct ESP_regs *)(address + CYBERII_ESP_ADDR); eregs = (struct ESP_regs *)(address + CYBERII_ESP_ADDR);
esp = esp_allocate(tpnt, (void *)board+CYBERII_ESP_ADDR); esp = esp_allocate(tpnt, (void *)board + CYBERII_ESP_ADDR, 0);
esp_write(eregs->esp_cfg1, (ESP_CONFIG1_PENABLE | 7)); esp_write(eregs->esp_cfg1, (ESP_CONFIG1_PENABLE | 7));
udelay(5); udelay(5);
......
This diff is collapsed.
...@@ -142,7 +142,7 @@ int __init fastlane_esp_detect(struct scsi_host_template *tpnt) ...@@ -142,7 +142,7 @@ int __init fastlane_esp_detect(struct scsi_host_template *tpnt)
if (board < 0x1000000) { if (board < 0x1000000) {
goto err_release; goto err_release;
} }
esp = esp_allocate(tpnt, (void *)board+FASTLANE_ESP_ADDR); esp = esp_allocate(tpnt, (void *)board + FASTLANE_ESP_ADDR, 0);
/* Do command transfer with programmed I/O */ /* Do command transfer with programmed I/O */
esp->do_pio_cmds = 1; esp->do_pio_cmds = 1;
......
...@@ -75,7 +75,7 @@ static int jazz_esp_detect(struct scsi_host_template *tpnt) ...@@ -75,7 +75,7 @@ static int jazz_esp_detect(struct scsi_host_template *tpnt)
*/ */
if (1) { if (1) {
esp_dev = NULL; esp_dev = NULL;
esp = esp_allocate(tpnt, (void *) esp_dev); esp = esp_allocate(tpnt, esp_dev, 0);
/* Do command transfer with programmed I/O */ /* Do command transfer with programmed I/O */
esp->do_pio_cmds = 1; esp->do_pio_cmds = 1;
......
...@@ -351,7 +351,7 @@ int mac_esp_detect(struct scsi_host_template * tpnt) ...@@ -351,7 +351,7 @@ int mac_esp_detect(struct scsi_host_template * tpnt)
for (chipnum = 0; chipnum < chipspresent; chipnum ++) { for (chipnum = 0; chipnum < chipspresent; chipnum ++) {
struct NCR_ESP * esp; struct NCR_ESP * esp;
esp = esp_allocate(tpnt, (void *) NULL); esp = esp_allocate(tpnt, NULL, 0);
esp->eregs = (struct ESP_regs *) get_base(chipnum); esp->eregs = (struct ESP_regs *) get_base(chipnum);
esp->dma_irq_p = &esp_dafb_dma_irq_p; esp->dma_irq_p = &esp_dafb_dma_irq_p;
......
...@@ -122,7 +122,7 @@ static int mca_esp_detect(struct scsi_host_template *tpnt) ...@@ -122,7 +122,7 @@ static int mca_esp_detect(struct scsi_host_template *tpnt)
if ((slot = mca_find_adapter(*id_to_check, 0)) != if ((slot = mca_find_adapter(*id_to_check, 0)) !=
MCA_NOTFOUND) MCA_NOTFOUND)
{ {
esp = esp_allocate(tpnt, (void *) NULL); esp = esp_allocate(tpnt, NULL, 0);
pos[0] = mca_read_stored_pos(slot, 2); pos[0] = mca_read_stored_pos(slot, 2);
pos[1] = mca_read_stored_pos(slot, 3); pos[1] = mca_read_stored_pos(slot, 3);
......
...@@ -133,7 +133,7 @@ int oktagon_esp_detect(struct scsi_host_template *tpnt) ...@@ -133,7 +133,7 @@ int oktagon_esp_detect(struct scsi_host_template *tpnt)
eregs = (struct ESP_regs *)(address + OKTAGON_ESP_ADDR); eregs = (struct ESP_regs *)(address + OKTAGON_ESP_ADDR);
/* This line was 5 lines lower */ /* This line was 5 lines lower */
esp = esp_allocate(tpnt, (void *)board+OKTAGON_ESP_ADDR); esp = esp_allocate(tpnt, (void *)board + OKTAGON_ESP_ADDR, 0);
/* we have to shift the registers only one bit for oktagon */ /* we have to shift the registers only one bit for oktagon */
esp->shift = 1; esp->shift = 1;
......
...@@ -53,7 +53,7 @@ int sun3x_esp_detect(struct scsi_host_template *tpnt) ...@@ -53,7 +53,7 @@ int sun3x_esp_detect(struct scsi_host_template *tpnt)
struct ConfigDev *esp_dev; struct ConfigDev *esp_dev;
esp_dev = 0; esp_dev = 0;
esp = esp_allocate(tpnt, (void *) esp_dev); esp = esp_allocate(tpnt, esp_dev, 0);
/* Do command transfer with DMA */ /* Do command transfer with DMA */
esp->do_pio_cmds = 0; esp->do_pio_cmds = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment