mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-09-27 23:20:26 +09:00
dm: scsi: Split out the bus scanning code
Split out the code that scans a single SCSI bus into a separate function. This will allow it to be used from driver model. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
parent
f6580ef39b
commit
5c56176318
@ -601,9 +601,30 @@ static int do_scsi_scan_one(struct udevice *dev, int id, int lun, bool verbose)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int scsi_scan_dev(struct udevice *dev, bool verbose)
|
||||||
|
{
|
||||||
|
struct scsi_platdata *uc_plat; /* scsi controller platdata */
|
||||||
|
int ret;
|
||||||
|
int i;
|
||||||
|
int lun;
|
||||||
|
|
||||||
|
/* probe SCSI controller driver */
|
||||||
|
ret = device_probe(dev);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
/* Get controller platdata */
|
||||||
|
uc_plat = dev_get_uclass_platdata(dev);
|
||||||
|
|
||||||
|
for (i = 0; i < uc_plat->max_id; i++)
|
||||||
|
for (lun = 0; lun < uc_plat->max_lun; lun++)
|
||||||
|
do_scsi_scan_one(dev, i, lun, verbose);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int scsi_scan(bool verbose)
|
int scsi_scan(bool verbose)
|
||||||
{
|
{
|
||||||
unsigned char i, lun;
|
|
||||||
struct uclass *uc;
|
struct uclass *uc;
|
||||||
struct udevice *dev; /* SCSI controller */
|
struct udevice *dev; /* SCSI controller */
|
||||||
int ret;
|
int ret;
|
||||||
@ -618,19 +639,9 @@ int scsi_scan(bool verbose)
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
uclass_foreach_dev(dev, uc) {
|
uclass_foreach_dev(dev, uc) {
|
||||||
struct scsi_platdata *plat; /* scsi controller platdata */
|
ret = scsi_scan_dev(dev, verbose);
|
||||||
|
|
||||||
/* probe SCSI controller driver */
|
|
||||||
ret = device_probe(dev);
|
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* Get controller platdata */
|
|
||||||
plat = dev_get_uclass_platdata(dev);
|
|
||||||
|
|
||||||
for (i = 0; i < plat->max_id; i++)
|
|
||||||
for (lun = 0; lun < plat->max_lun; lun++)
|
|
||||||
do_scsi_scan_one(dev, i, lun, verbose);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -219,6 +219,14 @@ int scsi_bus_reset(struct udevice *dev);
|
|||||||
*/
|
*/
|
||||||
int scsi_scan(bool verbose);
|
int scsi_scan(bool verbose);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* scsi_scan_dev() - scan a SCSI bus and create devices
|
||||||
|
*
|
||||||
|
* @dev: SCSI bus
|
||||||
|
* @verbose: true to show information about each device found
|
||||||
|
*/
|
||||||
|
int scsi_scan_dev(struct udevice *dev, bool verbose);
|
||||||
|
|
||||||
#ifndef CONFIG_DM_SCSI
|
#ifndef CONFIG_DM_SCSI
|
||||||
void scsi_low_level_init(int busdevfunc);
|
void scsi_low_level_init(int busdevfunc);
|
||||||
void scsi_init(void);
|
void scsi_init(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user