To setup VoIP phone and PC to be connected to single switch port, we need to configure switch port to carry both voice and data traffic at simultaneously. To do that wee have to create two VLANs, one for data and one for the voice. Assume we have vlan 02 for data and vlan 10 to carry voice traffic.
To achieve this for above scenario we need to configure Fa0/1 switchport.
Switch(config)#interface range fastethernet 0/1
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 02
Switch(config-if)#switchport voice vlan 10
Press Ctrl+End or Ctrl+Z to save configuration. Don’t forget to save running config to startup config.