return 0;
}
-int serial_setconfig(uint config)
+int serial_setconfig(struct udevice *dev, uint config)
{
struct dm_serial_ops *ops;
- if (!gd->cur_serial_dev)
- return 0;
-
- ops = serial_get_ops(gd->cur_serial_dev);
+ ops = serial_get_ops(dev);
if (ops->setconfig)
- return ops->setconfig(gd->cur_serial_dev, config);
+ return ops->setconfig(dev, config);
return 0;
}
#define serial_get_ops(dev) ((struct dm_serial_ops *)(dev)->driver->ops)
int serial_getconfig(struct udevice *dev, uint *config);
-int serial_setconfig(uint config);
+int serial_setconfig(struct udevice *dev, uint config);
int serial_getinfo(struct serial_device_info *info);
void atmel_serial_initialize(void);
* test with default config which is the only one supported by
* sandbox_serial driver
*/
- ut_assertok(serial_setconfig(SERIAL_DEFAULT_CONFIG));
+ ut_assertok(serial_setconfig(dev_serial, SERIAL_DEFAULT_CONFIG));
ut_assertok(serial_getconfig(dev_serial, &value_serial));
ut_assert(value_serial == SERIAL_DEFAULT_CONFIG);
ut_assertok(serial_getinfo(&info_serial));
* sandbox_serial driver: test with wrong parity
*/
ut_asserteq(-ENOTSUPP,
- serial_setconfig(SERIAL_CONFIG(SERIAL_PAR_ODD,
+ serial_setconfig(dev_serial,
+ SERIAL_CONFIG(SERIAL_PAR_ODD,
SERIAL_8_BITS,
SERIAL_ONE_STOP)));
/*
* sandbox_serial driver: test with wrong bits number
*/
ut_asserteq(-ENOTSUPP,
- serial_setconfig(SERIAL_CONFIG(SERIAL_PAR_NONE,
+ serial_setconfig(dev_serial,
+ SERIAL_CONFIG(SERIAL_PAR_NONE,
SERIAL_6_BITS,
SERIAL_ONE_STOP)));
* sandbox_serial driver: test with wrong stop bits number
*/
ut_asserteq(-ENOTSUPP,
- serial_setconfig(SERIAL_CONFIG(SERIAL_PAR_NONE,
+ serial_setconfig(dev_serial,
+ SERIAL_CONFIG(SERIAL_PAR_NONE,
SERIAL_8_BITS,
SERIAL_TWO_STOP)));