qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 93198b: i2c: Split smbus into parts


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 93198b: i2c: Split smbus into parts
Date: Fri, 01 Mar 2019 06:22:51 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 93198b6cad8af03996373584284a1673ad6000cb
      
https://github.com/qemu/qemu/commit/93198b6cad8af03996373584284a1673ad6000cb
  Author: Corey Minyard <address@hidden>
  Date:   2019-02-27 (Wed, 27 Feb 2019)

  Changed paths:
    M MAINTAINERS
    M hw/arm/aspeed.c
    M hw/i2c/Makefile.objs
    M hw/i2c/pm_smbus.c
    R hw/i2c/smbus.c
    M hw/i2c/smbus_eeprom.c
    M hw/i2c/smbus_ich9.c
    A hw/i2c/smbus_master.c
    A hw/i2c/smbus_slave.c
    M hw/i386/pc_piix.c
    M hw/i386/pc_q35.c
    M hw/isa/vt82c686.c
    M hw/mips/mips_fulong2e.c
    M hw/mips/mips_malta.c
    M hw/ppc/sam460ex.c
    M include/hw/i2c/pm_smbus.h
    R include/hw/i2c/smbus.h
    A include/hw/i2c/smbus_eeprom.h
    A include/hw/i2c/smbus_master.h
    A include/hw/i2c/smbus_slave.h

  Log Message:
  -----------
  i2c: Split smbus into parts

smbus.c and smbus.h had device side code, master side code, and
smbus.h has some smbus_eeprom.c definitions.  Split them into
separate files.

Signed-off-by: Corey Minyard <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Tested-by: Philippe Mathieu-Daudé <address@hidden>


  Commit: 2ac4c5f4d2415116d3f417a32311d437791dcfce
      
https://github.com/qemu/qemu/commit/2ac4c5f4d2415116d3f417a32311d437791dcfce
  Author: Corey Minyard <address@hidden>
  Date:   2019-02-27 (Wed, 27 Feb 2019)

  Changed paths:
    M hw/arm/pxa2xx.c
    M hw/arm/tosa.c
    M hw/arm/z2.c
    M hw/audio/wm8750.c
    M hw/display/sii9022.c
    M hw/display/ssd0303.c
    M hw/gpio/max7310.c
    M hw/i2c/core.c
    M hw/i2c/i2c-ddc.c
    M hw/i2c/smbus_slave.c
    M hw/input/lm832x.c
    M hw/misc/pca9552.c
    M hw/misc/tmp105.c
    M hw/misc/tmp421.c
    M hw/nvram/eeprom_at24c.c
    M hw/timer/ds1338.c
    M hw/timer/m41t80.c
    M hw/timer/twl92230.c
    M include/hw/i2c/i2c.h

  Log Message:
  -----------
  i2c: have I2C receive operation return uint8_t

It is never supposed to fail and cannot return an error, so just
have it return the proper type.  Have it return 0xff on nothing
available, since that's what would happen on a real bus.

Signed-off-by: Corey Minyard <address@hidden>
Reviewed-by: Peter Maydell <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Tested-by: Philippe Mathieu-Daudé <address@hidden>


  Commit: 05f9f17e2caf249e9454f43e0c3751b2d06e1c06
      
https://github.com/qemu/qemu/commit/05f9f17e2caf249e9454f43e0c3751b2d06e1c06
  Author: Corey Minyard <address@hidden>
  Date:   2019-02-27 (Wed, 27 Feb 2019)

  Changed paths:
    M hw/arm/stellaris.c

  Log Message:
  -----------
  arm:i2c: Don't mask return from i2c_recv()

It can't fail, and now that it returns a uint8_t a 0xff mask
is unnecessary.

Signed-off-by: Corey Minyard <address@hidden>
Suggested-by: Peter Maydell <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Tested-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Peter Maydell <address@hidden>


  Commit: bc15cde0c4acc9128f26ff78f99ce34a59200d5e
      
https://github.com/qemu/qemu/commit/bc15cde0c4acc9128f26ff78f99ce34a59200d5e
  Author: Corey Minyard <address@hidden>
  Date:   2019-02-27 (Wed, 27 Feb 2019)

  Changed paths:
    M hw/i2c/aspeed_i2c.c
    M hw/i2c/exynos4210_i2c.c
    M hw/i2c/imx_i2c.c

  Log Message:
  -----------
  i2c: Don't check return value from i2c_recv()

i2c_recv() cannot fail, so there is no need to check the return
value.  It also returns unt8_t, so comparing with < 0 is not
meaningful.

Fix up various I2C controllers to remove the unneeded code.

Signed-off-by: Corey Minyard <address@hidden>
Suggested-by: Peter Maydell <address@hidden>


  Commit: 905cec6d11088e585fcedb3fd606510959ee50ff
      
https://github.com/qemu/qemu/commit/905cec6d11088e585fcedb3fd606510959ee50ff
  Author: Corey Minyard <address@hidden>
  Date:   2019-02-27 (Wed, 27 Feb 2019)

  Changed paths:
    M hw/i2c/smbus_slave.c
    M include/hw/i2c/smbus_slave.h

  Log Message:
  -----------
  i2c:smbus: Correct the working of quick commands

The logic of handling quick SMBus commands was wrong.  If you get a
finish event with no data, that's a quick command.

Document the quick command while we are at it.

Signed-off-by: Corey Minyard <address@hidden>


  Commit: 9cf27d74a829f651c0da5d80c014a6cef9d4cbd8
      
https://github.com/qemu/qemu/commit/9cf27d74a829f651c0da5d80c014a6cef9d4cbd8
  Author: Corey Minyard <address@hidden>
  Date:   2019-02-27 (Wed, 27 Feb 2019)

  Changed paths:
    M hw/i2c/smbus_eeprom.c
    M hw/i2c/smbus_slave.c
    M include/hw/i2c/smbus_slave.h

  Log Message:
  -----------
  i2c:smbus: Simplify write operation

There were two different write functions and the SMBus code kept
track of the command.

Keeping track of the command wasn't useful, in fact it wasn't quite
correct for the eeprom_smbus code.  And there is no need for two write
functions.  Just have one write function and the first byte in the
buffer is the command.

Signed-off-by: Corey Minyard <address@hidden>


  Commit: 031ac49886684ae6d6b88f37779cad2ffd1e4d9b
      
https://github.com/qemu/qemu/commit/031ac49886684ae6d6b88f37779cad2ffd1e4d9b
  Author: Corey Minyard <address@hidden>
  Date:   2019-02-27 (Wed, 27 Feb 2019)

  Changed paths:
    M hw/i2c/smbus_eeprom.c
    M hw/i2c/smbus_slave.c
    M include/hw/i2c/smbus_slave.h

  Log Message:
  -----------
  i2c:smbus: Simplify read handling

There were two different read functions, and with the removal of
the command passed in there is no functional difference.  So remove
one of them.  With that you don't need one of the states, so that
can be removed, too.

Signed-off-by: Corey Minyard <address@hidden>


  Commit: 08a8a4d45050f837d560f1aa23ee0ffff4a2c1d7
      
https://github.com/qemu/qemu/commit/08a8a4d45050f837d560f1aa23ee0ffff4a2c1d7
  Author: Corey Minyard <address@hidden>
  Date:   2019-02-27 (Wed, 27 Feb 2019)

  Changed paths:
    M hw/i2c/smbus_eeprom.c

  Log Message:
  -----------
  i2c:smbus_eeprom: Get rid of the quick command

It's not necessary, it won't be called if it's NULL.

Signed-off-by: Corey Minyard <address@hidden>


  Commit: 8b38e532b58d9e314d95aa9845cc89243ee60acc
      
https://github.com/qemu/qemu/commit/8b38e532b58d9e314d95aa9845cc89243ee60acc
  Author: Corey Minyard <address@hidden>
  Date:   2019-02-27 (Wed, 27 Feb 2019)

  Changed paths:
    M hw/i2c/smbus_eeprom.c
    M hw/i2c/smbus_slave.c

  Log Message:
  -----------
  i2c:smbus: Make white space in switch statements consistent

It had spaces between cases in some places and not others.  Add a space
for every one.

Signed-off-by: Corey Minyard <address@hidden>


  Commit: 7fccf2a06890e3bc3b30e29827ad3fb93fe88fea
      
https://github.com/qemu/qemu/commit/7fccf2a06890e3bc3b30e29827ad3fb93fe88fea
  Author: Corey Minyard <address@hidden>
  Date:   2019-02-27 (Wed, 27 Feb 2019)

  Changed paths:
    M hw/i386/pc_piix.c
    M hw/i386/pc_q35.c
    M include/hw/boards.h

  Log Message:
  -----------
  boards.h: Ignore migration for SMBus devices on older machines

Migration capability is being added for pm_smbus and SMBus devices.
This change will allow backwards compatibility to be kept when
migrating back to an old qemu version.  Add a bool to the machine
class tho keep smbus migration from happening.  Future changes
will use this.

Signed-off-by: Corey Minyard <address@hidden>
Cc: Eduardo Habkost <address@hidden>
Cc: Marcel Apfelbaum <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 52cc6a492b6c6e668f99e13d3cfad5caf7fbfd1c
      
https://github.com/qemu/qemu/commit/52cc6a492b6c6e668f99e13d3cfad5caf7fbfd1c
  Author: Corey Minyard <address@hidden>
  Date:   2019-02-27 (Wed, 27 Feb 2019)

  Changed paths:
    M hw/i2c/pm_smbus.c
    M include/hw/i2c/pm_smbus.h

  Log Message:
  -----------
  i2c:pm_smbus: Fix pm_smbus handling of I2C block read

The I2C block read function of pm_smbus was completely broken.  It
required doing some direct I2C handling because it didn't have a
defined size, the OS code just reads bytes until it marks the
transaction finished.

This also required adjusting how the AMIBIOS workaround code worked,
the I2C block mode was setting STS_HOST_BUSY during a transaction,
so that bit could no longer be used to inform the host status read
code to start the transaction.  Create a explicit bool for that
operation.

Also, don't read the next byte from the device in byte-by-byte
mode unless the OS is actually clearing the byte done bit.  Just
assuming that's what the OS is doing is a bad idea.

Signed-off-by: Corey Minyard <address@hidden>


  Commit: 8e995f34031d66666b45b779458cb370e86cfe2d
      
https://github.com/qemu/qemu/commit/8e995f34031d66666b45b779458cb370e86cfe2d
  Author: Corey Minyard <address@hidden>
  Date:   2019-02-27 (Wed, 27 Feb 2019)

  Changed paths:
    M include/migration/vmstate.h

  Log Message:
  -----------
  migration: Add a VMSTATE_BOOL_TEST() macro

This will be needed by coming I2C changes.

Signed-off-by: Corey Minyard <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 4ab2f2a8aabfea95cc53c64e13b3f67960b27fdf
      
https://github.com/qemu/qemu/commit/4ab2f2a8aabfea95cc53c64e13b3f67960b27fdf
  Author: Corey Minyard <address@hidden>
  Date:   2019-02-27 (Wed, 27 Feb 2019)

  Changed paths:
    M hw/acpi/piix4.c
    M hw/i2c/pm_smbus.c
    M hw/i2c/smbus_ich9.c
    M include/hw/i2c/pm_smbus.h

  Log Message:
  -----------
  i2c:pm_smbus: Fix state transfer

Transfer the state information for the SMBus registers and
internal data so it will work on a VM transfer.

Signed-off-by: Corey Minyard <address@hidden>
Cc: Michael S. Tsirkin <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Cc: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 547db24a17c22c47f762aae3a0a6f518f574e7f2
      
https://github.com/qemu/qemu/commit/547db24a17c22c47f762aae3a0a6f518f574e7f2
  Author: Corey Minyard <address@hidden>
  Date:   2019-02-27 (Wed, 27 Feb 2019)

  Changed paths:
    M hw/i2c/smbus_slave.c
    M include/hw/i2c/smbus_slave.h

  Log Message:
  -----------
  i2c:smbus_slave: Add an SMBus vmstate structure

There is no vmstate handling for SMBus, so no device sitting on SMBus
can have a state transfer that works reliably.  So add it.

Signed-off-by: Corey Minyard <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Cc: Michael S. Tsirkin <address@hidden>
Cc: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>


  Commit: b398a92440ef8283532b0cd3ec0197993232f28f
      
https://github.com/qemu/qemu/commit/b398a92440ef8283532b0cd3ec0197993232f28f
  Author: Corey Minyard <address@hidden>
  Date:   2019-02-27 (Wed, 27 Feb 2019)

  Changed paths:
    M hw/i2c/smbus_eeprom.c

  Log Message:
  -----------
  i2c:smbus_eeprom: Add normal type name and cast to smbus_eeprom.c

Create a type name and a cast macro and use those through the
code.

Signed-off-by: Corey Minyard <address@hidden>
Reviewed-by: Peter Maydell <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>


  Commit: 0cf487e5bd802fccb7db9d47fdf3dad15deb273e
      
https://github.com/qemu/qemu/commit/0cf487e5bd802fccb7db9d47fdf3dad15deb273e
  Author: Corey Minyard <address@hidden>
  Date:   2019-02-27 (Wed, 27 Feb 2019)

  Changed paths:
    M hw/i2c/smbus_eeprom.c

  Log Message:
  -----------
  i2c:smbus_eeprom: Add a size constant for the smbus_eeprom size

It was hard-coded to 256 in a number of places, create a constant
for that.

Signed-off-by: Corey Minyard <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>


  Commit: fd9df33f0829fd93d02f48fe650be057f8d52dfd
      
https://github.com/qemu/qemu/commit/fd9df33f0829fd93d02f48fe650be057f8d52dfd
  Author: Corey Minyard <address@hidden>
  Date:   2019-02-27 (Wed, 27 Feb 2019)

  Changed paths:
    M hw/i2c/smbus_eeprom.c

  Log Message:
  -----------
  i2c:smbus_eeprom: Add vmstate handling to the smbus eeprom

Transfer the state of the EEPROM on a migration.  This way the
data remains consistent on migration.

This required moving the actual data to a separate array and
using the data provided in the init function as a separate
initialization array, since a pointer property has to be a
void * and the array needs to be uint8_t[].

Signed-off-by: Corey Minyard <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Cc: Michael S. Tsirkin <address@hidden>
Cc: Dr. David Alan Gilbert <address@hidden>
Cc: Peter Maydell <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 1042b22dcbc23be124b2ebfb15a363cf7a36914c
      
https://github.com/qemu/qemu/commit/1042b22dcbc23be124b2ebfb15a363cf7a36914c
  Author: Corey Minyard <address@hidden>
  Date:   2019-02-27 (Wed, 27 Feb 2019)

  Changed paths:
    M hw/i2c/smbus_eeprom.c

  Log Message:
  -----------
  i2c:smbus_eeprom: Add a reset function to smbus_eeprom

Reset the contents to init data and reset the offset on a machine
reset.

Signed-off-by: Corey Minyard <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>


  Commit: c203d4514b9c8c1c3bf25988a81edf3813eb3c6d
      
https://github.com/qemu/qemu/commit/c203d4514b9c8c1c3bf25988a81edf3813eb3c6d
  Author: Corey Minyard <address@hidden>
  Date:   2019-02-27 (Wed, 27 Feb 2019)

  Changed paths:
    M hw/i2c/smbus_eeprom.c

  Log Message:
  -----------
  i2c: Verify that the count passed in to smbus_eeprom_init() is valid

Keep someone from passing in a bogus number

Signed-off-by: Corey Minyard <address@hidden>


  Commit: 20b084c4b1401b7f8fbc385649d48c67b6f43d44
      
https://github.com/qemu/qemu/commit/20b084c4b1401b7f8fbc385649d48c67b6f43d44
  Author: Peter Maydell <address@hidden>
  Date:   2019-03-01 (Fri, 01 Mar 2019)

  Changed paths:
    M MAINTAINERS
    M hw/acpi/piix4.c
    M hw/arm/aspeed.c
    M hw/arm/pxa2xx.c
    M hw/arm/stellaris.c
    M hw/arm/tosa.c
    M hw/arm/z2.c
    M hw/audio/wm8750.c
    M hw/display/sii9022.c
    M hw/display/ssd0303.c
    M hw/gpio/max7310.c
    M hw/i2c/Makefile.objs
    M hw/i2c/aspeed_i2c.c
    M hw/i2c/core.c
    M hw/i2c/exynos4210_i2c.c
    M hw/i2c/i2c-ddc.c
    M hw/i2c/imx_i2c.c
    M hw/i2c/pm_smbus.c
    R hw/i2c/smbus.c
    M hw/i2c/smbus_eeprom.c
    M hw/i2c/smbus_ich9.c
    A hw/i2c/smbus_master.c
    A hw/i2c/smbus_slave.c
    M hw/i386/pc_piix.c
    M hw/i386/pc_q35.c
    M hw/input/lm832x.c
    M hw/isa/vt82c686.c
    M hw/mips/mips_fulong2e.c
    M hw/mips/mips_malta.c
    M hw/misc/pca9552.c
    M hw/misc/tmp105.c
    M hw/misc/tmp421.c
    M hw/nvram/eeprom_at24c.c
    M hw/ppc/sam460ex.c
    M hw/timer/ds1338.c
    M hw/timer/m41t80.c
    M hw/timer/twl92230.c
    M include/hw/boards.h
    M include/hw/i2c/i2c.h
    M include/hw/i2c/pm_smbus.h
    R include/hw/i2c/smbus.h
    A include/hw/i2c/smbus_eeprom.h
    A include/hw/i2c/smbus_master.h
    A include/hw/i2c/smbus_slave.h
    M include/migration/vmstate.h

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/cminyard/tags/i2c-for-release-20190228' 
into staging

This has been out there long enough, I need to get this in.

This was changed a little bit since my post on Feb 20 (to which
there were no comments) due to changes I had to work around:

Change b296b664abc73253 "smbus: Add a helper to generate SPD EEPROM
data" added a function to include/hw/i2c/smbus.h, which I had to move to
include/hw/smbus_eeprom.h.

There were some changes to hw/i2c/Makefile.objs that I had to fix up.

Beyond that, no changes.

Thanks,

-corey

# gpg: Signature made Thu 28 Feb 2019 18:05:49 GMT
# gpg:                using RSA key FD0D5CE67CE0F59A6688268661F38C90919BFF81
# gpg: Good signature from "Corey Minyard <address@hidden>" [unknown]
# gpg:                 aka "Corey Minyard <address@hidden>" [unknown]
# gpg:                 aka "Corey Minyard <address@hidden>" [unknown]
# gpg:                 aka "Corey Minyard <address@hidden>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: FD0D 5CE6 7CE0 F59A 6688  2686 61F3 8C90 919B FF81

* remotes/cminyard/tags/i2c-for-release-20190228:
  i2c: Verify that the count passed in to smbus_eeprom_init() is valid
  i2c:smbus_eeprom: Add a reset function to smbus_eeprom
  i2c:smbus_eeprom: Add vmstate handling to the smbus eeprom
  i2c:smbus_eeprom: Add a size constant for the smbus_eeprom size
  i2c:smbus_eeprom: Add normal type name and cast to smbus_eeprom.c
  i2c:smbus_slave: Add an SMBus vmstate structure
  i2c:pm_smbus: Fix state transfer
  migration: Add a VMSTATE_BOOL_TEST() macro
  i2c:pm_smbus: Fix pm_smbus handling of I2C block read
  boards.h: Ignore migration for SMBus devices on older machines
  i2c:smbus: Make white space in switch statements consistent
  i2c:smbus_eeprom: Get rid of the quick command
  i2c:smbus: Simplify read handling
  i2c:smbus: Simplify write operation
  i2c:smbus: Correct the working of quick commands
  i2c: Don't check return value from i2c_recv()
  arm:i2c: Don't mask return from i2c_recv()
  i2c: have I2C receive operation return uint8_t
  i2c: Split smbus into parts

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/f0ce2e17cdd0...20b084c4b140



reply via email to

[Prev in Thread] Current Thread [Next in Thread]